Mercurial > hg > dmlib
annotate Makefile.gen @ 59:c560703e85ed
Add resource writing functions (only work for stdio backend)
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 07:51:08 +0300 |
parents | 36e2f910219c |
children | f28cd66356f6 |
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 | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
113 ifeq ($(JSS_MIX_FP),yes) |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
114 DM_CFLAGS+=-DJSS_MIX_FP |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
115 endif |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
116 |
0 | 117 ifeq ($(JSS_SUP_THREADS),yes) |
118 DM_CFLAGS+=-DJSS_SUP_THREADS | |
119 endif | |
120 | |
121 | |
122 SUP_MODLOAD=no | |
123 ifeq ($(JSS_SUP_XM),yes) | |
124 SUP_MODLOAD=yes | |
125 DMLIB_OBJS+= jloadxm.o | |
126 DM_CFLAGS+=-DJSS_SUP_XM | |
127 endif | |
128 | |
129 ifeq ($(JSS_SUP_JSSMOD),yes) | |
130 SUP_MODLOAD=yes | |
131 DMLIB_OBJS+= jloadjss.o | |
132 DM_CFLAGS+=-DJSS_SUP_JSSMOD $(JSSMOD_FLAGS) | |
133 endif | |
134 | |
135 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
|
136 TARGETS += $(DMLIB)jmix_c.c |
0 | 137 DMLIB_OBJS+=jmix_c.o |
138 endif | |
139 | |
140 #ifeq ($(DM_USE_SIMD),yes) | |
141 #DMLIB_OBJS+=jmix_simd.o | |
142 #endif | |
143 | |
144 | |
145 ### Dependancies | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
146 ifeq ($(DM_BUILD_TOOLS),yes) |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
147 ifeq ($(DMRES_STDIO),yes) |
0 | 148 ifeq ($(SUP_MODLOAD),yes) |
149 BINARIES+= viewmod mod2wav testpl | |
150 endif | |
151 | |
152 ifeq ($(JSS_SUP_JSSMOD),yes) | |
153 ifeq ($(JSS_SUP_XM),yes) | |
154 BINARIES+= xm2jss | |
155 endif | |
156 endif | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
157 endif |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
158 endif |
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
159 |
0 | 160 |
28
920fb22cffcf
Fix build process for jmix_c.c dependancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
161 DMLIB_OBJS += jss.o jssmix.o jssmod.o jssplr.o |
920fb22cffcf
Fix build process for jmix_c.c dependancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
162 |
0 | 163 endif |
164 | |
165 ### | |
166 ### Rest of the rules | |
167 ### | |
168 CFLAGS += -g -W -Wall -DHAVE_STRING_H -O3 $(EXTRA_CFLAGS) | |
169 CXXFLAGS=$(CFLAGS) | |
170 | |
171 DM_CFLAGS += $(SDL_CFLAGS) | |
172 DM_LDFLAGS += $(LDFLAGS) $(SDL_LDFLAGS) | |
173 | |
174 | |
175 DMLIB_A=$(OBJPATH)dmlib.a | |
176 DMLIB_OBJS += dmfile.o dmlib.o dmlerp.o dmstring.o \ | |
59
c560703e85ed
Add resource writing functions (only work for stdio backend)
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
177 dmargs.o dmvecmat.o dmperlin.o dmimage.o \ |
c560703e85ed
Add resource writing functions (only work for stdio backend)
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
178 dmres.o dmresw.o dmsimple.o |
0 | 179 |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
180 ifeq ($(DM_BUILD_TESTS),yes) |
0 | 181 BINARIES += vecmattest fptest |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
182 endif |
0 | 183 |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
184 TARGETS += $(DMLIB_A) $(addprefix $(BINPATH),$(addsuffix $(EXEEXT),$(BINARIES))) |
0 | 185 |
186 all: $(TARGETS) | |
187 | |
188 ### | |
189 ### Generic rules | |
190 ### | |
191 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
192 $(OBJPATH)%.o: $(DMLIB)%.c $(DMLIB)%.h |
0 | 193 @echo " CC $<" |
194 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
195 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
196 $(OBJPATH)%.o: $(DMLIB)%.c |
0 | 197 @echo " CC $<" |
198 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
199 | |
3 | 200 $(OBJPATH)%.o: %.c %.h |
201 @echo " CC $<" | |
202 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
203 | |
204 $(OBJPATH)%.o: %.c | |
205 @echo " CC $<" | |
206 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
207 | |
0 | 208 |
209 ### | |
210 ### dmlib rules | |
211 ### | |
212 | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
213 $(DMLIB)jmix_c.c: $(DMLIB)jmix_c_in.c $(DMLIB)jmixtmpl_c.h $(DMLIB)jmix_post_c.h |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
214 (echo "#include \"jssmix.h\"" && cpp $< $(DM_CFLAGS)) | sed "s/^# .*//g" > $@ |
34
7908061da010
Fix building of JSS mixer parts.
Matti Hamalainen <ccr@tnsp.org>
parents:
32
diff
changeset
|
215 |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
216 $(OBJPATH)dmimage.o: $(DMLIB)dmimage.c $(DMLIB)stb_image.c |
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)dmblit.o: $(DMLIB)dmblit.c $(DMLIB)dmscaledblit.h $(DMLIB)dmblitfunc.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)dmline.o: $(DMLIB)dmline.c $(DMLIB)dmdrawline.h $(DMLIB)dmlinefunc.h |
0 | 225 @echo " CC $+" |
226 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
227 | |
1
6e169d87d963
Improve buildsystem to support more flexible builds.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
228 $(OBJPATH)dmargs.o: $(DMLIB)dmargs.c $(DMLIB)dmargs.h $(DMLIB)dmargs_int.c |
0 | 229 @echo " CC $+" |
230 @$(CC) $(CFLAGS) -c -o $@ $< $(DM_CFLAGS) | |
231 | |
232 | |
2
9a8355b47e1c
Various improvements in the build system to add granularity
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
233 $(DMLIB_A): $(addprefix $(OBJPATH),$(DMLIB_OBJS)) $(DMLIB)Makefile.gen config.mak |
0 | 234 @echo " AR $@ $(addprefix $(OBJPATH),$(DMLIB_OBJS))" |
235 @$(AR) cru $@ $+ $(addprefix $(OBJPATH),$(DMLIB_OBJS)) | |
236 @$(RANLIB) $@ | |
237 | |
28
920fb22cffcf
Fix build process for jmix_c.c dependancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
238 |
0 | 239 |
240 ### | |
241 ### Tests and binaries | |
242 ### | |
3 | 243 $(BINPATH)%$(EXEEXT): $(OBJPATH)%.o $(DMLIB_A) |
244 @echo " LINK $+" | |
245 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
246 | |
0 | 247 $(BINPATH)vview$(EXEEXT): $(OBJPATH)vview.o $(DMLIB_A) |
248 @echo " LINK $+" | |
249 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf | |
250 | |
251 $(BINPATH)blittest$(EXEEXT): $(OBJPATH)blittest.o $(DMLIB_A) | |
252 @echo " LINK $+" | |
253 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf | |
254 | |
255 $(BINPATH)efu$(EXEEXT): $(OBJPATH)efu.o $(DMLIB_A) | |
256 @echo " LINK $+" | |
7
d427763f113a
Fix "efu" test, use dmImage instead of SDL_image.
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
257 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf |
0 | 258 |
259 $(BINPATH)vptest$(EXEEXT): $(OBJPATH)vptest.o $(DMLIB_A) | |
260 @echo " LINK $+" | |
261 @$(CC) -o $@ $+ $(DM_LDFLAGS) -lSDL_ttf | |
262 | |
263 $(BINPATH)%test$(EXEEXT): $(OBJPATH)%test.o $(DMLIB_A) | |
264 @echo " LINK $+" | |
265 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
266 | |
267 $(BINPATH)packed$(EXEEXT): $(OBJPATH)packed.o $(DMLIB_A) | |
268 @echo " LINK $+" | |
269 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
270 | |
271 $(BINPATH)mod2wav$(EXEEXT): $(OBJPATH)mod2wav.o $(DMLIB_A) | |
272 @echo " LINK $+" | |
273 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
274 | |
275 $(BINPATH)xm2jss$(EXEEXT): $(OBJPATH)xm2jss.o $(DMLIB_A) | |
276 @echo " LINK $+" | |
277 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
278 | |
279 $(BINPATH)viewmod$(EXEEXT): $(OBJPATH)viewmod.o $(DMLIB_A) | |
280 @echo " LINK $+" | |
281 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
282 | |
283 $(BINPATH)testpl$(EXEEXT): $(OBJPATH)testpl.o $(DMLIB_A) | |
284 @echo " LINK $+" | |
285 @$(CC) -o $@ $+ $(DM_LDFLAGS) | |
286 | |
287 | |
288 ### | |
289 ### Special targets | |
290 ### | |
291 clean: | |
292 $(RM) $(TARGETS) $(OBJPATH)*.o | |
293 |