1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
PROGS=test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 \
test13 test14 test15 test16 test17 test18 test19 test20 test21 test22 test23
OBJS=$(patsubst %,%.o,$(PROGS))
CFLAGS += -I../include
CFLAGS += -g
CFLAGS += -Wall -Wextra
LDFLAGS += -L.. -lut
TEST_TARGET=run_tests
TESTS=./do_tests
all: $(OBJS) $(PROGS) $(TEST_TARGET)
# static pattern rule: multiple targets
$(OBJS): %.o: %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
$(PROGS): %: %.o
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $< $(LDFLAGS)
run_tests: $(PROGS)
perl $(TESTS)
.PHONY: clean
clean:
rm -f $(PROGS) $(OBJS) test*.out
|