13
13
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
14
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
15
16
+ ifeq ($(OS ) ,Windows_NT)
17
+ OS_CFLAGS = -D__Windows__
18
+ TEST = .exe
19
+ else
20
+ TEST = .test
21
+ endif
22
+
16
23
TESTS = \
17
- tests/containers.test \
18
- tests/list.test \
19
- tests/vector.test \
20
- tests/rbt.test \
21
- tests/rbt_iter.test \
22
- tests/rbt_range.test \
23
- tests/slab.test \
24
- tests/hash.test \
25
- tests/strbuf.test \
26
- tests/istr.test \
27
- tests/bint.test \
28
- tests/slist.test \
29
- tests/cbuf.test \
30
- tests/syserr.test \
31
- tests/clock.test \
32
- tests/thr.test \
33
- tests/runq.test \
34
- tests/waitq.test \
35
- tests/ioq.test \
36
- tests/mailbox.test \
37
- tests/afile.test
38
- CFLAGS = -O1 -Wall -ggdb -Isrc -Iio
24
+ tests/containers$(TEST ) \
25
+ tests/list$(TEST ) \
26
+ tests/vector$(TEST ) \
27
+ tests/rbt$(TEST ) \
28
+ tests/rbt_iter$(TEST ) \
29
+ tests/rbt_range$(TEST ) \
30
+ tests/slab$(TEST ) \
31
+ tests/hash$(TEST ) \
32
+ tests/strbuf$(TEST ) \
33
+ tests/istr$(TEST ) \
34
+ tests/bint$(TEST ) \
35
+ tests/slist$(TEST ) \
36
+ tests/cbuf$(TEST ) \
37
+ tests/syserr$(TEST ) \
38
+ tests/clock$(TEST ) \
39
+ tests/thr$(TEST ) \
40
+ tests/runq$(TEST ) \
41
+ tests/waitq$(TEST ) \
42
+ tests/ioq$(TEST ) \
43
+ tests/mailbox$(TEST ) \
44
+ tests/afile$(TEST )
45
+
46
+ CFLAGS = -O1 -Wall -ggdb -Isrc -Iio $(OS_CFLAGS )
39
47
CC = gcc
40
48
41
49
all : $(TESTS )
@@ -49,77 +57,77 @@ test: $(TESTS)
49
57
50
58
clean :
51
59
rm -f * /* .o
52
- rm -f tests/* .test
60
+ rm -f tests/* $( TEST )
53
61
54
- tests/containers.test : tests/test_containers.o
62
+ tests/containers$( TEST ) : tests/test_containers.o
55
63
$(CC ) -o $@ $^
56
64
57
- tests/list.test : tests/test_list.o src/list.o
65
+ tests/list$( TEST ) : tests/test_list.o src/list.o
58
66
$(CC ) -o $@ $^
59
67
60
- tests/vector.test : tests/test_vector.o src/vector.o
68
+ tests/vector$( TEST ) : tests/test_vector.o src/vector.o
61
69
$(CC ) -o $@ $^
62
70
63
- tests/rbt.test : tests/test_rbt.o src/rbt.o
71
+ tests/rbt$( TEST ) : tests/test_rbt.o src/rbt.o
64
72
$(CC ) -o $@ $^
65
73
66
- tests/rbt_iter.test : tests/test_rbt_iter.o src/rbt.o src/rbt_iter.o
74
+ tests/rbt_iter$( TEST ) : tests/test_rbt_iter.o src/rbt.o src/rbt_iter.o
67
75
$(CC ) -o $@ $^
68
76
69
- tests/rbt_range.test : tests/test_rbt_range.o src/rbt.o src/rbt_range.o
77
+ tests/rbt_range$( TEST ) : tests/test_rbt_range.o src/rbt.o src/rbt_range.o
70
78
$(CC ) -o $@ $^
71
79
72
- tests/slab.test : tests/test_slab.o src/slab.o src/list.o
80
+ tests/slab$( TEST ) : tests/test_slab.o src/slab.o src/list.o
73
81
$(CC ) -o $@ $^
74
82
75
- tests/hash.test : tests/test_hash.o src/hash.o
83
+ tests/hash$( TEST ) : tests/test_hash.o src/hash.o
76
84
$(CC ) -o $@ $^
77
85
78
- tests/strbuf.test : tests/test_strbuf.o src/strbuf.o
86
+ tests/strbuf$( TEST ) : tests/test_strbuf.o src/strbuf.o
79
87
$(CC ) -o $@ $^
80
88
81
- tests/istr.test : tests/test_istr.o src/istr.o src/strbuf.o src/hash.o \
89
+ tests/istr$( TEST ) : tests/test_istr.o src/istr.o src/strbuf.o src/hash.o \
82
90
src/slab.o src/list.o
83
91
$(CC ) -o $@ $^
84
92
85
- tests/bint.test : tests/test_bint.o src/bint.o
93
+ tests/bint$( TEST ) : tests/test_bint.o src/bint.o
86
94
$(CC ) -o $@ $^
87
95
88
- tests/slist.test : tests/test_slist.o src/slist.o
96
+ tests/slist$( TEST ) : tests/test_slist.o src/slist.o
89
97
$(CC ) -o $@ $^
90
98
91
- tests/cbuf.test : tests/test_cbuf.o src/cbuf.o
99
+ tests/cbuf$( TEST ) : tests/test_cbuf.o src/cbuf.o
92
100
$(CC ) -o $@ $^
93
101
94
- tests/syserr.test : tests/test_syserr.o
102
+ tests/syserr$( TEST ) : tests/test_syserr.o
95
103
$(CC ) -o $@ $^
96
104
97
- tests/clock.test : tests/test_clock.o io/clock.o
105
+ tests/clock$( TEST ) : tests/test_clock.o io/clock.o
98
106
$(CC ) -o $@ $^ -lrt
99
107
100
- tests/thr.test : tests/test_thr.o io/thr.o io/clock.o
108
+ tests/thr$( TEST ) : tests/test_thr.o io/thr.o io/clock.o
101
109
$(CC ) -o $@ $^ -lpthread -lrt
102
110
103
- tests/runq.test : tests/test_runq.o io/runq.o io/thr.o \
111
+ tests/runq$( TEST ) : tests/test_runq.o io/runq.o io/thr.o \
104
112
src/slist.o io/clock.o
105
113
$(CC ) -o $@ $^ -lpthread -lrt
106
114
107
- tests/waitq.test : tests/test_waitq.o io/waitq.o io/runq.o \
115
+ tests/waitq$( TEST ) : tests/test_waitq.o io/waitq.o io/runq.o \
108
116
io/thr.o io/clock.o src/slist.o src/rbt.o \
109
117
src/rbt_iter.o
110
118
$(CC ) -o $@ $^ -lpthread -lrt
111
119
112
- tests/ioq.test : tests/test_ioq.o io/ioq.o io/waitq.o \
120
+ tests/ioq$( TEST ) : tests/test_ioq.o io/ioq.o io/waitq.o \
113
121
io/runq.o io/thr.o io/clock.o src/slist.o \
114
122
src/rbt.o src/rbt_iter.o
115
123
$(CC ) -o $@ $^ -lpthread -lrt
116
124
117
- tests/afile.test : tests/test_afile.o io/ioq.o io/waitq.o \
125
+ tests/afile$( TEST ) : tests/test_afile.o io/ioq.o io/waitq.o \
118
126
io/runq.o io/thr.o io/clock.o src/slist.o \
119
127
src/rbt.o src/rbt_iter.o io/afile.o
120
128
$(CC ) -o $@ $^ -lpthread -lrt
121
129
122
- tests/mailbox.test : tests/test_mailbox.o io/mailbox.o io/runq.o \
130
+ tests/mailbox$( TEST ) : tests/test_mailbox.o io/mailbox.o io/runq.o \
123
131
io/thr.o src/slist.o
124
132
$(CC ) -o $@ $^ -lpthread
125
133
0 commit comments