X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=Makefile;h=54e4148188726d625cb54e65b3bf925ff6d1c688;hp=56f3889b73a8bc6e3243228f68d42fa0e4d6af8c;hb=7cffbf057545fb303ad8f53e432ef42f7708e16d;hpb=6c5e65928b425dd6a7f5192841e1d4ef9d90789a diff --git a/Makefile b/Makefile index 56f3889..54e4148 100644 --- a/Makefile +++ b/Makefile @@ -1,66 +1,88 @@ -demoobj = main.obj demo.obj screen.obj cfgopt.obj music.obj gfxutil.obj & -3dgfx.obj polyfill.obj -scrobj = tunnel.obj fract.obj grise.obj polytest.obj plasma.obj bump.obj & -thunder.obj -sysobj = gfx.obj vbe.obj dpmi.obj timer.obj keyb.obj mouse.obj sball.obj & -logger.obj tinyfps.obj -obj = $(baseobj) $(demoobj) $(sysobj) $(scrobj) +src = $(wildcard src/*.c) $(wildcard src/scr/*.c) $(wildcard src/dos/*.c) +asmsrc = $(wildcard src/*.asm) $(wildcard src/scr/*.asm) $(wildcard src/dos/*.asm) +obj = $(src:.c=.odj) $(asmsrc:.asm=.odj) +dep = $(obj:.odj=.dep) bin = demo.exe -libs = imago.lib mikmod.lib - -def = -dM_PI=3.141592653589793 -opt = -5 -fp5 -otexan -oh -oi -ei -dbg = -d1 - -!ifdef __UNIX__ -incpath = -Isrc -Isrc/dos -Ilibs/imago/src -Ilibs/oldmik/src -libpath = libpath libs/imago libpath libs/oldmik -RM = rm -f -!else -incpath = -Isrc -Isrc\dos -Ilibs\imago\src -Ilibs\oldmik\src -libpath = libpath libs\imago libpath libs\oldmik -RM = del -!endif - -AS = nasm -CC = wcc386 -CXX = wpp386 -ASFLAGS = -fobj -CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos $(incpath) -CXXFLAGS = $(CFLAGS) -LDFLAGS = option stack=16k option map $(libpath) library { $(libs) } -LD = wlink - -$(bin): cflags.occ $(obj) libs/imago/imago.lib - %write objects.lnk $(obj) - %write ldflags.lnk $(LDFLAGS) - $(LD) debug all name $@ system dos4g file { @objects } @ldflags - -.c: src;src/dos -.cc: src;src/dos -.asm: src;src/dos - -cflags.occ: Makefile - %write $@ $(CFLAGS) - -cxxflags.occ: Makefile - %write $@ $(CXXFLAGS) - -music.obj: music.c - $(CC) -fo=$@ @cflags.occ -zu $[* - -.c.obj: .autodepend - $(CC) -fo=$@ @cflags.occ $[* - -.cc.obj: .autodepend - $(CXX) -fo=$@ @cxxflags.occ $[* - -.asm.obj: - $(AS) $(ASFLAGS) -o $@ $[*.asm - -clean: .symbolic - $(RM) *.obj - $(RM) *.occ - $(RM) *.lnk - $(RM) $(bin) +asmsrc += cspr/dbgfont.asm cspr/confont.asm +bindata = data/loading.img + +ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) + hostsys = dos +else + hostsys = unix + TOOLPREFIX = i586-pc-msdosdjgpp- +endif + +inc = -Isrc -Isrc/scr -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src +opt = -O3 -ffast-math -fno-strict-aliasing +dbg = -g +#prof = -pg +warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable +def = -DNO_MUSIC + +CC = $(TOOLPREFIX)gcc +AR = $(TOOLPREFIX)ar +CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(prof) $(inc) $(def) +LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja + +ifneq ($(hostsys), dos) +.PHONY: all +all: data $(bin) +endif + +$(bin): $(obj) imago anim + $(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS) + +%.odj: %.asm + nasm -f coff -o $@ $< + +src/data.odj: src/data.asm $(bindata) + +ifneq ($(hostsys), dos) +-include $(dep) +endif + +%.odj: %.c + $(CC) $(CFLAGS) -o $@ -c $< + +%.dep: %.c + @echo dep $@ + @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.odj) >$@ + +.PHONY: imago +imago: + $(MAKE) -C libs/imago -f Makefile + +.PHONY: anim +anim: + $(MAKE) -C libs/anim -f Makefile + +.PHONY: cleanlibs +cleanlibs: + $(MAKE) -C libs/imago -f Makefile clean + $(MAKE) -C libs/anim -f Makefile clean + +.PHONY: clean +.PHONY: cleandep + +ifeq ($(hostsys), dos) +clean: + del src\*.odj + del src\dos\*.odj + del $(bin) + +cleandep: + del src\*.dep + del src\dos\*.dep +else +clean: + rm -f $(obj) $(bin) + +cleandep: + rm -f $(dep) + +.PHONY: data +data: + @tools/procdata +endif