Why are Makefiles in Linux so useful?
The normal way
for Linux is to use a make file.
It evolved out of all the mistakes people made by compiling ever more complex applications by hand or with home-made scripts. It is non-trivial to represent build dependencies for a complex project. Make simply offers a standardized way to specify such dependencies and a tool to parse the dependencies and run associated build actions.
Even UI's that simplify/automate the build process for you use a make file or something similar behind the scenes.
UPDATE
In for those wondering about the automake comment, here are two differing views on the topic
http://www.freesoftwaremagazine.com/books/autotools_a_guide_to_autoconf_automake_libtool
http://www.scurrilous.com/blog/archives/2005/08/23/i-hate-automake/
Makefiles do so much work for you, and are frequently more powerful than people realize. Take the following simple makefile
all: helloworld
that's one line, and (gnu make, at least) would know to run cc -o helloworld helloworld.c
Then, as the project grows, you add one more rule:
helloworld: ui.o xml.o mailcomponent.o
$(CC) $(CFLAGS) -o $@ [email protected] $^
and make knows to run
cc -c ui.c
cc -c xml.c
cc -c mailcomponent.c
cc -o helloworld helloworld.c ui.o xml.o mailcomponent.o
Then say you want to optimize everything.
CFLAGS=-O2
at the beginning of the file takes care of you.
When the project gets larger, make keeps track of the files which have and haven't changed, preventing extraneous, and time-consuming re-compiles.
Makefiles are wonderful timesavers, and I haven't even touched on more advanced recipes.