X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=Makefile.dj;h=12b2084e294270c20c10a84eee491958b6782e44;hb=7bd77c4461410f29819d6eee3d42d2793047ea66;hp=fc591993686e45dd14d5d78794ebd5690caa0d1c;hpb=f35702a2d363b2f129796f2464fbe552edf393c2;p=retrobench diff --git a/Makefile.dj b/Makefile.dj index fc59199..12b2084 100644 --- a/Makefile.dj +++ b/Makefile.dj @@ -1,10 +1,22 @@ src = $(wildcard src/*.c) $(wildcard src/dos/*.c) -ssrc = sinlut.s -obj = $(src:.c=.o) $(ssrc:.s=.o) +ssrc = $(wildcard src/*.s) sinlut.s +obj = $(src:.c=.odj) $(ssrc:.s=.odj) dep = $(src:.c=.d) -bin = rbench.exe +coff = rbench +bin = $(coff).exe +bin0 = $(coff)0.exe -LUTGEN = tools/lutgen.exe +ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) + host = dos + LUTGEN = tools/lutgen.exe +else + host = unix + TC = i586-pc-msdosdjgpp- + LUTGEN = tools/lutgen +endif + +CC = $(TC)gcc +AS = $(TC)as warn = -pedantic -Wall -Wno-deprecated-declarations dbg = -g @@ -12,22 +24,34 @@ opt = -O3 -ffast-math inc = -Isrc def = -DNO_STDINT_H -CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(def) $(inc) -MMD +CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(def) $(inc) -fno-strict-aliasing -MMD +LDFLAGS = -Wl,-Map=link.map $(bin): $(obj) $(CC) -o $@ $(obj) $(LDFLAGS) +$(bin0): $(bin) + exe2coff $< + copy /b \djgpp\bin\cwsdstr0.exe+$(coff) $@ + sinlut.s: $(LUTGEN) $(LUTGEN) >$@ -include $(dep) -include *.d +%.odj: %.c + $(CC) -o $@ $(CFLAGS) -c $< + +%.odj: %.s + $(AS) -o $@ $(ASFLAGS) $< + +ifeq ($(host), dos) .PHONY: clean clean: - del src\*.o - del src\dos\*.o - del *.o + del src\*.odj + del src\dos\*.odj + del *.odj del $(bin) del sinlut.s @@ -36,6 +60,16 @@ cleandep: del src\*.d del src\dos\*.d del *.d +else +.PHONY: clean +clean: + rm -f $(obj) $(bin) + +.PHONY: clean +cleandep: + rm -f $(dep) +endif + . $(LUTGEN): tools/lutgen.c - $(CC) -o $@ $< -lm + cc -o $@ $< -lm