+NYANLIB=$(SRCLIB)nyan$(DIRSEP)
+#EXMMLIB=$(SRCLIB)exmm$(DIRSEP)
+MODEXLIB=$(SRCLIB)modex16$(DIRSEP)
+MODEXLIB_=$(SRCLIB)modex$(DIRSEP)
+VGMSNDLIB=$(SRCLIB)vgmsnd$(DIRSEP)
+DOSLIB=$(SRCLIB)doslib$(DIRSEP)
+DOSLIBDIR=$(SRCLIB)doslib
+WCPULIB=$(SRCLIB)wcpu$(DIRSEP)
+
+WLIBQ=-q
+WCLQ=-zq $(WLIBQ)
+UPXQ=-qqq
+
+AFLAGS=-mh -0 -d1
+16FLAGS=-fh=16.hed
+BAKAPIFLAGS=-fh=bakapi.hed
+SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768#55808#60000
+DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS)
+ZFLAGS=-zk0 -zc -zp8 $(WCLQ) ## -zm
+CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo -i$(DOSLIB)##wwww
+OFLAGS=-obmiler -out -oh -ei -zp8 -fpi87 -onac -ol+ -ok####x
+FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS)
+
+
+#DOSLIBEXMMOBJ = himemsys.$(OBJ) emm.$(OBJ)
+VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
+DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
+16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ)
+
+GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ) $(DOSLIBLIBS)
+
+DOSLIBLIBS=$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib
+#$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vgatty.lib
+
+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
+# tsthimem.exe
+#testemm.exe testemm0.exe fonttes0.exe miditest.exe sega.exe sountest.exe
+EXEC = 16.exe bakapi.exe $(TESTEXEC) tesuto.exe
+
+all: $(EXEC) joytest.exe vrs
+
+#$(16LIBOBJS) => 16.lib bug....
+#
+#game and bakapi executables
+#
+16.exe: 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib
+ wcl $(FLAGS) $(16FLAGS) 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=16.mah
+
+bakapi.exe: bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS)
+ wcl $(FLAGS) $(BAKAPIFLAGS) bakapi.$(OBJ) gfx.lib $(DOSLIBLIBS) -fm=bakapi.mah
+#modex.lib
+#
+#Test Executables!
+#
+scroll.exe: scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib
+ wcl $(FLAGS) scroll.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=scroll.mah
+scroll.$(OBJ): $(SRC)scroll.c
+ wcl $(FLAGS) -c $(SRC)scroll.c
+
+
+# NOTE: dos86h = 16-bit huge memory model. memory model must match!
+tesuto.exe: tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) gfx.lib
+# %write tmp.cmd option quiet option map=tesuto.mah $(DOSLIB_LDFLAGS_DOS16H) file tesuto.obj name tesuto.exe
+# %write tmp.cmd library $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib
+# %write tmp.cmd library $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib
+# @wlink @tmp.cmd
+ wcl $(FLAGS) $(WCLQ) tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) gfx.lib
+tesuto.$(OBJ): $(SRC)tesuto.c
+ wcl $(FLAGS) $(WCLQ) -c $(SRC)tesuto.c
+
+test.exe: test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ)
+ wcl $(FLAGS) test.$(OBJ) gfx.lib 16_in.$(OBJ) 16_head.$(OBJ) -fm=test.mah
+
+test2.exe: test2.$(OBJ) gfx.lib
+ wcl $(FLAGS) test2.$(OBJ) gfx.lib -fm=test2.mah
+
+fonttest.exe: fonttest.$(OBJ) $(16LIBOBJS) gfx.lib
+ wcl $(FLAGS) fonttest.$(OBJ) $(16LIBOBJS) gfx.lib -fm=fonttest.mah
+
+#fonttes0.exe: fonttes0.$(OBJ) $(16LIBOBJS)
+# wcl $(FLAGS) fonttes0.$(OBJ) $(16LIBOBJS)
+
+fontgfx.exe: fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS)
+ wcl $(FLAGS) fontgfx.$(OBJ) $(16LIBOBJS) gfx.lib $(DOSLIBLIBS) -fm=fontgfx.mah
+
+inputest.exe: inputest.$(OBJ) $(16LIBOBJS)
+ wcl $(FLAGS) inputest.$(OBJ) $(16LIBOBJS) -fm=inputest.mah
+
+#sountest.exe: sountest.$(OBJ) $(16LIBOBJS)
+# wcl $(FLAGS) sountest.$(OBJ) $(16LIBOBJS)
+
+#miditest.exe: miditest.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) midi.$(OBJ)
+# wcl $(FLAGS) miditest.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) midi.$(OBJ)
+
+tsthimem.exe: tsthimem.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
+ wcl $(FLAGS) tsthimem.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ) -fm=tsthimem.mah
+
+#testemm.exe: testemm.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
+# wcl $(FLAGS) testemm.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
+
+#testemm0.exe: testemm0.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
+# wcl $(FLAGS) testemm0.$(OBJ) $(16LIBOBJS) $(DOSLIBEXMMOBJ)
+
+pcxtest.exe: pcxtest.$(OBJ) gfx.lib
+ wcl $(FLAGS) pcxtest.$(OBJ) gfx.lib -fm=pcxtest.mah
+
+palettec.exe: palettec.$(OBJ) gfx.lib #$(16LIBOBJS)
+ wcl $(FLAGS) palettec.$(OBJ) gfx.lib -fm=palettec.mah #$(16LIBOBJS)
+
+palettel.exe: palettel.$(OBJ) gfx.lib #$(16LIBOBJS)
+ wcl $(FLAGS) palettel.$(OBJ) gfx.lib -fm=palettel.mah #$(16LIBOBJS)
+
+pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib
+ wcl $(FLAGS) pcxtest2.$(OBJ) gfx.lib -fm=pcxtest2.mah
+
+planrpcx.exe: planrpcx.$(OBJ) gfx.lib
+ wcl $(FLAGS) planrpcx.$(OBJ) gfx.lib -fm=planrpcx.mah
+
+maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib
+ wcl $(FLAGS) maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=maptest.mah
+
+#maptest0.exe: maptest0.$(OBJ) fmapread.$(OBJ) farjsmn.$(OBJ)
+# wcl $(FLAGS) $(MFLAGS) maptest0.$(OBJ) fmapread.$(OBJ) farjsmn.$(OBJ)
+
+#emmtest.exe: emmtest.$(OBJ) memory.$(OBJ)
+# wcl $(FLAGS) $(MFLAGS) emmtest.$(OBJ) memory.$(OBJ)
+
+#emsdump.exe: emsdump.$(OBJ) memory.$(OBJ)
+# wcl $(FLAGS) $(MFLAGS) emsdump.$(OBJ) memory.$(OBJ)
+
+fmemtest.exe: fmemtest.$(OBJ) $(16LIBOBJS)
+ wcl $(FLAGS) fmemtest.$(OBJ) $(16LIBOBJS) -fm=fmemtest.mah
+
+exmmtest.exe: exmmtest.$(OBJ) $(16LIBOBJS)
+ wcl $(FLAGS) exmmtest.$(OBJ) -fm=exmmtest.mah $(16LIBOBJS)
+
+vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIBOBJS)
+ wcl $(FLAGS) vgmtest.$(OBJ) vgmsnd.lib -fm=vgmtest.mah $(16LIBOBJS)
+ #====wcl -mc vgmtest.$(OBJ) $(VGMSNDOBJ) -fm=vgmtest.mah
+
+
+#
+#executable's objects
+#
+16.$(OBJ): $(SRC)16.h $(SRC)16.c
+ wcl $(FLAGS) -c $(SRC)16.c
+
+bakapi.$(OBJ): $(SRC)bakapi.h $(SRC)bakapi.c
+ wcl $(FLAGS) -c $(SRC)bakapi.c
+
+test.$(OBJ): $(SRC)test.c $(SRCLIB)modex16.h
+ wcl $(FLAGS) -c $(SRC)test.c
+
+test2.$(OBJ): $(SRC)test2.c $(SRCLIB)modex16.h
+ wcl $(FLAGS) -c $(SRC)test2.c
+
+pcxtest.$(OBJ): $(SRC)pcxtest.c $(SRCLIB)modex16.h
+ wcl $(FLAGS) -c $(SRC)pcxtest.c
+
+planrpcx.$(OBJ): $(SRC)planrpcx.c $(SRCLIB)modex16.h
+ wcl $(FLAGS) -c $(SRC)planrpcx.c
+
+pcxtest2.$(OBJ): $(SRC)pcxtest2.c $(SRCLIB)modex16.h
+ wcl $(FLAGS) -c $(SRC)pcxtest2.c
+
+palettec.$(OBJ): $(SRC)palettec.c
+ wcl $(FLAGS) -c $(SRC)palettec.c
+
+palettel.$(OBJ): $(SRC)palettel.c
+ wcl $(FLAGS) -c $(SRC)palettel.c
+
+maptest.$(OBJ): $(SRC)maptest.c $(SRCLIB)modex16.h
+ wcl $(FLAGS) -c $(SRC)maptest.c
+
+#maptest0.$(OBJ): $(SRC)maptest0.c# $(SRCLIB)modex16.h
+# wcl $(FLAGS) $(MFLAGS) -c $(SRC)maptest0.c
+
+#emmtest.$(OBJ): $(SRC)emmtest.c
+# wcl $(FLAGS) $(MFLAGS) -c $(SRC)emmtest.c
+
+#emsdump.$(OBJ): $(SRC)emsdump.c
+# wcl $(FLAGS) $(MFLAGS) -c $(SRC)emsdump.c
+
+fmemtest.$(OBJ): $(SRC)fmemtest.c
+ wcl $(FLAGS) -c $(SRC)fmemtest.c
+
+fonttest.$(OBJ): $(SRC)fonttest.c
+ wcl $(FLAGS) -c $(SRC)fonttest.c
+
+#fonttes0.$(OBJ): $(SRC)fonttes0.c
+# wcl $(FLAGS) -c $(SRC)fonttes0.c
+
+fontgfx.$(OBJ): $(SRC)fontgfx.c
+ wcl $(FLAGS) -c $(SRC)fontgfx.c
+
+inputest.$(OBJ): $(SRC)inputest.c
+ wcl $(FLAGS) -c $(SRC)inputest.c
+
+#sountest.$(OBJ): $(SRC)sountest.c
+# wcl $(FLAGS) -c $(SRC)sountest.c
+
+#miditest.$(OBJ): $(SRC)miditest.c
+# wcl $(FLAGS) -c $(SRC)miditest.c
+
+#testemm.$(OBJ): $(SRC)testemm.c
+# wcl $(FLAGS) -c $(SRC)testemm.c
+
+#testemm0.$(OBJ): $(SRC)testemm0.c
+# wcl $(FLAGS) -c $(SRC)testemm0.c
+
+tsthimem.$(OBJ): $(SRC)tsthimem.c
+ wcl $(FLAGS) -c $(SRC)tsthimem.c
+
+exmmtest.$(OBJ): $(SRC)exmmtest.c
+ wcl $(FLAGS) -c $(SRC)exmmtest.c
+
+vgmtest.$(OBJ): $(SRC)vgmtest.c
+ wcl $(FLAGS) -c $(SRC)vgmtest.c
+ #====wcl -mc -c $(SRC)vgmtest.c
+
+#
+#non executable objects libraries
+#
+16.lib: $(16LIBOBJS)# doslib.lib vgmsnd.lib
+ wlib -b $(WLIBQ) 16.lib $(16LIBOBJS)# doslib.lib vgmsnd.lib
+
+gfx.lib: $(GFXLIBOBJS)
+ wlib -b $(WLIBQ) gfx.lib $(GFXLIBOBJS)
+
+#doslib.lib: $(DOSLIBOBJ) # $(SRCLIB)cpu.lib
+# wlib -b $(WLIBQ) doslib.lib $(DOSLIBOBJ) # $(SRCLIB)cpu.lib
+
+vgmsnd.lib: $(VGMSNDOBJ)
+ wlib -b $(WLIBQ) vgmsnd.lib $(VGMSNDOBJ)
+
+# extdep:
+# !include $(DOSLIBDIR)$(DIRSEP)extdep.mak
+
+# library deps 16-bit huge
+$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib:
+ cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu && .$(DIRSEP)make.sh
+$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib:
+ cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos && .$(DIRSEP)make.sh
+$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vgatty.lib:
+ cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh
+$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib:
+ cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh
+
+joytest.exe:
+ cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)joystick && .$(DIRSEP)make.sh && $(COPYCOMMAND) dos86h$(DIRSEP)test.exe $(PDIR)$(PDIR)$(PDIR)$(PDIR)$(PDIR)joytest.exe
+#$(DOSLIBLIBS): .symbolic
+# @cd $(DOSLIB)
+# @.$(DIRSEP)buildall.sh
+# @cd $(PDIR)$(PDIR)$(PDIR)
+
+modex16.$(OBJ): $(SRCLIB)modex16.h $(SRCLIB)modex16.c
+ wcl $(FLAGS) -c $(SRCLIB)modex16.c
+
+bakapee.$(OBJ): $(SRCLIB)bakapee.h $(SRCLIB)bakapee.c
+ wcl $(FLAGS) -c $(SRCLIB)bakapee.c
+
+16render.$(OBJ): $(MODEXLIB)16render.h $(MODEXLIB)16render.c
+ wcl $(FLAGS) -c $(MODEXLIB)16render.c
+
+16planar.$(OBJ): $(MODEXLIB)16planar.h $(MODEXLIB)16planar.c
+ wcl $(FLAGS) -c $(MODEXLIB)16planar.c
+
+bitmap.$(OBJ): $(SRCLIB)bitmap.h $(SRCLIB)bitmap.c
+ wcl $(FLAGS) -c $(SRCLIB)bitmap.c
+
+planar.$(OBJ): $(SRCLIB)planar.h $(SRCLIB)planar.c
+ wcl $(FLAGS) -c $(SRCLIB)planar.c
+
+scroll16.$(OBJ): $(SRCLIB)scroll16.h $(SRCLIB)scroll16.c
+ wcl $(FLAGS) -c $(SRCLIB)scroll16.c
+
+wcpu.$(OBJ): $(WCPULIB)wcpu.h $(WCPULIB)wcpu.c
+ wcl $(FLAGS) -c $(WCPULIB)wcpu.c
+
+16text.$(OBJ): $(SRCLIB)16text.c
+ wcl $(FLAGS) -c $(SRCLIB)16text.c
+
+mapread.$(OBJ): $(SRCLIB)mapread.h $(SRCLIB)mapread.c
+ wcl $(FLAGS) -c $(SRCLIB)mapread.c
+
+16_timer.$(OBJ): $(SRCLIB)16_timer.h $(SRCLIB)16_timer.c
+ wcl $(FLAGS) -c $(SRCLIB)16_timer.c
+
+16_in.$(OBJ): $(SRCLIB)16_in.h $(SRCLIB)16_in.c
+ wcl $(FLAGS) -c $(SRCLIB)16_in.c
+
+16_mm.$(OBJ): $(SRCLIB)16_mm.h $(SRCLIB)16_mm.c
+ wcl $(FLAGS) -c $(SRCLIB)16_mm.c
+
+16_ca.$(OBJ): $(SRCLIB)16_ca.h $(SRCLIB)16_ca.c
+ wcl $(FLAGS) -c $(SRCLIB)16_ca.c
+
+midi.$(OBJ): $(SRCLIB)midi.h $(SRCLIB)midi.c
+ wcl $(FLAGS) -c $(SRCLIB)midi.c
+
+#
+# doslib stuff
+#
+adlib.$(OBJ): $(DOSLIB)adlib.h $(DOSLIB)adlib.c
+ wcl $(FLAGS) -c $(DOSLIB)adlib.c
+
+8254.$(OBJ): $(DOSLIB)8254.h $(DOSLIB)8254.c
+ wcl $(FLAGS) -c $(DOSLIB)8254.c
+
+8259.$(OBJ): $(DOSLIB)8259.h $(DOSLIB)8259.c
+ wcl $(FLAGS) -c $(DOSLIB)8259.c
+
+dos.$(OBJ): $(DOSLIB)dos.h $(DOSLIB)dos.c
+ wcl $(FLAGS) -c $(DOSLIB)dos.c
+
+cpu.$(OBJ): $(DOSLIB)cpu.h $(DOSLIB)cpu.c
+ wcl $(FLAGS) -c $(DOSLIB)cpu.c
+
+himemsys.$(OBJ): $(DOSLIB)himemsys.h $(DOSLIB)himemsys.c
+ wcl $(FLAGS) -c $(DOSLIB)himemsys.c
+
+emm.$(OBJ): $(DOSLIB)emm.h $(DOSLIB)emm.c
+ wcl $(FLAGS) -c $(DOSLIB)emm.c
+
+# end of doslib stuff
+
+16_head.$(OBJ): $(SRCLIB)16_head.h $(SRCLIB)16_head.c
+ wcl $(FLAGS) -c $(SRCLIB)16_head.c
+
+16_hc.$(OBJ): $(SRCLIB)16_hc.h $(SRCLIB)16_hc.c
+ wcl $(FLAGS) -c $(SRCLIB)16_hc.c
+
+16_snd.$(OBJ): $(SRCLIB)16_snd.h $(SRCLIB)16_snd.c
+ wcl $(FLAGS) -c $(SRCLIB)16_snd.c
+ #====wcl -mc -c $(SRCLIB)16_snd.c
+
+jsmn.$(OBJ): $(JSMNLIB)jsmn.h $(JSMNLIB)jsmn.c