2 # Higanbana Project makefile
5 # Possible optimizations for 8088 class processors
7 # -oa Relax alias checking
8 # -ob Try to generate straight line code
9 # -oe - expand user functions inline (-oe=20 is default, adds lots of code)
10 # -oh Enable repeated optimizations
11 # -oi generate certain lib funcs inline
12 # -oi+ Set max inline depth (C++ only, use -oi for C)
13 # -ok Flowing of register save into function flow graph
14 # -ol loop optimizations
15 # -ol+ loop optimizations plus unrolling
16 # -or Reorder for pipelined (486+ procs); not sure if good to use
17 # -os Favor space over time
18 # -ot Favor time over space
19 # -ei Allocate an "int" for all enum types
20 # -zp2 Allow compiler to add padding to structs
21 # -zpw Use with above; make sure you are warning free!
22 # -0 8088/8086 class code generation
23 # -s disable stack overflow checking
25 # -zk0u translate kanji to unicode... wwww
27 # -zkl current codepage
44 #IN=..$(DIRSEP)..$(DIRSEP)fdos$(DIRSEP)watcom2$(DIRSEP)h
50 #EXMMTESTDIR=16$(DIRSEP)exmmtest$(DIRSEP)
53 SRCLIB=$(SRC)lib$(DIRSEP)
54 JSMNLIB=$(SRCLIB)jsmn$(DIRSEP)
55 NYANLIB=$(SRCLIB)nyan$(DIRSEP)
56 #EXMMLIB=$(SRCLIB)exmm$(DIRSEP)
57 MODEXLIB=$(SRCLIB)modex16$(DIRSEP)
58 MODEXLIB_=$(SRCLIB)modex$(DIRSEP)
59 VGMSNDLIB=$(SRCLIB)vgmsnd$(DIRSEP)
60 DOSLIB=$(SRCLIB)doslib$(DIRSEP)
61 WCPULIB=$(SRCLIB)wcpu$(DIRSEP)
69 BAKAPIFLAGS=-fh=bakapi.hed
70 SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k55808#60000#32768
71 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS)
72 ZFLAGS=-zk0 -zc -zp8 $(WCLQ) ## -zm
73 CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo##wwww
74 OFLAGS=-obmiler -out -oh -ei -zp8 -fpi87 -onac -ol+ -ok####x
75 FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS)
78 DOSLIBEXMMOBJ = himemsys.$(OBJ) emm.$(OBJ)
79 VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
80 DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
81 16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ)
83 GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ)
85 TESTEXEC = exmmtest.exe test.exe pcxtest.exe pcxtest2.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe planrpcx.exe
87 #testemm.exe testemm0.exe fonttes0.exe miditest.exe sega.exe sountest.exe
88 EXEC = 16.exe bakapi.exe $(TESTEXEC) tesuto.exe
92 #$(16LIBOBJS) => 16.lib bug....
95 #game and bakapi executables
97 16.exe: 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib
98 wcl $(FLAGS) $(16FLAGS) 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=16.map
100 bakapi.exe: bakapi.$(OBJ) gfx.lib modex.lib
101 wcl $(FLAGS) $(BAKAPIFLAGS) bakapi.$(OBJ) gfx.lib modex.lib -fm=bakapi.map
105 scroll.exe: scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib
106 wcl $(FLAGS) scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=scroll.map
107 scroll.$(OBJ): $(SRC)scroll.c
108 wcl $(FLAGS) -c $(SRC)scroll.c
110 tesuto.exe: tesuto.$(OBJ)
111 wcl $(WCLQ) -mh -d2 tesuto.$(OBJ)
112 tesuto.$(OBJ): $(SRC)tesuto.c
113 wcl $(WCLQ) -mh -d2 -c $(SRC)tesuto.c
115 #sega.exe: sega.$(OBJ)
116 # wcl $(FLAGS) sega.$(OBJ)
117 #sega.$(OBJ): $(SRC)sega.c
118 # wcl $(FLAGS) -c $(SRC)sega.c
120 test.exe: test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ)
121 wcl $(FLAGS) test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) -fm=test.map
123 test2.exe: test2.$(OBJ) gfx.lib
124 wcl $(FLAGS) test2.$(OBJ) gfx.lib -fm=test2.map
126 fonttest.exe: fonttest.$(OBJ) $(16LIBOBJS) gfx.lib
127 wcl $(FLAGS) fonttest.$(OBJ) $(16LIBOBJS) gfx.lib -fm=fonttest.map
129 #fonttes0.exe: fonttes0.$(OBJ) $(16LIBOBJS)
130 # wcl $(FLAGS) fonttes0.$(OBJ) $(16LIBOBJS)
132 fontgfx.exe: fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib
133 wcl $(FLAGS) fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib -fm=fontgfx.map
135 inputest.exe: inputest.$(OBJ) $(16LIBOBJS)
136 wcl $(FLAGS) inputest.$(OBJ) $(16LIBOBJS) -fm=inputest.map
138 #sountest.exe: sountest.$(OBJ) $(16LIBOBJS)
139 # wcl $(FLAGS) sountest.$(OBJ) $(16LIBOBJS)
141 #miditest.exe: miditest.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) midi.$(OBJ)
142 # wcl $(FLAGS) miditest.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) midi.$(OBJ)
144 tsthimem.exe: tsthimem.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
145 wcl $(FLAGS) tsthimem.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) -fm=tsthimem.map
147 #testemm.exe: testemm.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
148 # wcl $(FLAGS) testemm.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
150 #testemm0.exe: testemm0.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
151 # wcl $(FLAGS) testemm0.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
153 pcxtest.exe: pcxtest.$(OBJ) gfx.lib
154 wcl $(FLAGS) pcxtest.$(OBJ) gfx.lib -fm=pcxtest.map
156 palettec.exe: palettec.$(OBJ) gfx.lib #$(16LIBOBJS)
157 wcl $(FLAGS) palettec.$(OBJ) gfx.lib -fm=palettec.map #$(16LIBOBJS)
159 palettel.exe: palettel.$(OBJ) gfx.lib #$(16LIBOBJS)
160 wcl $(FLAGS) palettel.$(OBJ) gfx.lib -fm=palettel.map #$(16LIBOBJS)
162 pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib
163 wcl $(FLAGS) pcxtest2.$(OBJ) gfx.lib -fm=pcxtest2.map
165 planrpcx.exe: planrpcx.$(OBJ) gfx.lib
166 wcl $(FLAGS) planrpcx.$(OBJ) gfx.lib -fm=planrpcx.map
168 maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib
169 wcl $(FLAGS) maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=maptest.map
171 #maptest0.exe: maptest0.$(OBJ) fmapread.$(OBJ) farjsmn.$(OBJ)
172 # wcl $(FLAGS) $(MFLAGS) maptest0.$(OBJ) fmapread.$(OBJ) farjsmn.$(OBJ)
174 #emmtest.exe: emmtest.$(OBJ) memory.$(OBJ)
175 # wcl $(FLAGS) $(MFLAGS) emmtest.$(OBJ) memory.$(OBJ)
177 #emsdump.exe: emsdump.$(OBJ) memory.$(OBJ)
178 # wcl $(FLAGS) $(MFLAGS) emsdump.$(OBJ) memory.$(OBJ)
180 fmemtest.exe: fmemtest.$(OBJ) $(16LIBOBJS)
181 wcl $(FLAGS) fmemtest.$(OBJ) $(16LIBOBJS) -fm=fmemtest.map
183 exmmtest.exe: exmmtest.$(OBJ) $(16LIBOBJS)
184 wcl $(FLAGS) exmmtest.$(OBJ) -fm=exmmtest.map $(16LIBOBJS)
186 vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIBOBJS)
187 wcl $(FLAGS) vgmtest.$(OBJ) vgmsnd.lib -fm=vgmtest.map $(16LIBOBJS)
188 #====wcl -mc vgmtest.$(OBJ) $(VGMSNDOBJ) -fm=vgmtest.map
192 #executable's objects
194 16.$(OBJ): $(SRC)16.h $(SRC)16.c
195 wcl $(FLAGS) -c $(SRC)16.c
197 bakapi.$(OBJ): $(SRC)bakapi.h $(SRC)bakapi.c
198 wcl $(FLAGS) -c $(SRC)bakapi.c
200 test.$(OBJ): $(SRC)test.c $(SRCLIB)modex16.h
201 wcl $(FLAGS) -c $(SRC)test.c
203 test2.$(OBJ): $(SRC)test2.c $(SRCLIB)modex16.h
204 wcl $(FLAGS) -c $(SRC)test2.c
206 pcxtest.$(OBJ): $(SRC)pcxtest.c $(SRCLIB)modex16.h
207 wcl $(FLAGS) -c $(SRC)pcxtest.c
209 planrpcx.$(OBJ): $(SRC)planrpcx.c $(SRCLIB)modex16.h
210 wcl $(FLAGS) -c $(SRC)planrpcx.c
212 pcxtest2.$(OBJ): $(SRC)pcxtest2.c $(SRCLIB)modex16.h
213 wcl $(FLAGS) -c $(SRC)pcxtest2.c
215 palettec.$(OBJ): $(SRC)palettec.c
216 wcl $(FLAGS) -c $(SRC)palettec.c
218 palettel.$(OBJ): $(SRC)palettel.c
219 wcl $(FLAGS) -c $(SRC)palettel.c
221 maptest.$(OBJ): $(SRC)maptest.c $(SRCLIB)modex16.h
222 wcl $(FLAGS) -c $(SRC)maptest.c
224 #maptest0.$(OBJ): $(SRC)maptest0.c# $(SRCLIB)modex16.h
225 # wcl $(FLAGS) $(MFLAGS) -c $(SRC)maptest0.c
227 #emmtest.$(OBJ): $(SRC)emmtest.c
228 # wcl $(FLAGS) $(MFLAGS) -c $(SRC)emmtest.c
230 #emsdump.$(OBJ): $(SRC)emsdump.c
231 # wcl $(FLAGS) $(MFLAGS) -c $(SRC)emsdump.c
233 fmemtest.$(OBJ): $(SRC)fmemtest.c
234 wcl $(FLAGS) -c $(SRC)fmemtest.c
236 fonttest.$(OBJ): $(SRC)fonttest.c
237 wcl $(FLAGS) -c $(SRC)fonttest.c
239 #fonttes0.$(OBJ): $(SRC)fonttes0.c
240 # wcl $(FLAGS) -c $(SRC)fonttes0.c
242 fontgfx.$(OBJ): $(SRC)fontgfx.c
243 wcl $(FLAGS) -c $(SRC)fontgfx.c
245 inputest.$(OBJ): $(SRC)inputest.c
246 wcl $(FLAGS) -c $(SRC)inputest.c
248 #sountest.$(OBJ): $(SRC)sountest.c
249 # wcl $(FLAGS) -c $(SRC)sountest.c
251 #miditest.$(OBJ): $(SRC)miditest.c
252 # wcl $(FLAGS) -c $(SRC)miditest.c
254 #testemm.$(OBJ): $(SRC)testemm.c
255 # wcl $(FLAGS) -c $(SRC)testemm.c
257 #testemm0.$(OBJ): $(SRC)testemm0.c
258 # wcl $(FLAGS) -c $(SRC)testemm0.c
260 tsthimem.$(OBJ): $(SRC)tsthimem.c
261 wcl $(FLAGS) -c $(SRC)tsthimem.c
263 exmmtest.$(OBJ): $(SRC)exmmtest.c
264 wcl $(FLAGS) -c $(SRC)exmmtest.c
266 vgmtest.$(OBJ): $(SRC)vgmtest.c
267 wcl $(FLAGS) -c $(SRC)vgmtest.c
268 #====wcl -mc -c $(SRC)vgmtest.c
271 #non executable objects libraries
273 16.lib: $(16LIBOBJS)# doslib.lib vgmsnd.lib
274 wlib -b $(WLIBQ) 16.lib $(16LIBOBJS)# doslib.lib vgmsnd.lib
276 gfx.lib: $(GFXLIBOBJS)
277 wlib -b $(WLIBQ) gfx.lib $(GFXLIBOBJS)
279 doslib.lib: $(DOSLIBOBJ) # $(SRCLIB)cpu.lib
280 wlib -b $(WLIBQ) doslib.lib $(DOSLIBOBJ) # $(SRCLIB)cpu.lib
282 vgmsnd.lib: $(VGMSNDOBJ)
283 wlib -b $(WLIBQ) vgmsnd.lib $(VGMSNDOBJ)
285 modex16.$(OBJ): $(SRCLIB)modex16.h $(SRCLIB)modex16.c
286 wcl $(FLAGS) -c $(SRCLIB)modex16.c
288 bakapee.$(OBJ): $(SRCLIB)bakapee.h $(SRCLIB)bakapee.c
289 wcl $(FLAGS) -c $(SRCLIB)bakapee.c
291 16render.$(OBJ): $(MODEXLIB)16render.h $(MODEXLIB)16render.c
292 wcl $(FLAGS) -c $(MODEXLIB)16render.c
294 16planar.$(OBJ): $(MODEXLIB)16planar.h $(MODEXLIB)16planar.c
295 wcl $(FLAGS) -c $(MODEXLIB)16planar.c
297 bitmap.$(OBJ): $(SRCLIB)bitmap.h $(SRCLIB)bitmap.c
298 wcl $(FLAGS) -c $(SRCLIB)bitmap.c
300 planar.$(OBJ): $(SRCLIB)planar.h $(SRCLIB)planar.c
301 wcl $(FLAGS) -c $(SRCLIB)planar.c
303 scroll16.$(OBJ): $(SRCLIB)scroll16.h $(SRCLIB)scroll16.c
304 wcl $(FLAGS) -c $(SRCLIB)scroll16.c
306 wcpu.$(OBJ): $(WCPULIB)wcpu.h $(WCPULIB)wcpu.c
307 wcl $(FLAGS) -c $(WCPULIB)wcpu.c
309 16text.$(OBJ): $(SRCLIB)16text.c
310 wcl $(FLAGS) -c $(SRCLIB)16text.c
312 mapread.$(OBJ): $(SRCLIB)mapread.h $(SRCLIB)mapread.c
313 wcl $(FLAGS) -c $(SRCLIB)mapread.c
315 16_timer.$(OBJ): $(SRCLIB)16_timer.h $(SRCLIB)16_timer.c
316 wcl $(FLAGS) -c $(SRCLIB)16_timer.c
318 16_in.$(OBJ): $(SRCLIB)16_in.h $(SRCLIB)16_in.c
319 wcl $(FLAGS) -c $(SRCLIB)16_in.c
321 16_mm.$(OBJ): $(SRCLIB)16_mm.h $(SRCLIB)16_mm.c
322 wcl $(FLAGS) -c $(SRCLIB)16_mm.c
324 16_ca.$(OBJ): $(SRCLIB)16_ca.h $(SRCLIB)16_ca.c
325 wcl $(FLAGS) -c $(SRCLIB)16_ca.c
327 midi.$(OBJ): $(SRCLIB)midi.h $(SRCLIB)midi.c
328 wcl $(FLAGS) -c $(SRCLIB)midi.c
333 adlib.$(OBJ): $(DOSLIB)adlib.h $(DOSLIB)adlib.c
334 wcl $(FLAGS) -c $(DOSLIB)adlib.c
336 8254.$(OBJ): $(DOSLIB)8254.h $(DOSLIB)8254.c
337 wcl $(FLAGS) -c $(DOSLIB)8254.c
339 8259.$(OBJ): $(DOSLIB)8259.h $(DOSLIB)8259.c
340 wcl $(FLAGS) -c $(DOSLIB)8259.c
342 dos.$(OBJ): $(DOSLIB)dos.h $(DOSLIB)dos.c
343 wcl $(FLAGS) -c $(DOSLIB)dos.c
345 cpu.$(OBJ): $(DOSLIB)cpu.h $(DOSLIB)cpu.c
346 wcl $(FLAGS) -c $(DOSLIB)cpu.c
348 himemsys.$(OBJ): $(DOSLIB)himemsys.h $(DOSLIB)himemsys.c
349 wcl $(FLAGS) -c $(DOSLIB)himemsys.c
351 emm.$(OBJ): $(DOSLIB)emm.h $(DOSLIB)emm.c
352 wcl $(FLAGS) -c $(DOSLIB)emm.c
354 # end of doslib stuff
356 16_head.$(OBJ): $(SRCLIB)16_head.h $(SRCLIB)16_head.c
357 wcl $(FLAGS) -c $(SRCLIB)16_head.c
359 16_hc.$(OBJ): $(SRCLIB)16_hc.h $(SRCLIB)16_hc.c
360 wcl $(FLAGS) -c $(SRCLIB)16_hc.c
362 16_snd.$(OBJ): $(SRCLIB)16_snd.h $(SRCLIB)16_snd.c
363 wcl $(FLAGS) -c $(SRCLIB)16_snd.c
364 #====wcl -mc -c $(SRCLIB)16_snd.c
366 jsmn.$(OBJ): $(JSMNLIB)jsmn.h $(JSMNLIB)jsmn.c
367 wcl $(FLAGS) -c $(JSMNLIB)jsmn.c
369 kitten.$(OBJ): $(NYANLIB)kitten.h $(NYANLIB)kitten.c
370 wcl $(FLAGS) -c $(NYANLIB)kitten.c
372 vgmSnd.$(OBJ): $(VGMSNDLIB)vgmSnd.h $(VGMSNDLIB)vgmSnd.c
373 wcl $(FLAGS) -c $(VGMSNDLIB)vgmSnd.c
374 #====wcl -c -mc $(VGMSNDLIB)vgmSnd.c
376 #3812intf.$(OBJ): $(VGMSNDLIB)3812intf.h $(VGMSNDLIB)3812intf.c
377 # wcl $(FLAGS) -c $(VGMSNDLIB)3812intf.c
379 #farjsmn.$(OBJ): $(JSMNLIB)farjsmn.h $(JSMNLIB)farjsmn.c
380 # wcl $(FLAGS) $(MFLAGS) -c $(JSMNLIB)farjsmn.c
382 #memory.$(OBJ): $(EXMMLIB)memory.h $(EXMMLIB)memory.c
383 # wcl $(FLAGS) $(MFLAGS) -c $(EXMMLIB)memory.c
385 c_utils.$(OBJ): $(MODEXLIB_)c_utils.asm
386 wcl -c $(AFLAGS) $(MODEXLIB_)c_utils.asm
387 modex.$(OBJ): $(MODEXLIB_)modex.asm
388 wcl -c $(AFLAGS) $(MODEXLIB_)modex.asm
394 @$(REMOVECOMMAND) $(EXEC)
395 @$(REMOVECOMMAND) *.$(OBJ)
396 @$(REMOVECOMMAND) 16.lib
397 @$(REMOVECOMMAND) gfx.lib
398 @$(REMOVECOMMAND) doslib.lib
399 @$(REMOVECOMMAND) vgmsnd.lib
400 @wlib -n $(WLIBQ) 16.lib
401 @wlib -n $(WLIBQ) gfx.lib
402 @wlib -n $(WLIBQ) doslib.lib
403 @wlib -n $(WLIBQ) vgmsnd.lib
404 @$(REMOVECOMMAND) *.16
405 @$(REMOVECOMMAND) *.16W
406 @$(REMOVECOMMAND) *.16B
407 @$(REMOVECOMMAND) *.OBJ
408 @$(REMOVECOMMAND) *.o
409 @$(REMOVECOMMAND) *.BCO
410 @$(REMOVECOMMAND) makefi~1
411 @$(REMOVECOMMAND) makefile~
412 @$(REMOVECOMMAND) __wcl__.LNK
413 # @$(REMOVECOMMAND) *.smp
414 @$(REMOVECOMMAND) *.SMP
415 @$(REMOVECOMMAND) *.hed
416 @$(REMOVECOMMAND) *.MAP
417 @$(REMOVECOMMAND) *.map
418 @$(REMOVECOMMAND) *.err
419 @$(COPYCOMMAND) .git/config git_con.fig
420 # @$(COPYCOMMAND) $(SRC)exmmtest.c $(EXMMTESTDIR)$(SRC)
421 # @$(COPYCOMMAND) $(SRCLIB)16_mm.* $(EXMMTESTDIR)$(SRCLIB)
422 # @$(COPYCOMMAND) $(SRCLIB)16_head.* $(EXMMTESTDIR)$(SRCLIB)
423 # @$(COPYCOMMAND) $(SRCLIB)16_ca.* $(EXMMTESTDIR)$(SRCLIB)
424 # @$(COPYCOMMAND) $(SRCLIB)16_hc.* $(EXMMTESTDIR)$(SRCLIB)
425 # @$(COPYCOMMAND) $(SRCLIB)types.h $(EXMMTESTDIR)$(SRCLIB)
426 # @$(COPYCOMMAND) $(NYANLIB)* $(EXMMTESTDIR)$(NYANLIB)
434 @upx -9 $(UPXQ) $(EXEC)
437 # @rm /var/www/$(EXEC)
438 @cp ./$(EXEC) /var/www/
439 @./z.sh $(EXEC) $(EXEC)
440 @scp -r -P 26 *.exe 4ch.mooo.com:/var/www/16/
441 @scp -r -P 26 /var/www/*.exe.zip.* 4ch.mooo.com:/var/www/16/
446 #git submodule add <repo>
450 updatelibs: .symbolic
453 @cd $(PDIR)$(PDIR)$(PDIR)
457 @cd $(PDIR)$(PDIR)$(PDIR)
459 reinitlibs: .symbolic
460 @rm -rf $(SRCLIB)doslib
461 @rm -rf $(SRCLIB)jsmn
462 @mkdir $(SRCLIB)doslib
468 @git clone https://github.com/joncampbell123/doslib.git
469 @git clone https://github.com/zserge/jsmn.git
489 @wmake -h -f makefile all