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
29 # this enables debug output to the serial port.
30 # comment this out on game release.
31 # serial output goes to COM1 at 9600 baud 1 stop bit odd parity.
32 # serial output is plain text ASCII.
56 BUILD_ROOT=$+$(%__CWD__)$-
57 #EXMMTESTDIR=16$(DIRSEP)exmmtest$(DIRSEP)
59 SPRI=$(DATADIR)$(DIRSEP)spri$(DIRSEP)
65 MODEXLIB16=src/lib/modex16
66 MODEXLIB=src/lib/modex
67 VGMSNDLIB=src/lib/vgmsnd
71 DOSLIB_CPU=src/lib/doslib/hw/cpu
72 DOSLIB_DOS=src/lib/doslib/hw/dos
73 DOSLIB_VGA=src/lib/doslib/hw/vga
74 DOSLIB_8250=src/lib/doslib/hw/8250
75 DOSLIB_JOYSTICK=src/lib/doslib/hw/joystick
87 S_FLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768#54096#60000
88 Z_FLAGS=-zk0 -zc -zp8 -zm
89 O_FLAGS=-obmilr -oe=24 -out -oh -ei -onac -ol+ -ok##x
90 T_FLAGS=-bt=dos -mh -0 -fpi87
92 CPPFLAGS=-DTARGET_MSDOS=16
94 CPPFLAGS += -DDEBUGSERIAL
96 AFLAGS=$(WCLQ) $(T_FLAGS) -d1 -fo=.$(OBJ)
97 CFLAGS=$(WCLQ) $(T_FLAGS) -d1 -fo=.$(OBJ) -wo -i"$(DOSLIB)" $(O_FLAGS) $(S_FLAGS) $(Z_FLAGS)
98 LFLAGS=$(WCLQ) -l=dos -fm=$^&.mah
99 LIBFLAGS=$(WLIBQ) -b -n
104 VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
105 16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ)
106 GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16_vrs.$(OBJ) 16_sprit.$(OBJ)
107 #16planar.$(OBJ) planar.$(OBJ)
108 DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
110 DOSLIBOBJ += 8250.$(OBJ)
116 DOSLIBLIBS = $(DOSLIB_CPU)/dos86h/cpu.lib $(DOSLIB_DOS)/dos86h/dos.lib $(DOSLIB_VGA)/dos86h/vga.lib
118 DOSLIBLIBS += $(DOSLIB_8250)/dos86h/8250.lib
120 #16.lib causes a massive stack overflow
121 16LIB=$(16LIBOBJS)#16.lib
126 .c : $(SRC);$(SRCLIB);$(MODEXLIB16);$(JSMNLIB);$(NYANLIB);$(VGMSNDLIB);$(WCPULIB)
130 .lib : .;$(DOSLIB_CPU)/dos86h;$(DOSLIB_DOS)/dos86h;$(DOSLIB_VGA)/dos86h;$(DOSLIB_8250)/dos86h
138 *wcl $(CPPFLAGS) $(CFLAGS) $(extra_$^&_obj_opts) -c $[@
141 *wcl $(AFLAGS) $(extra_$^&_obj_opts) -c $[@
144 *wcl $(LFLAGS) $(extra_$^&_exe_opts) -fe=$@ $<
147 *wlib $(LIBFLAGS) $(extra_$^&_lib_opts) $@ $<
150 # List of executables to build
175 all: $(EXEC) joytest.exe
178 # game and bakapi executables
180 16.exe: 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
181 bakapi.exe: bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS)
186 scroll.exe: scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
187 scroll.$(OBJ): $(SRC)/scroll.c
188 tesuto.exe: tesuto.$(OBJ) 16_head.$(OBJ) gfx.lib $(DOSLIBLIBS)
189 tesuto.$(OBJ): $(SRC)/tesuto.c
190 0.exe: 0.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
192 test.exe: test.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
193 #test2.exe: test2.$(OBJ) gfx.lib $(DOSLIBLIBS)
194 test0.exe: test0.$(OBJ)
195 fonttest.exe: fonttest.$(OBJ) gfx.lib
196 #fonttes0.exe: fonttes0.$(OBJ) $(16LIB)
197 fontgfx.exe: fontgfx.$(OBJ) gfx.lib $(DOSLIBLIBS)
198 inputest.exe: inputest.$(OBJ) $(16LIB) $(DOSLIBLIBS)
199 #sountest.exe: sountest.$(OBJ) $(16LIB)
200 pcxtest.exe: pcxtest.$(OBJ) gfx.lib $(DOSLIBLIBS)
201 vrstest.exe: vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIBLIBS)
202 palettec.exe: palettec.$(OBJ) gfx.lib $(DOSLIBLIBS)
203 palettel.exe: palettel.$(OBJ) gfx.lib $(DOSLIBLIBS)
204 pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib $(DOSLIBLIBS)
205 #planrpcx.exe: planrpcx.$(OBJ) gfx.lib
206 maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) gfx.lib $(DOSLIBLIBS)
207 fmemtest.exe: fmemtest.$(OBJ)
208 exmmtest.exe: exmmtest.$(OBJ) $(16LIB) $(DOSLIBLIBS)
209 vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIB) $(DOSLIBLIBS)
212 # executable's objects
214 16.$(OBJ): $(SRC)/16.c $(SRC)/16.h
215 bakapi.$(OBJ): $(SRC)/bakapi.c $(SRC)/bakapi.h
216 test.$(OBJ): $(SRC)/test.c $(SRCLIB)/modex16.h
217 #test2.$(OBJ): $(SRC)/test2.c $(SRCLIB)/modex16.h
218 test0.$(OBJ): $(SRC)/test0.c
219 pcxtest.$(OBJ): $(SRC)/pcxtest.c $(SRCLIB)/modex16.h
220 vrstest.$(OBJ): $(SRC)/vrstest.c $(SRCLIB)/modex16.h
221 #planrpcx.$(OBJ): $(SRC)/planrpcx.c $(SRCLIB)/modex16.h
222 pcxtest2.$(OBJ): $(SRC)/pcxtest2.c $(SRCLIB)/modex16.h
223 palettec.$(OBJ): $(SRC)/palettec.c
224 palettel.$(OBJ): $(SRC)/palettel.c
225 maptest.$(OBJ): $(SRC)/maptest.c $(SRCLIB)/modex16.h
226 #emmtest.$(OBJ): $(SRC)/emmtest.c
227 #emsdump.$(OBJ): $(SRC)/emsdump.c
228 fmemtest.$(OBJ): $(SRC)/fmemtest.c
229 fonttest.$(OBJ): $(SRC)/fonttest.c
230 #fonttes0.$(OBJ): $(SRC)/fonttes0.c
231 fontgfx.$(OBJ): $(SRC)/fontgfx.c
232 inputest.$(OBJ): $(SRC)/inputest.c
233 #sountest.$(OBJ): $(SRC)/sountest.c
234 #miditest.$(OBJ): $(SRC)/miditest.c
235 #testemm.$(OBJ): $(SRC)/testemm.c
236 #testemm0.$(OBJ): $(SRC)/testemm0.c
237 #tsthimem.$(OBJ): $(SRC)/tsthimem.c
238 exmmtest.$(OBJ): $(SRC)/exmmtest.c
239 vgmtest.$(OBJ): $(SRC)/vgmtest.c
242 # non executable objects libraries
246 vgmsnd.lib: $(VGMSNDOBJ)
248 gfx.lib: $(GFXLIBOBJS)
249 *wlib $(LIBFLAGS) $(extra_$^&_lib_opts) $@ $<
252 # !include $(DOSLIBDIR)$(DIRSEP)extdep.mak
254 # library deps 16-bit huge
255 $(DOSLIB_CPU)/dos86h/cpu.lib:
256 cd $(DOSLIB_CPU:$(to_os_path)) && .$(DIRSEP)make.sh && cd $(BUILD_ROOT)
257 $(DOSLIB_DOS)/dos86h/dos.lib:
258 cd $(DOSLIB_DOS:$(to_os_path)) && .$(DIRSEP)make.sh && cd $(BUILD_ROOT)
259 $(DOSLIB_VGA)/dos86h/vgatty.lib:
260 cd $(DOSLIB_VGA:$(to_os_path)) && .$(DIRSEP)make.sh && cd $(BUILD_ROOT)
261 $(DOSLIB_VGA)/dos86h/vga.lib:
262 cd $(DOSLIB_VGA:$(to_os_path)) && .$(DIRSEP)make.sh && cd $(BUILD_ROOT)
263 $(DOSLIB_8250)/dos86h/8250.lib:
264 cd $(DOSLIB_8250:$(to_os_path)) && .$(DIRSEP)make.sh && cd $(BUILD_ROOT)
267 cd $(DOSLIB_JOYSTICK:$(to_os_path)) && .$(DIRSEP)make.sh && cd $(BUILD_ROOT)
268 $(COPYCOMMAND) $(DOSLIB_JOYSTICK:$(to_os_path))$(DIRSEP)dos86h$(DIRSEP)test.exe joytest.exe
269 #$(DOSLIBLIBS): .symbolic
270 # @cd $(DOSLIB:$(to_os_path))
271 # @.$(DIRSEP)buildall.sh
274 modex16.$(OBJ): $(SRCLIB)/modex16.c $(SRCLIB)/modex16.h
275 bakapee.$(OBJ): $(SRCLIB)/bakapee.c $(SRCLIB)/bakapee.h
276 16render.$(OBJ): $(SRCLIB)/16render.c $(SRCLIB)/16render.h
277 16planar.$(OBJ): $(MODEXLIB16)/16planar.c $(MODEXLIB16)/16planar.h
278 16_vrs.$(OBJ): $(SRCLIB)/16_vrs.c $(SRCLIB)/16_vrs.h $(DOSLIBLIBS)
279 16_sprit.$(OBJ): $(SRCLIB)/16_sprit.c $(SRCLIB)/16_sprit.h
280 bitmap.$(OBJ): $(SRCLIB)/bitmap.c $(SRCLIB)/bitmap.h
281 planar.$(OBJ): $(SRCLIB)/planar.c $(SRCLIB)/planar.h
282 scroll16.$(OBJ): $(SRCLIB)/scroll16.c $(SRCLIB)/scroll16.h
283 16text.$(OBJ): $(SRCLIB)/16text.c
284 mapread.$(OBJ): $(SRCLIB)/mapread.c $(SRCLIB)/mapread.h
285 16_timer.$(OBJ): $(SRCLIB)/16_timer.c $(SRCLIB)/16_timer.h
286 16_in.$(OBJ): $(SRCLIB)/16_in.c $(SRCLIB)/16_in.h
287 16_mm.$(OBJ): $(SRCLIB)/16_mm.c $(SRCLIB)/16_mm.h
288 16_ca.$(OBJ): $(SRCLIB)/16_ca.c $(SRCLIB)/16_ca.h
289 16_dbg.$(OBJ): $(SRCLIB)/16_dbg.c $(SRCLIB)/16_dbg.h
290 midi.$(OBJ): $(SRCLIB)/midi.c $(SRCLIB)/midi.h
291 16_head.$(OBJ): $(SRCLIB)/16_head.c $(SRCLIB)/16_head.h
292 16_hc.$(OBJ): $(SRCLIB)/16_hc.c $(SRCLIB)/16_hc.h
293 16_snd.$(OBJ): $(SRCLIB)/16_snd.c $(SRCLIB)/16_snd.h
294 jsmn.$(OBJ): $(JSMNLIB)/jsmn.c $(JSMNLIB)/jsmn.h
295 kitten.$(OBJ): $(NYANLIB)/kitten.c $(NYANLIB)/kitten.h
296 vgmSnd.$(OBJ): $(VGMSNDLIB)/vgmSnd.c $(VGMSNDLIB)/vgmSnd.h
297 wcpu.$(OBJ): $(WCPULIB)/wcpu.c $(WCPULIB)/wcpu.h
298 #memory.$(OBJ): $(EXMMLIB)/memory.c $(EXMMLIB)/memory.h
299 c_utils.$(OBJ): $(MODEXLIB)/c_utils.asm
300 modex.$(OBJ): $(MODEXLIB)/modex.asm
306 @$(REMOVECOMMAND) $(EXEC)
307 @$(REMOVECOMMAND) *.$(OBJ)
311 #@$(REMOVECOMMAND) *.\$\$\$
313 @*$(REMOVECOMMAND) *.$$$
315 @$(REMOVECOMMAND) 16.lib
316 @$(REMOVECOMMAND) gfx.lib
317 @$(REMOVECOMMAND) vgmsnd.lib
318 @*wlib -n $(WLIBQ) 16.lib
319 @*wlib -n $(WLIBQ) gfx.lib
320 @*wlib -n $(WLIBQ) vgmsnd.lib
321 @$(REMOVECOMMAND) *.16W
322 @$(REMOVECOMMAND) *.16B
323 @$(REMOVECOMMAND) *.OBJ
324 @$(REMOVECOMMAND) *.o
325 @$(REMOVECOMMAND) *.BCO
326 #@$(REMOVECOMMAND) makefi~1
327 #@$(REMOVECOMMAND) makefile~
328 @$(REMOVECOMMAND) __wcl__.LNK
329 # @$(REMOVECOMMAND) *.smp
330 @$(REMOVECOMMAND) *.SMP
331 @$(REMOVECOMMAND) *.hed
332 @$(REMOVECOMMAND) *.MAH
333 @$(REMOVECOMMAND) *.mah
334 @$(REMOVECOMMAND) *.err
336 #@cd $(DOSLIB:$(to_os_path))
337 #@./buildall.sh clean
339 # @$(COPYCOMMAND) $(SRC)exmmtest.c $(EXMMTESTDIR)$(SRC)
340 # @$(COPYCOMMAND) $(SRCLIB)16_mm.* $(EXMMTESTDIR)$(SRCLIB)
341 # @$(COPYCOMMAND) $(SRCLIB)16_head.* $(EXMMTESTDIR)$(SRCLIB)
342 # @$(COPYCOMMAND) $(SRCLIB)16_ca.* $(EXMMTESTDIR)$(SRCLIB)
343 # @$(COPYCOMMAND) $(SRCLIB)16_hc.* $(EXMMTESTDIR)$(SRCLIB)
344 # @$(COPYCOMMAND) $(SRCLIB)types.h $(EXMMTESTDIR)$(SRCLIB)
345 # @$(COPYCOMMAND) $(NYANLIB)* $(EXMMTESTDIR)$(NYANLIB)
349 backupconfig: .symbolic
350 @$(COPYCOMMAND) .git$(DIRSEP)config git_con.fig
351 @$(COPYCOMMAND) .gitmodules git_modu.les
352 @$(COPYCOMMAND) .gitignore git_igno.re
358 @*upx -9 $(UPXQ) $(EXEC)
361 @ssh -p 26 sparky4@4ch.mooo.com 'rm -f /var/www/16/*exe*'
362 #@rm -f /var/www/$(EXEC)*
363 @rm -f /var/www/*.exe.zip*
364 #@cp ./$(EXEC) $(DIRSEP)var$(DIRSEP)www$(DIRSEP)
365 @./src/util/z.sh $(EXEC) $(EXEC)
366 @scp -r -P 26 *.exe 4ch.mooo.com:/var/www/16/
367 @scp -r -P 26 x4get.bat 4ch.mooo.com:/var/www/16/
368 @scp -r -P 26 /var/www/*.exe.zip.* 4ch.mooo.com:/var/www/16/
377 ## External library management~ ^^
379 #git submodule add <repo>
381 @cd $(DOSLIB:$(to_os_path))
386 @cd $(JSMNLIB:$(to_os_path))
389 @cd $(DOSLIB:$(to_os_path))
393 reinitlibs: .symbolic
394 @rm -rf $(SRCLIB)doslib
395 @rm -rf $(SRCLIB)jsmn
396 @rm -rf 16/CatacombApocalypse
402 @cp git_con.fig .git/config
403 @cp git_modu.les .gitmodules
404 @cp git_igno.re .gitignore
405 @cd $(SRCLIB:$(to_os_path))
406 @git clone https://github.com/joncampbell123/doslib.git
407 @git clone https://github.com/zserge/jsmn.git
410 @git clone https://github.com/FlatRockSoft/CatacombApocalypse.git
411 @git clone https://github.com/id-Software/wolf3d.git
412 @git clone https://github.com/keendreams/keen.git
414 @cp $(DOSLIB)/make-lowercase .
433 @wmake -h -f makefile all
437 @cd $(DOSLIB_VGA:$(to_os_path))
440 @mv pcx2vrl $(BUILD_ROOT)$(DIRSEP)
441 @mv pcxsscut $(BUILD_ROOT)$(DIRSEP)
442 @mv vrl2vrs $(BUILD_ROOT)$(DIRSEP)
443 @mv vrsdump $(BUILD_ROOT)$(DIRSEP)