Mercurial > hg > dmlib
annotate Makefile.gen @ 7:d427763f113a
Fix "efu" test, use dmImage instead of SDL_image.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 28 Sep 2012 04:37:57 +0300 |
parents | 82fc316e70d0 |
children | 920fb22cffcf |
rev | line source |
---|---|
0 | 1 ### |
2 ### Get settings from config.mak | |
3 ### | |
4 include config.mak | |
5 | |
6 ifeq ($(EXTRA_CFLAGS),) | |
7 EXTRA_CFLAGS=-march=core2 | |
8 endif | |
9 | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
10 ifneq ($(DMLIB),) |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
11 DM_CFLAGS += -I$(DMLIB) |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
12 endif |
0 | 13 |
14 ### | |
15 ### Form additional compilation defines based on settings | |
16 ### | |
17 | |
18 # If C routines are not explicitly disabled, we enable them | |
19 ifeq ($(DM_USE_C),) | |
20 DM_USE_C=yes | |
21 endif | |
22 | |
23 ifeq ($(DM_USE_C),yes) | |
24 DM_CFLAGS+=-DDM_USE_C | |
25 endif | |
26 | |
27 # Enable SIMD routines, if requested | |
28 ifeq ($(DM_USE_SIMD),yes) | |
29 DM_CFLAGS+=-DDM_USE_SIMD | |
30 endif | |
31 | |
32 | |
33 ### | |
34 ### Filesystem | |
35 ### | |
36 ifeq ($(DMRES_PACKFS),yes) | |
37 DM_CFLAGS += -DDMRES_PACKFS | |
38 DMLIB_OBJS += dmpack.o dmpackutil.o | |
39 DM_LDFLAGS += -lz | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
40 ifeq ($(DM_BUILD_TOOLS),yes) |
0 | 41 BINARIES += packed |
42 endif | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
43 endif |
0 | 44 |
45 ifeq ($(DMRES_STDIO),yes) | |
46 DM_CFLAGS += -DDMRES_STDIO | |
47 endif | |
48 | |
49 | |
50 ### | |
51 ### Graphics support | |
52 ### | |
53 | |
54 ifeq ($(DM_GFX_MISC),yes) | |
55 DM_CFLAGS += -DDM_GFX_MISC | |
56 DMLIB_OBJS += dmgfx.o | |
57 endif | |
58 | |
59 ifeq ($(DM_GFX_LINES),yes) | |
60 DM_CFLAGS += -DDM_GFX_LINES | |
61 DMLIB_OBJS += dmline.o | |
62 endif | |
63 | |
64 ifeq ($(DM_GFX_BLITS),yes) | |
65 DM_CFLAGS += -DDM_GFX_BLITS | |
66 DMLIB_OBJS += dmblit.o | |
67 endif | |
68 | |
69 ifeq ($(DM_GFX_TTF_TEXT),yes) | |
70 DM_CFLAGS += -DDM_GFX_TTF_TEXT | |
71 DMLIB_OBJS += dmtext.o | |
72 | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
73 ifeq ($(DM_BUILD_TESTS),yes) |
0 | 74 ifeq ($(DM_GFX_BLITS),yes) |
75 BINARIES += blittest vview vptest efu | |
76 endif | |
77 endif | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
78 endif |
0 | 79 |
80 ifeq ($(DM_GFX_8BIT),yes) | |
81 DM_CFLAGS += -DDM_GFX_8BIT | |
82 endif | |
83 | |
84 ifeq ($(DM_GFX_15BIT),yes) | |
85 DM_CFLAGS += -DDM_GFX_15BIT | |
86 endif | |
87 | |
88 ifeq ($(DM_GFX_16BIT),yes) | |
89 DM_CFLAGS += -DDM_GFX_15BIT | |
90 endif | |
91 | |
92 ifeq ($(DM_GFX_32BIT),yes) | |
93 DM_CFLAGS += -DDM_GFX_15BIT | |
94 endif | |
95 | |
96 | |
97 ### | |
98 ### miniJSS | |
99 ### | |
100 ifeq ($(JSS),yes) | |
101 | |
102 ifeq ($(JSS_LIGHT),yes) | |
103 DM_CFLAGS+=-DJSS_LIGHT -Os | |
104 else | |
105 ifeq ($(JSS_USE_ASSERTS),yes) | |
106 DM_CFLAGS+=-DJSS_USE_ASSERTS | |
107 endif | |
108 ifeq ($(JSS_DEBUG),yes) | |
109 DM_CFLAGS+=-DJSS_DEBUG | |
110 endif | |
111 endif | |
112 | |
113 ifeq ($(JSS_SUP_THREADS),yes) | |
114 DM_CFLAGS+=-DJSS_SUP_THREADS | |
115 endif | |
116 | |
117 DMLIB_OBJS += jss.o jssmix.o jssmod.o jssplr.o | |
118 | |
119 SUP_MODLOAD=no | |
120 ifeq ($(JSS_SUP_XM),yes) | |
121 SUP_MODLOAD=yes | |
122 DMLIB_OBJS+= jloadxm.o | |
123 DM_CFLAGS+=-DJSS_SUP_XM | |
124 endif | |
125 | |
126 ifeq ($(JSS_SUP_JSSMOD),yes) | |
127 SUP_MODLOAD=yes | |
128 DMLIB_OBJS+= jloadjss.o | |
129 DM_CFLAGS+=-DJSS_SUP_JSSMOD $(JSSMOD_FLAGS) | |
130 endif | |
131 | |
132 ifeq ($(DM_USE_C),yes) | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
133 TARGETS += $(DMLIB)jmix_c.c |
0 | 134 DMLIB_OBJS+=jmix_c.o |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
135 |
0 | 136 endif |
137 | |
138 #ifeq ($(DM_USE_SIMD),yes) | |
139 #DMLIB_OBJS+=jmix_simd.o | |
140 #endif | |
141 | |
142 | |
143 ### Dependancies | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
144 ifeq ($(DM_BUILD_TOOLS),yes) |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
145 ifeq ($(DMRES_STDIO),yes) |
0 | 146 ifeq ($(SUP_MODLOAD),yes) |
147 BINARIES+= viewmod mod2wav testpl | |
148 endif | |
149 | |
150 ifeq ($(JSS_SUP_JSSMOD),yes) | |
151 ifeq ($(JSS_SUP_XM),yes) | |
152 BINARIES+= xm2jss | |
153 endif | |
154 endif | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
155 endif |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
156 endif |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
157 |
0 | 158 |
159 endif | |
160 | |
161 ### | |
162 ### Rest of the rules | |
163 ### | |
164 CFLAGS += -g -W -Wall -DHAVE_STRING_H -O3 $(EXTRA_CFLAGS) | |
165 CXXFLAGS=$(CFLAGS) | |
166 | |
167 DM_CFLAGS += $(SDL_CFLAGS) | |
168 DM_LDFLAGS += $(LDFLAGS) $(SDL_LDFLAGS) | |
169 | |
170 | |
171 DMLIB_A=$(OBJPATH)dmlib.a | |
172 DMLIB_OBJS += dmfile.o dmlib.o dmlerp.o dmstring.o \ | |
173 dmargs.o dmvecmat.o dmperlin.o dmimage.o dmres.o | |
174 | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
175 ifeq ($(DM_BUILD_TESTS),yes) |
0 | 176 BINARIES += vecmattest fptest |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
177 endif |
0 | 178 |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
179 TARGETS += $(DMLIB_A) $(addprefix $(BINPATH),$(addsuffix $(EXEEXT),$(BINARIES))) |
0 | 180 |
181 all: $(TARGETS) | |
182 | |
183 ### | |
184 ### Generic rules | |
185 ### | |
186 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
187 $(OBJPATH)%.o: $(DMLIB)%.c $(DMLIB)%.h |
0 | 188 @echo " CC $<" |
189 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
190 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
191 $(OBJPATH)%.o: $(DMLIB)%.c |
0 | 192 @echo " CC $<" |
193 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
194 | |
3 | 195 $(OBJPATH)%.o: %.c %.h |
196 @echo " CC $<" | |
197 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
198 | |
199 $(OBJPATH)%.o: %.c | |
200 @echo " CC $<" | |
201 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
202 | |
0 | 203 |
204 ### | |
205 ### dmlib rules | |
206 ### | |
207 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
208 $(DMLIB)jmix_c.c: $(DMLIB)jmix_c.in.c $(DMLIB)jmix_c.h $(DMLIB)jmix_post.h |
0 | 209 (echo "#include \"jssmix.h\"" && cpp $<) | sed "s/^# .*//g" > $@ |
210 | |
211 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
212 $(OBJPATH)dmimage.o: $(DMLIB)dmimage.c $(DMLIB)stb_image.c |
0 | 213 @echo " CC $+" |
214 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
215 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
216 $(OBJPATH)dmblit.o: $(DMLIB)dmblit.c $(DMLIB)dmscaledblit.h $(DMLIB)dmblitfunc.h |
0 | 217 @echo " CC $+" |
218 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
219 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
220 $(OBJPATH)dmline.o: $(DMLIB)dmline.c $(DMLIB)dmdrawline.h $(DMLIB)dmlinefunc.h |
0 | 221 @echo " CC $+" |
222 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
223 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
224 $(OBJPATH)dmargs.o: $(DMLIB)dmargs.c $(DMLIB)dmargs.h $(DMLIB)dmargs_int.c |
0 | 225 @echo " CC $+" |
226 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
227 | |
228 | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
229 $(DMLIB_A): $(addprefix $(OBJPATH),$(DMLIB_OBJS)) $(DMLIB)Makefile.gen config.mak |
0 | 230 @echo " AR $@ $(addprefix $(OBJPATH),$(DMLIB_OBJS))" |
231 @$(AR) cru $@ $+ $(addprefix $(OBJPATH),$(DMLIB_OBJS)) | |
232 @$(RANLIB) $@ | |
233 | |
234 | |
235 ### | |
236 ### Tests and binaries | |
237 ### | |
3 | 238 $(BINPATH)%$(EXEEXT): $(OBJPATH)%.o $(DMLIB_A) |
239 @echo " LINK $+" | |
240 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
241 | |
0 | 242 $(BINPATH)vview$(EXEEXT): $(OBJPATH)vview.o $(DMLIB_A) |
243 @echo " LINK $+" | |
244 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf | |
245 | |
246 $(BINPATH)blittest$(EXEEXT): $(OBJPATH)blittest.o $(DMLIB_A) | |
247 @echo " LINK $+" | |
248 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf | |
249 | |
250 $(BINPATH)efu$(EXEEXT): $(OBJPATH)efu.o $(DMLIB_A) | |
251 @echo " LINK $+" | |
7
d427763f113a
Fix "efu" test, use dmImage instead of SDL_image.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
252 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf |
0 | 253 |
254 $(BINPATH)vptest$(EXEEXT): $(OBJPATH)vptest.o $(DMLIB_A) | |
255 @echo " LINK $+" | |
256 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf | |
257 | |
258 $(BINPATH)%test$(EXEEXT): $(OBJPATH)%test.o $(DMLIB_A) | |
259 @echo " LINK $+" | |
260 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
261 | |
262 $(BINPATH)packed$(EXEEXT): $(OBJPATH)packed.o $(DMLIB_A) | |
263 @echo " LINK $+" | |
264 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
265 | |
266 $(BINPATH)mod2wav$(EXEEXT): $(OBJPATH)mod2wav.o $(DMLIB_A) | |
267 @echo " LINK $+" | |
268 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
269 | |
270 $(BINPATH)xm2jss$(EXEEXT): $(OBJPATH)xm2jss.o $(DMLIB_A) | |
271 @echo " LINK $+" | |
272 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
273 | |
274 $(BINPATH)viewmod$(EXEEXT): $(OBJPATH)viewmod.o $(DMLIB_A) | |
275 @echo " LINK $+" | |
276 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
277 | |
278 $(BINPATH)testpl$(EXEEXT): $(OBJPATH)testpl.o $(DMLIB_A) | |
279 @echo " LINK $+" | |
280 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
281 | |
282 | |
283 ### | |
284 ### Special targets | |
285 ### | |
286 clean: | |
287 $(RM) $(TARGETS) $(OBJPATH)*.o | |
288 |