Computer Science Canada Makefile question |
Author: | Geminias [ Wed Feb 13, 2008 8:34 pm ] | ||
Post subject: | Makefile question | ||
I know the basics, but I don't know exactly what is going on here:
in particular, what are the $@? is that the same as bash script for all arguments? $<? $<? How does it know to build test.cpp before test? |
Author: | OneOffDriveByPoster [ Wed Feb 13, 2008 9:13 pm ] |
Post subject: | Re: Makefile question |
Geminias @ Wed Feb 13, 2008 8:34 pm wrote: in particular, what are the $@? is that the same as bash script for all arguments? $<? $<?
http://www.tlug.org.za/old/csslug/writing_makefiles.html#makefile_builtinvars and the .cpp.o tells 'make' how to make .o files from .cpp files.How does it know to build .cpp before ? |
Author: | Geminias [ Wed Feb 13, 2008 9:59 pm ] | ||
Post subject: | RE:Makefile question | ||
Great thanks. One other question, say you have multiple programs that you want to be able to build seperately and also together, would you use makefiles for this or a script? I've basically got directories P1 P2 P3. Each with its own make file. To make Program 1 it would be P1/Makefile. Program 2: P2/Makefile. etc... Is it adviseable to try something like this for a makefile in the top directory like:
|
Author: | OneOffDriveByPoster [ Wed Feb 13, 2008 10:11 pm ] | ||
Post subject: | Re: RE:Makefile question | ||
Geminias @ Wed Feb 13, 2008 9:59 pm wrote: I've basically got directories P1 P2 P3. Each with its own make file. To make Program 1 it would be P1/Makefile. Program 2: P2/Makefile. etc...
In my experience, a Makefile is appropriate at the top-level. Your structure looks okay; however, the normal way is to use
|
Author: | Geminias [ Thu Feb 14, 2008 9:59 am ] | ||
Post subject: | RE:Makefile question | ||
Alright great. Does anyone know a better way to solve this?
|
Author: | OneOffDriveByPoster [ Thu Feb 14, 2008 2:55 pm ] |
Post subject: | Re: RE:Makefile question |
Please provide a file listing in the future. Your problem is that your source files being referenced as dependencies are not in the same directory as your Makefile. Provide the path to the source files (not just the filename). |
Author: | Geminias [ Thu Feb 14, 2008 3:25 pm ] |
Post subject: | RE:Makefile question |
Righto... Thanks again. |