]> git.sur5r.net Git - cc65/blobdiff - test/ref/Makefile
Made test Makefiles work with CMD.EXE
[cc65] / test / ref / Makefile
index dbe0b0f75dde729154c3963fbf17c2db5ba6425f..4d67350997d154379cc6d03bf6a95f520eed3cd9 100644 (file)
@@ -6,22 +6,24 @@ ifneq ($(shell echo),)
   CMD_EXE := 1
 endif
 
-CC65FLAGS := -t sim6502
-SIM65FLAGS := -x 200000000
-
-CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
-SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
-
 ifdef CMD_EXE
-RM := del /f
+  S := $(subst /,\,/)
+  RM = del /f $(subst /,\,$1)
 else
-RM := rm -f
+  S := /
+  RM = $(RM) $1
 endif
 
-WORKDIR := ../../testwrk
+CC65FLAGS := -t sim6502
+SIM65FLAGS := -x 200000000
+
+CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
+SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
 
+WORKDIR := ..$S..$Stestwrk
 DIFF := $(WORKDIR)/bdiff
 
+CC := gcc
 CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
 
 .PHONY: all clean
@@ -34,7 +36,7 @@ all: $(REFS) $(TESTS)
 
 $(WORKDIR)/%.ref: %.c
        $(CC) $(CFLAGS) $< -o $(WORKDIR)/$*.host
-       $(WORKDIR)/$*.host > $@
+       $(WORKDIR)$S$*.host > $@
 
 # Some files have "K & R"-style syntax.  Therefore, some forward
 # function-declarations don't match the later function definitions.
@@ -91,8 +93,8 @@ $(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref
        $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
 
 clean:
-       @$(RM) $(TESTS)
-       @$(RM) $(SOURCES:.c=.o)
-       @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out)
-       @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.ref)
-       @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.host)
+       -@$(call RM,$(TESTS))
+       -@$(call RM,$(SOURCES:.c=.o))
+       -@$(call RM,$(SOURCES:%.c=$(WORKDIR)/%.out))
+       -@$(call RM,$(SOURCES:%.c=$(WORKDIR)/%.ref))
+       -@$(call RM,$(SOURCES:%.c=$(WORKDIR)/%.host))