X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=Makefile;h=54e4148188726d625cb54e65b3bf925ff6d1c688;hp=3503834de2a73e6ab26f83e603ebb96003814d12;hb=7cffbf057545fb303ad8f53e432ef42f7708e16d;hpb=633743214adddf6ec20f8b1bee1782e6966023af diff --git a/Makefile b/Makefile index 3503834..54e4148 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,88 @@ -baseobj = main.obj -demoobj = demo.obj screen.obj gfxutil.obj -scrobj = tunnel.obj fract.obj grise.obj -sysobj = gfx.obj vbe.obj dpmi.obj timer.obj keyb.obj mouse.obj logger.obj -obj = $(baseobj) $(demoobj) $(sysobj) +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 +bindata = data/loading.img -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) -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): $(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) -.c.obj: .autodepend - $(CC) -fo=$@ $(CFLAGS) $[* +%.odj: %.asm + nasm -f coff -o $@ $< -.cc.obj: .autodepend - $(CXX) -fo=$@ $(CXXFLAGS) $[* +src/data.odj: src/data.asm $(bindata) -.asm.obj: - $(AS) $(ASFLAGS) -o $@ $[*.asm +ifneq ($(hostsys), dos) +-include $(dep) +endif -clean: .symbolic - del *.obj +%.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