X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=Makefile;h=f3630fa7b4769abf89066ca9dede435be9010a36;hp=810d2ca73bfbc8ffbd14de5fb019a5bb11fa545a;hb=68f89fa06ae5cfacde9cf8310e97220e5fc05260;hpb=695b69a4c4acbaee28d99851d711c00b2468e280 diff --git a/Makefile b/Makefile index 810d2ca..f3630fa 100644 --- a/Makefile +++ b/Makefile @@ -1,58 +1,85 @@ -baseobj = main.obj -demoobj = demo.obj screen.obj gfxutil.obj 3dgfx.obj polyfill.obj -scrobj = tunnel.obj fract.obj grise.obj polytest.obj plasma.obj -sysobj = gfx.obj vbe.obj dpmi.obj timer.obj keyb.obj mouse.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 +asmsrc += cspr/dbgfont.asm cspr/confont.asm -def = -dM_PI=3.141592653589793 -opt = -5 -fp5 -otexan -oh -oi -ei -dbg = -d1 +ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) + hostsys = dos +else + hostsys = unix + TOOLPREFIX = i586-pc-msdosdjgpp- +endif -!ifdef __UNIX__ -incpath = -Isrc -Isrc/dos -Ilibs/imago/src -libpath = libs/imago -!else -incpath = -Isrc -Isrc\dos -Ilibs\imago\src -libpath = libs\imago -!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 -AS = nasm -CC = wcc386 -CXX = wpp386 -ASFLAGS = -fobj -CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos $(incpath) -CXXFLAGS = $(CFLAGS) -LDFLAGS = libpath $(libpath) library { $(libs) } -LD = wlink +CC = $(TOOLPREFIX)gcc +AR = $(TOOLPREFIX)ar +CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(prof) $(inc) $(def) +LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja -$(bin): cflags.occ $(obj) libs/imago/imago.lib - %write objects.lnk $(obj) - $(LD) debug all name $@ system dos4g file { @objects } $(LDFLAGS) +ifneq ($(hostsys), dos) +.PHONY: all +all: data $(bin) +endif -.c: src;src/dos -.cc: src;src/dos -.asm: src;src/dos +$(bin): $(obj) imago anim + $(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS) -cflags.occ: Makefile - %write $@ $(CFLAGS) +%.odj: %.asm + nasm -f coff -o $@ $< -cxxflags.occ: Makefile - %write $@ $(CXXFLAGS) +ifneq ($(hostsys), dos) +-include $(dep) +endif -.c.obj: .autodepend - $(CC) -fo=$@ @cflags.occ $[* +%.odj: %.c + $(CC) $(CFLAGS) -o $@ -c $< -.cc.obj: .autodepend - $(CXX) -fo=$@ @cxxflags.occ $[* +%.dep: %.c + @echo dep $@ + @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.odj) >$@ -.asm.obj: - $(AS) $(ASFLAGS) -o $@ $[*.asm +.PHONY: imago +imago: + $(MAKE) -C libs/imago -f Makefile -clean: .symbolic - del *.obj - del *.occ - del *.lnk +.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