[prev] [index] [next]

Makefiles (cont)

Can have multiple targets:

example: a.o b.o c.o
	gcc -o a.out a.o b.o c.o

a.o: a.c
	gcc -Wall -c a.c

b.o: c.c
	gcc -Wall -c b.c

c.o: c.c
	gcc -Wall -c c.c

  • you can then run   make example   or   make a.o   or   make b.o   or   make c.o
    • this will make the named target and all the targets it depends on
  • simply typing make will do the first target (this is the default)