pavement

Make

From FreeBSDwiki
Revision as of 00:02, 21 October 2005 by Dave (Talk | contribs)
Jump to: navigation, search

make is, to quote the GNU make page,

Make is a tool which controls the generation of executables and other 
non-source files of a program from the program's source files.

Make gets its knowledge of how to build your program from a file called 
the makefile, which lists each of the non-source files and how to compute 
it from other files. When you write a program, you should write a makefile 
for it, so that it is possible to use Make to build and install the program. 

Which roughly means that it helps you compile stuff easily, if the proper makefile has been created. The directories in ports all have at least one thing in common: they all have a makefile that helps the building and installation of the port. A makefile will have "targets" which tell make to do different things depending on what target you specify. For example, running

make

by itself runs the makefile's build options, running

make install

will run the make command against the "install" target in the makefile and do what it says, which is usually installing the port and registering it against the FreeBSD package database, and running

make clean

will run it through the "clean" target in the makefile, which normally does cleanup stuff (like emptying out the particular port's "workdir", where temporary files are put during the compile and install of the port.)

Thanks in no small part to the makefile (and the FreeBSD maintainers who take care of the ports tree) make is usually "smart" enough to know that when you type in

make install clean

all in one go, you're really asking to do

make
make install
make clean

which is functionally the same as

make && make install && make clean

See the [GNU make page] for more info.

Personal tools