# makefile # Huan Chen, 2/21/2017 CC = gcc CFLAGS = -g -Wall #-DDEBUG LFLAGS = -g -Wall #-DDEBUG # check the unit test package "Conf_map.tar.gz" for utils.c, map.c, utils_test.c, map_test.c # test modules TESTS = u m c # (utils, map, config) T = u # check memory leaks: make check T=m # it will run ./m in valgrind # to test utils.c, run ./u # to test map.c, run ./m # to run the all tests in one file, run ./c PROJECT = c # configure map in one file: config.c all: u m c test: ./$(PROJECT) ./u ./m $(PROJECT): config.c $(CC) $(CFLAGS) $< -o $@ # test map.c m: map_test.o utils.o map.o $(CC) $(LFLAGS) $^ -o $@ # test utils.c u: utils_test.o utils.o $(CC) $(LFLAGS) $^ -o $@ %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ # check memory leaks check: valgrind --leak-check=full ./$(T) tar: tar czf ../Conf_map.tar.gz *.c *.h makefile *.map clean: rm -f *.o $(PROJECT) $(TESTS)