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) bin = demo.exe ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) hostsys = dos else hostsys = unix TOOLPREFIX = i586-pc-msdosdjgpp- endif inc = -Isrc -Isrc/dos -Ilibs/imago/src -Ilibs/mikmod/include opt = -O3 -ffast-math -fno-strict-aliasing dbg = -g warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable CC = $(TOOLPREFIX)gcc AR = $(TOOLPREFIX)ar CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(inc) LDFLAGS = libs/imago/imago.dja libs/mikmod/dos/libmikmod.a $(bin): $(obj) imago mikmod $(CC) -o $@ -Wl,-Map=ld.map $(obj) $(LDFLAGS) %.cof: %.asm nasm -f coff -o $@ $< -include $(dep) %.cof: %.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/mikmod/dos -f Makefile.dj .PHONY: cleanlibs cleanlibs: $(MAKE) -C libs/imago -f Makefile.dj clean $(MAKE) -C libs/mikmod/dos -f Makefile.dj clean .PHONY: clean .PHONY: cleandep ifeq ($(hostsys), dos) clean: del src\*.cof del src\dos\*.cof del $(bin) cleandep: del src\*.dep del src\dos\*.dep else clean: rm -f $(obj) $(bin) cleandep: rm -f $(dep) endif