@@ -3,14 +3,14 @@ OBJDIR = obj
33
44SRCS = $(shell find $(SRCDIR ) -name "* .c")
55OBJS = $(patsubst $(SRCDIR ) /% .c, $(OBJDIR ) /% .o, $(SRCS ) )
6- EXCLUDES = $(shell find ./src/** /* _test.c)
6+ EXCLUDES = $(shell find ./src/** /* _test.c ./src/** /* _test.h)
7+
8+ DEV_SRCS = $(filter-out $(EXCLUDES ) $(SRCDIR ) /main_test.c, $(SRCS ) )
9+ DEV_OBJS = $(patsubst $(SRCDIR ) /% .c, $(OBJDIR ) /% .o, $(DEV_SRCS ) )
710
811TEST_SRCS = $(filter-out $(SRCDIR ) /main.c, $(SRCS ) )
912TEST_OBJS = $(patsubst $(SRCDIR ) /% .c, $(OBJDIR ) /% .o, $(TEST_SRCS ) )
1013
11- PROD_SRCS = $(filter-out $(EXCLUDES ) , $(SRCS ) )
12- PROD_OBJS = $(patsubst $(SRCDIR ) /% .c, $(OBJDIR ) /% .o, $(PROD_SRCS ) )
13-
1414CC = gcc
1515CFLAGS = -I./$(SRCDIR )
1616
@@ -19,15 +19,15 @@ CFLAGS = -I./$(SRCDIR)
1919all : test dev
2020
2121test : $(TEST_OBJS )
22- $(CC ) $(CFLAGS ) $^ -o run_tests
23- trap ' rm -rf ./run_tests ' EXIT; ./run_tests
22+ $(CC ) $(CFLAGS ) $^ -o tests
23+ trap ' rm -rf ./tests ' EXIT; ./tests
2424
25- dev : $(PROD_OBJS )
25+ dev : $(DEV_OBJS )
2626$(CC ) $(CFLAGS ) $^ -o program
2727
2828$(OBJDIR ) /% .o : $(SRCDIR ) /% .c
2929mkdir -p $(dir $@ )
3030$(CC ) $(CFLAGS ) -c $< -o $@
3131
3232clean :
33- rm -rf $(OBJDIR ) run_tests program
33+ rm -rf $(OBJDIR ) tests program
0 commit comments