Use of Makefile
John Chambers
jc at trillian.mit.edu
Mon May 10 12:36:28 EDT 2004
karina komments:
| Make files are used for managing (compiling and updating)
| software projects that have multiple files.
| One reference states:
|
|
| 'By default, when invoking a Makefile on the command line, the shell looks for a file named "Makefile" (note: uppercase) in the current working directory. Some versions also find "makefile" (note: lower case). If you want to circumvent tradition for some reason, the -f option might be used to rename Makefiles with other names that may be deemed as more meaningful. An example of naming and invoking the makefile is seen below. '
|
| prompt>make -f someothername
|
| Can someone elaborate on an example where invoking Make
| by some other name is desirable?
Sure. Suppose you want to do compiles on a number of different kinds
of machines, and the the differences are too great to easily do them
all with a single Makefile. You might have a number of Makefiles:
Makefile.linux for building on a linux system
Makefile.FreeBSD for building on FreeBSD
Makefile.solaris for building on a Sun
Makefile.HPUX for building on an HP-UX system
and so on.
You might also use this to do compiles with different compilers and/or
libraries.
In general, you might like to also have a "Makefile" for the benefit
of people who like to type "make" and expect it to work. This might
do something like trigger a "Configure" script to figure out what
sort of system it's on, and then do a second "make -f Makefile.$type"
to run a make command with the appropriate Makefile.whatever file.
You can see examples of this in a lot of "Open Source" packages, which
are very often written to compile on a number of different systems.
More information about the Discuss
mailing list