porting the demo to miniglut
[dosdemo] / Makefile.dj
index 575308c..e249553 100644 (file)
@@ -1,9 +1,12 @@
-src = $(wildcard src/*.c) $(wildcard src/dos/*.c)
-asmsrc = $(wildcard src/*.asm) $(wildcard src/dos/*.asm)
-obj = $(src:.c=.cof) $(asmsrc:.asm=.cof)
-dep = $(obj:.cof=.dep)
+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
 
+asmsrc += cspr/dbgfont.asm cspr/confont.asm
+bindata = data/loading.img
+
 ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM)
        hostsys = dos
 else
@@ -11,49 +14,67 @@ else
        TOOLPREFIX = i586-pc-msdosdjgpp-
 endif
 
-inc = -Isrc -Isrc/dos -Ilibs/imago/src -Ilibs/mikmod/include
-opt = -O3 -ffast-math
-dbg = -g
+inc = -Isrc -Isrc/scr -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src
+opt = -O3 -ffast-math -fno-strict-aliasing
+warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable
+
+ifdef RELEASE
+       dbg = -g
+       def = -DNDEBUG -DNO_MUSIC
+else
+       def = -DNO_MUSIC
+endif
+#prof = -pg
 
 CC = $(TOOLPREFIX)gcc
 AR = $(TOOLPREFIX)ar
-CFLAGS = -pedantic -Wall -march=pentium $(dbg) $(opt) $(inc)
-LDFLAGS = libs/imago/imago.dja libs/mikmod/dos/libmikmod.a
+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 mikmod
-       $(CC) -o $@ -Wl,-Map=ld.map $(obj) $(LDFLAGS)
+$(bin): $(obj) imago anim
+       $(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS)
 
-%.cof: %.asm
+%.odj: %.asm
        nasm -f coff -o $@ $<
 
+src/data.odj: src/data.asm $(bindata)
+
+ifneq ($(hostsys), dos)
 -include $(dep)
+endif
 
-%.cof: %.c
+%.odj: %.c
        $(CC) $(CFLAGS) -o $@ -c $<
 
 %.dep: %.c
-       @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.cof) >$@
+       @echo dep $@
+       @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.odj) >$@
 
 .PHONY: imago
 imago:
-       $(MAKE) -C libs/imago -f Makefile.dj
+       $(MAKE) -C libs/imago -f Makefile
 
-.PHONY: mikmod
-mikmod:
-       $(MAKE) -C libs/mikmod/dos -f Makefile.dj
+.PHONY: anim
+anim:
+       $(MAKE) -C libs/anim -f Makefile
 
 .PHONY: cleanlibs
 cleanlibs:
-       $(MAKE) -C libs/imago -f Makefile.dj clean
-       $(MAKE) -C libs/mikmod/dos -f Makefile.dj clean
+       $(MAKE) -C libs/imago -f Makefile clean
+       $(MAKE) -C libs/anim -f Makefile clean
 
 .PHONY: clean
 .PHONY: cleandep
 
 ifeq ($(hostsys), dos)
 clean:
-       del src\*.cof
-       del src\dos\*.cof
+       del src\*.odj
+       del src\dos\*.odj
        del $(bin)
 
 cleandep:
@@ -65,4 +86,12 @@ clean:
 
 cleandep:
        rm -f $(dep)
+
+.PHONY: data
+data:
+       @tools/procdata
 endif
+
+.PHONY: strip
+strip: $(bin)
+       $(TOOLPREFIX)strip $(bin)