removed clang-format and clang_complete files from the repo
[dosdemo] / Makefile.dj
index 4b3f7a7..59d4042 100644 (file)
@@ -1,8 +1,13 @@
-src = $(wildcard src/*.c) $(wildcard src/dos/*.c)
-obj = $(src:.c=.cof)
-dep = $(obj:.cof=.dep)
+src = $(wildcard src/*.c) $(wildcard src/3dgfx/*.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 = $(src:.c=.d)
 bin = demo.exe
 
+asmsrc += cspr/dbgfont.asm cspr/confont.asm
+bindata = data/loading.img
+
 ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM)
        hostsys = dos
 else
@@ -10,55 +15,82 @@ else
        TOOLPREFIX = i586-pc-msdosdjgpp-
 endif
 
-inc = -Isrc -Isrc/dos -Ilibs/imago/src -Ilibs/oldmik/src
-opt = -O3 -ffast-math
-dbg = -g
+inc = -Isrc -Isrc/3dgfx -Isrc/scr -Isrc/dos -Ilibs \
+         -Ilibs/imago/src -Ilibs/anim/src -Ilibs/midas
+opt = -O3 -ffast-math -fno-strict-aliasing
+warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable
+
+ifdef RELEASE
+       dbg = -g
+       def = -DNDEBUG -DNO_SOUND
+else
+       def = -DNO_SOUND
+endif
+#prof = -pg
 
 CC = $(TOOLPREFIX)gcc
 AR = $(TOOLPREFIX)ar
-CFLAGS = -pedantic -Wall -march=pentium $(dbg) $(opt) $(inc)
-LDFLAGS = libs/imago/imago.dja libs/oldmik/mikmod.dja
+CFLAGS = -march=pentium $(warn) -MMD $(dbg) $(opt) $(prof) $(inc) $(def)
+LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja
+#libs/midas/libmidas.a
+
+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)
+
+%.odj: %.asm
+       nasm -f coff -o $@ $<
+
+src/data.odj: src/data.asm $(bindata)
 
 -include $(dep)
 
-%.cof: %.c
+%.odj: %.c
        $(CC) $(CFLAGS) -o $@ -c $<
 
-%.dep: %.c
-       @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.cof) >$@
-
 .PHONY: imago
 imago:
        $(MAKE) -C libs/imago -f Makefile.dj
 
-.PHONY: mikmod
-mikmod:
-       $(MAKE) -C libs/oldmik -f Makefile.dj
+.PHONY: anim
+anim:
+       $(MAKE) -C libs/anim -f Makefile.dj
 
 .PHONY: cleanlibs
 cleanlibs:
-       $(MAKE) -C libs/imago -f Makefile.dj clean
-       $(MAKE) -C libs/oldmik -f Makefile.dj clean
+       $(MAKE) -C libs/imago clean -f Makefile.dj
+       $(MAKE) -C libs/anim clean -f Makefile.dj
 
 .PHONY: clean
 .PHONY: cleandep
 
 ifeq ($(hostsys), dos)
 clean:
-       del src\*.cof
-       del src\dos\*.cof
+       del src\*.odj
+       del src\3dgfx\*.odj
+       del src\dos\*.odj
        del $(bin)
 
 cleandep:
-       del src\*.dep
-       del src\dos\*.dep
+       del src\*.d
+       del src\3dgfx\*.d
+       del src\dos\*.d
 else
 clean:
        rm -f $(obj) $(bin)
 
 cleandep:
        rm -f $(dep)
+
+.PHONY: data
+data:
+       @tools/procdata
 endif
+
+.PHONY: strip
+strip: $(bin)
+       $(TOOLPREFIX)strip $(bin)