1 test: foo.c 2 3 foo.c: 4 touch foo.c 5 6 OBJS := foo.o 7 8 $(OBJS): | bar.a 9 10 $(OBJS): CFLAGS:=-g 11 12 %.o: %.c FORCE_DO_CMD 13 echo compile $@ from $< 14 15 .PHONY: FORCE_DO_CMD 16 FORCE_DO_CMD: 17 18 bar.a: 19 echo archive $@ 20 21 foo.a: $(OBJS) 22 echo archive $@ 23 24 test2: foo.a 25 26 27 28