[prev] [index] [next]

Makefiles (cont)

Can have multiple targets:

tester: tester.o MyInt.o
	gcc -o tester tester.o MyInt.o

tester.o: tester.c MyInt.h
	gcc -Wall -c tester.c

MyInt.o: MyInt.c MyInt.h
	gcc -Wall -c MyInt.c

  • you can then run   make tester   or   make tester.o   or   make MyInt.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)