src = $(wildcard src/*.c) obj = $(src:.c=.o) dep = $(obj:.o=.d) ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) hostsys = dos else hostsys = unix TOOLPREFIX = i586-pc-msdosdjgpp- endif bin = auplay.exe warn = -pedantic -Wall opt = -march=pentium -O0 dbg = -g def = -DLITTLEENDIAN incpath = -Isrc AS = nasm CC = $(TOOLPREFIX)gcc ASFLAGS = -f coff CFLAGS = $(dbg) $(opt) $(def) $(incpath) LDFLAGS = -Wl,-Map=ld.map LD = wlink $(bin): $(obj) $(CC) -o $@ $(obj) $(LDFLAGS) -include $(dep) %.o: %.asm $(AS) $(ASFLAGS) -o $@ $< %.d: %.c @echo depfile $@ @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ .PHONY: clean .PHONY: cleandep ifeq ($(hostsys), dos) clean: del src\*.o del $(bin) cleandep: del src\*.d else clean: rm -f $(obj) $(bin) cleandep: rm -f $(dep) endif