-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
140 lines (108 loc) · 5.75 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
SUBUNIT := -lsubunit
ZLIB := -lz
#we want to check what enviroment are we compiling under
UNAME := $(shell uname)
ifneq (,$(findstring CYGWIN,$(UNAME)))
ZLIB = -Wl,-Bstatic -lz -Wl,-Bdynamic
endif
ifneq (,$(findstring MSYS,$(UNAME)))
ZLIB = -Wl,-Bstatic -lz -Wl,-Bdynamic
SUBUNIT =
endif
all: CFLAGS := -O3
all: radiusGenerator modelGenerator chunkExtractor regionFileReader blockPrint
debug: CFLAGS := -Wall -Werror -Wpedantic -g
debug: radiusGenerator modelGenerator chunkExtractor regionFileReader blockPrint
mcErrno.o: src/lib/mcErrno.c
gcc src/lib/mcErrno.c -o mcErrno.o -c $(CFLAGS)
cNBT.o:
gcc cNBT/buffer.c -o cNBT/buffer.o -c $(CFLAGS)
gcc cNBT/nbt_parsing.c -o cNBT/nbt_parsing.o -c $(CFLAGS)
gcc cNBT/nbt_treeops.c -o cNBT/nbt_treeops.o -c $(CFLAGS)
gcc cNBT/nbt_util.c -o cNBT/nbt_util.o -c $(CFLAGS)
ld -relocatable cNBT/buffer.o cNBT/nbt_parsing.o cNBT/nbt_treeops.o cNBT/nbt_util.o -o cNBT.o
regionParser.o: src/lib/regionParser.c
gcc src/lib/regionParser.c -o regionParser.o -c -lm $(CFLAGS)
chunkParser.o: src/lib/chunkParser.c
gcc src/lib/chunkParser.c -o chunkParser.o -c -lm $(CFLAGS)
hTable.o: src/lib/hTable.c
gcc src/lib/hTable.c -o hTable.o -c $(CFLAGS)
model.o: src/lib/model.c
gcc src/lib/model.c -o model.o -c $(CFLAGS)
regionFileReader: regionParser.o mcErrno.o src/regionFileReader.c
gcc src/regionFileReader.c regionParser.o mcErrno.o -o regionFileReader $(ZLIB) -lm $(CFLAGS)
chunkExtractor: regionParser.o mcErrno.o src/chunkExtractor.c
gcc src/chunkExtractor.c regionParser.o mcErrno.o -o chunkExtractor $(ZLIB) -lm $(CFLAGS)
generator.o: src/lib/generator.c
gcc src/lib/generator.c -o generator.o -c $(CFLAGS)
modelGenerator: model.o generator.o hTable.o mcErrno.o chunkParser.o cNBT.o src/modelGenerator.c
gcc src/modelGenerator.c generator.o model.o mcErrno.o hTable.o chunkParser.o cNBT.o -o modelGenerator -lm $(CFLAGS)
radiusGenerator: model.o generator.o hTable.o mcErrno.o chunkParser.o regionParser.o cNBT.o src/radiusGenerator.c
gcc src/radiusGenerator.c generator.o model.o mcErrno.o regionParser.o hTable.o chunkParser.o cNBT.o $(ZLIB) -lm -o radiusGenerator $(CFLAGS)
blockPrint: src/blockPrint.c chunkParser.o mcErrno.o cNBT.o hTable.o
gcc src/blockPrint.c chunkParser.o cNBT.o mcErrno.o hTable.o -o blockPrint -lm $(CFLAGS)
cNBT.ow:
x86_64-w64-mingw32-gcc-win32 cNBT/buffer.c -o cNBT/buffer.ow -c $(CFLAGS)
x86_64-w64-mingw32-gcc-win32 cNBT/nbt_parsing.c -o cNBT/nbt_parsing.ow -c $(CFLAGS)
x86_64-w64-mingw32-gcc-win32 cNBT/nbt_treeops.c -o cNBT/nbt_treeops.ow -c $(CFLAGS)
x86_64-w64-mingw32-gcc-win32 cNBT/nbt_util.c -o cNBT/nbt_util.ow -c $(CFLAGS)
x86_64-w64-mingw32-ld -relocatable cNBT/buffer.ow cNBT/nbt_parsing.ow cNBT/nbt_treeops.ow cNBT/nbt_util.ow -o cNBT.ow
regionParser.ow: src/lib/regionParser.c
x86_64-w64-mingw32-gcc-win32 src/lib/regionParser.c -o regionParser.ow -c $(CFLAGS)
chunkParser.ow: src/lib/chunkParser.c
x86_64-w64-mingw32-gcc-win32 src/lib/chunkParser.c -o chunkParser.ow -c -lm $(CFLAGS)
hTable.ow: src/lib/hTable.c
x86_64-w64-mingw32-gcc-win32 src/lib/hTable.c -o hTable.ow -c $(CFLAGS)
model.ow: src/lib/model.c
x86_64-w64-mingw32-gcc-win32 src/lib/model.c -o model.ow -c $(CFLAGS)
regionFileReader.exe: regionParser.ow src/regionFileReader.c
x86_64-w64-mingw32-gcc-win32 src/regionFileReader.c regionParser.ow -o regionFileReader.exe -lz -static $(CFLAGS)
chunkExtractor.exe: regionParser.ow src/chunkExtractor.c
x86_64-w64-mingw32-gcc-win32 src/chunkExtractor.c regionParser.ow -o chunkExtractor.exe -lz -static $(CFLAGS)
generator.ow: src/lib/generator.c
x86_64-w64-mingw32-gcc-win32 src/lib/generator.c -o generator.ow -c $(CFLAGS)
modelGenerator.exe: generator.ow model.ow chunkParser.ow hTable.ow cNBT.ow src/modelGenerator.c
x86_64-w64-mingw32-gcc-win32 src/modelGenerator.c generator.ow model.ow chunkParser.ow hTable.ow cNBT.ow -o modelGenerator.exe -lm $(CFLAGS)
radiusGenerator.exe: model.ow generator.ow hTable.ow chunkParser.ow regionParser.ow cNBT.ow src/radiusGenerator.c
x86_64-w64-mingw32-gcc-win32 src/radiusGenerator.c generator.ow model.ow regionParser.ow hTable.ow chunkParser.ow cNBT.ow -lm -static -lz -o radiusGenerator.exe $(CFLAGS)
windows: modelGenerator.exe chunkExtractor.exe regionFileReader.exe radiusGenerator.exe
clean:
rm -f *.o
rm -f cNBT/*.o
rm -f *.ow
rm -f cNBT/*.ow
rm -f radiusGenerator
rm -f radiusGenerator.exe
rm -f modelGenerator
rm -f modelGenerator.exe
rm -f chunkExtractor
rm -f chunkExtractor.exe
rm -f regionFileReader
rm -f regionFileReader.exe
rm -rf doc/build
rm -f blockPrint
rm -f blockPrint.exe
check: hTable.o regionParser.o chunkParser.o cNBT.o model.o mcErrno.o
#hTable tests
checkmk tests/hTable.check > tests/hTableCheck.c
gcc tests/hTableCheck.c hTable.o mcErrno.o -lcheck -g -lm $(SUBUNIT) -Wall -o tests/hTableCheck
./tests/hTableCheck
#regionParser tests
checkmk tests/regionParser.check > tests/regionParserCheck.c
gcc tests/regionParserCheck.c regionParser.o mcErrno.o -lcheck -g -lm $(ZLIB) $(SUBUNIT) -o tests/regionParserCheck
./tests/regionParserCheck
#chunkParser tests
checkmk tests/chunkParser.check > tests/chunkParserCheck.c
gcc tests/chunkParserCheck.c chunkParser.o cNBT.o mcErrno.o -lcheck -g -lm $(SUBUNIT) -o tests/chunkParserCheck
./tests/chunkParserCheck
#model tests
checkmk tests/model.check > tests/modelCheck.c
gcc tests/modelCheck.c model.o hTable.o mcErrno.o -lcheck -g -lm $(SUBUNIT) -o tests/modelCheck
./tests/modelCheck
#wavefront tests - doesn't work on windows because os bs
#checkmk tests/wavefront.check > tests/wavefrontCheck.c
#gcc tests/wavefrontCheck.c model.o hTable.o mcErrno.o -lcheck -g -lm $(SUBUNIT) -o tests/wavefrontCheck
#./tests/wavefrontCheck
doc: doc/build/html
doc/build/html: src/lib/*.h src/*.c src/lib/*.c doc/Doxyfile.conf src/dir.dox doc/pages/*
doxygen ./doc/Doxyfile.conf