Skip to content

Commit 868923f

Browse files
committed
Basic build configuration for MSYS/MinGW.
1 parent f65b1ba commit 868923f

File tree

2 files changed

+54
-44
lines changed

2 files changed

+54
-44
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.o
22
*.test
33
.*.swp
4+
*.exe
5+
*~

Makefile

+52-44
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,37 @@
1313
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1414
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515

16+
ifeq ($(OS),Windows_NT)
17+
OS_CFLAGS = -D__Windows__
18+
TEST = .exe
19+
else
20+
TEST = .test
21+
endif
22+
1623
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)
3947
CC = gcc
4048

4149
all: $(TESTS)
@@ -49,77 +57,77 @@ test: $(TESTS)
4957

5058
clean:
5159
rm -f */*.o
52-
rm -f tests/*.test
60+
rm -f tests/*$(TEST)
5361

54-
tests/containers.test: tests/test_containers.o
62+
tests/containers$(TEST): tests/test_containers.o
5563
$(CC) -o $@ $^
5664

57-
tests/list.test: tests/test_list.o src/list.o
65+
tests/list$(TEST): tests/test_list.o src/list.o
5866
$(CC) -o $@ $^
5967

60-
tests/vector.test: tests/test_vector.o src/vector.o
68+
tests/vector$(TEST): tests/test_vector.o src/vector.o
6169
$(CC) -o $@ $^
6270

63-
tests/rbt.test: tests/test_rbt.o src/rbt.o
71+
tests/rbt$(TEST): tests/test_rbt.o src/rbt.o
6472
$(CC) -o $@ $^
6573

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
6775
$(CC) -o $@ $^
6876

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
7078
$(CC) -o $@ $^
7179

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
7381
$(CC) -o $@ $^
7482

75-
tests/hash.test: tests/test_hash.o src/hash.o
83+
tests/hash$(TEST): tests/test_hash.o src/hash.o
7684
$(CC) -o $@ $^
7785

78-
tests/strbuf.test: tests/test_strbuf.o src/strbuf.o
86+
tests/strbuf$(TEST): tests/test_strbuf.o src/strbuf.o
7987
$(CC) -o $@ $^
8088

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 \
8290
src/slab.o src/list.o
8391
$(CC) -o $@ $^
8492

85-
tests/bint.test: tests/test_bint.o src/bint.o
93+
tests/bint$(TEST): tests/test_bint.o src/bint.o
8694
$(CC) -o $@ $^
8795

88-
tests/slist.test: tests/test_slist.o src/slist.o
96+
tests/slist$(TEST): tests/test_slist.o src/slist.o
8997
$(CC) -o $@ $^
9098

91-
tests/cbuf.test: tests/test_cbuf.o src/cbuf.o
99+
tests/cbuf$(TEST): tests/test_cbuf.o src/cbuf.o
92100
$(CC) -o $@ $^
93101

94-
tests/syserr.test: tests/test_syserr.o
102+
tests/syserr$(TEST): tests/test_syserr.o
95103
$(CC) -o $@ $^
96104

97-
tests/clock.test: tests/test_clock.o io/clock.o
105+
tests/clock$(TEST): tests/test_clock.o io/clock.o
98106
$(CC) -o $@ $^ -lrt
99107

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
101109
$(CC) -o $@ $^ -lpthread -lrt
102110

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 \
104112
src/slist.o io/clock.o
105113
$(CC) -o $@ $^ -lpthread -lrt
106114

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 \
108116
io/thr.o io/clock.o src/slist.o src/rbt.o \
109117
src/rbt_iter.o
110118
$(CC) -o $@ $^ -lpthread -lrt
111119

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 \
113121
io/runq.o io/thr.o io/clock.o src/slist.o \
114122
src/rbt.o src/rbt_iter.o
115123
$(CC) -o $@ $^ -lpthread -lrt
116124

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 \
118126
io/runq.o io/thr.o io/clock.o src/slist.o \
119127
src/rbt.o src/rbt_iter.o io/afile.o
120128
$(CC) -o $@ $^ -lpthread -lrt
121129

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 \
123131
io/thr.o src/slist.o
124132
$(CC) -o $@ $^ -lpthread
125133

0 commit comments

Comments
 (0)