1
1
CFLAGS = -pipe -ggdb
2
2
3
3
PROGS = reactd
4
- TESTS = test_reset_list test_ring
4
+ TESTS = test_reset_list test_ring test_hash test_btree
5
5
6
6
all : $(PROGS )
7
7
tests : $(TESTS )
@@ -11,18 +11,27 @@ debug: CFLAGS += -DDEBUG -ggdb
11
11
debug : all
12
12
@true
13
13
14
+ ifneq ($(STATIC ) ,)
15
+ LDFLAGS+ =-static
16
+ PKGCONFIG_ARGS+ =--static
17
+ endif
18
+ # LDFLAGS_pcre = $(shell pcre-config --libs)
19
+ LDFLAGS_pcre = $(shell pkg-config --libs $(PKGCONFIG_ARGS ) libpcre)
20
+
14
21
ifeq ($(DEBUG ) ,)
15
22
CFLAGS += -ggdb -O3 -std=gnu99
16
23
else
17
- CFLAGS += -ggdb -std=gnu99 -DDEBUG -DDEBUG_RESET_LIST -DDEBUG_RING
24
+ CFLAGS += -ggdb -std=gnu99 -DDEBUG -DDEBUG_RESET_LIST -DDEBUG_RING -DDEBUG_HASH -DDEBUG_BTREE
18
25
endif
19
26
20
- objects_reactd = reactd_conf.tab.o reactd_conf.lex.yy.o reactd.o keylist.o pcre_subst.o debug.o log.o ring.o reset_list.o
21
- objects_keylist_test = keylist_test.o keylist.o debug.o
22
- objects_threshold_test = threshold_test.o threshold.o keylist.o debug.o
27
+ objects_reactd = reactd_conf.tab.o reactd_conf.lex.yy.o reactd.o avl.o pcre_subst.o debug.o log.o ring.o reset_list.o
23
28
objects_subst_test = subst_test.o pcre_subst.o debug.o
24
29
objects_reset_list_test = test_reset_list Test_reset_list.o reset_list_test.o reset_list.o Test_reset_list.c
25
- objects_ring_test = test_ring Test_ring.o ring_test.o ring.o Test_ring.c
30
+ objects_ring_test = test_ring ring_test.o Test_ring.o ring.o Test_ring.c
31
+ # objects_keylist_test = keylist_test.o keylist.o debug.o
32
+ # objects_threshold_test = threshold_test.o threshold.o keylist.o debug.o
33
+ # objects_hash_test = test_hash Test_hash.o hash.o Test_hash.c
34
+ # objects_btree_test = test_btree Test_btree.o btree.o Test_btree.c
26
35
27
36
% .o : % .c % .h
28
37
$(CC ) -c $(CFLAGS ) $* .c -o $* .o
@@ -34,19 +43,19 @@ reactd_conf.lex.yy.c: reactd_conf.l reactd_conf.tab.h
34
43
flex -o reactd_conf.lex.yy.c reactd_conf.l
35
44
36
45
reactd : $(objects_reactd )
37
- $(CC ) $(CFLAGS ) $(objects_reactd ) -lfl -lpcre -lm -o reactd
46
+ $(CC ) $(LDFLAGS ) $( CFLAGS ) $(objects_reactd ) -lfl $( LDFLAGS_pcre ) -lm -o reactd
38
47
39
- keylist_test : $(objects_keylist_test )
40
- $(CC ) $(CFLAGS ) $(objects_keylist_test ) -o keylist_test
41
-
42
- threshold_test : $(objects_threshold_test )
43
- $(CC ) $(CFLAGS ) $(objects_threshold_test ) -o threshold_test -lpthread
48
+ # keylist_test: $(objects_keylist_test)
49
+ # $(CC) $(CFLAGS) $(objects_keylist_test) -o keylist_test
50
+
51
+ # threshold_test: $(objects_threshold_test)
52
+ # $(CC) $(CFLAGS) $(objects_threshold_test) -o threshold_test -lpthread
44
53
45
54
subst_test : $(objects_subst_test )
46
55
$(CC ) $(CFLAGS ) $(objects_subst_test ) -lpcre -o subst_test
47
56
48
57
clean :
49
- rm -f reactd reactd_conf.tab.c reactd_conf.tab.h reactd_conf.lex.yy.c $(objects_reactd ) keylist_test $(objects_keylist_test ) threshold_test $(objects_threshold_test ) subst_test $(objects_subst_test ) $(objects_reset_list_test ) $(objects_ring_test )
58
+ rm -f reactd reactd_conf.tab.c reactd_conf.tab.h reactd_conf.lex.yy.c $(objects_reactd ) keylist_test $(objects_keylist_test ) threshold_test $(objects_threshold_test ) subst_test $(objects_subst_test ) $(objects_reset_list_test ) $(objects_ring_test ) $( objects_btree_test )
50
59
51
60
# Unit Tests
52
61
Test_reset_list.c : reset_list_test.c
@@ -60,3 +69,15 @@ Test_ring.c: ring_test.c
60
69
61
70
test_ring : CuTest.c Test_ring.o ring_test.o ring.o
62
71
$(CC ) $(CFLAGS ) -o $@ $^
72
+
73
+ # Test_hash.c: hash_test.c
74
+ # ./make-tests.sh $< > $@
75
+ #
76
+ # test_hash: CuTest.c Test_hash.o hash_test.o hash.o
77
+ # $(CC) $(CFLAGS) -o $@ $^
78
+
79
+ # Test_btree.c: btree_test.c
80
+ # ./make-tests.sh $< > $@
81
+ #
82
+ # test_btree: CuTest.c Test_btree.o btree_test.o btree.o
83
+ # $(CC) $(CFLAGS) -o $@ $^
0 commit comments