endif
ifdef CMD_EXE
- RM := del /f
EXE := .exe
- MKDIR := mkdir
- RMDIR := rmdir
+ RM = del /f $(subst /,\,$1)
+ MKDIR = mkdir $(subst /,\,$1)
+ RMDIR = rmdir /s /q $(subst /,\,$1)
else
- RM := rm -f
EXE :=
- MKDIR := mkdir -p
- RMDIR := rmdir
+ RM = $(RM) $1
+ MKDIR = mkdir $1
+ RMDIR = rmdir $1
endif
WORKDIR := ../testwrk
+CC := gcc
+
.PHONY: all dotests continue mostly-clean clean
all: dotests
$(WORKDIR):
- $(MKDIR) $(WORKDIR)
+ $(call MKDIR,$(WORKDIR))
$(WORKDIR)/bdiff$(EXE): bdiff.c | $(WORKDIR)
$(CC) -O2 -o $@ $<
@$(MAKE) -C misc clean
clean: mostly-clean
- $(RM) $(WORKDIR)/bdiff$(EXE)
- $(RMDIR) $(WORKDIR)
+ -@$(call RM,$(WORKDIR)/bdiff$(EXE))
+ -$(call RMDIR,$(WORKDIR))
CMD_EXE := 1
endif
-CC65FLAGS := -t sim6502
-
-CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
-
ifdef CMD_EXE
-RM := del /f
+ NOT := - # Hack
+ RM = del /f $(subst /,\,$1)
else
-RM := rm -f
+ NOT := !
+ RM = $(RM) $1
endif
+CC65FLAGS := -t sim6502
+
+CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
+
WORKDIR := ../../testwrk
.PHONY: all clean
all: $(TESTS)
$(WORKDIR)/%.prg: %.c
- ! $(CL65) $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) $(CC65FLAGS) $< -o $@
$(WORKDIR)/%.o.prg: %.c
- ! $(CL65) -O $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) -O $(CC65FLAGS) $< -o $@
$(WORKDIR)/%.os.prg: %.c
- ! $(CL65) -Os $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) -Os $(CC65FLAGS) $< -o $@
$(WORKDIR)/%.osi.prg: %.c
- ! $(CL65) -Osi $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) -Osi $(CC65FLAGS) $< -o $@
$(WORKDIR)/%.osir.prg: %.c
- ! $(CL65) -Osir $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) -Osir $(CC65FLAGS) $< -o $@
$(WORKDIR)/%.oi.prg: %.c
- ! $(CL65) -Oi $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) -Oi $(CC65FLAGS) $< -o $@
$(WORKDIR)/%.oir.prg: %.c
- ! $(CL65) -Oir $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) -Oir $(CC65FLAGS) $< -o $@
$(WORKDIR)/%.or.prg: %.c
- ! $(CL65) -Or $(CC65FLAGS) $< -o $@
+ $(NOT) $(CL65) -Or $(CC65FLAGS) $< -o $@
clean:
- @$(RM) $(TESTS)
- @$(RM) $(SOURCES:.c=.o)
+ -@$(call RM,$(TESTS))
+ -@$(call RM,$(SOURCES:.c=.o))
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 /,\,/)
+ NOT := - # Hack
+ RM = del /f $(subst /,\,$1)
else
-RM := rm -f
+ S := /
+ NOT := !
+ 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
.PHONY: all clean
# should compile, but then hangs in an endless loop
$(WORKDIR)/endless%prg: endless.c
$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@
- ! $(SIM65) $(SIM65FLAGS) $@
+ $(NOT) $(SIM65) $(SIM65FLAGS) $@
# these need reference data that can't be generated by a host-compiled program,
# in a useful way
# -$(SIM65) $(SIM65FLAGS) $@
clean:
- @$(RM) $(TESTS)
- @$(RM) $(SOURCES:.c=.o)
- @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out)
+ -@$(call RM,$(TESTS))
+ -@$(call RM,$(SOURCES:.c=.o))
+ -@$(call RM,$(SOURCES:%.c=$(WORKDIR)/%.out))
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
$(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.
$(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))
CMD_EXE := 1
endif
+ifdef CMD_EXE
+ RM = del /f $(subst /,\,$1)
+else
+ RM = $(RM) $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
-else
-RM := rm -f
-endif
-
WORKDIR := ../../testwrk
.PHONY: all clean
$(SIM65) $(SIM65FLAGS) $@
clean:
- @$(RM) $(TESTS)
- @$(RM) $(SOURCES:.c=.o)
+ -@$(call RM,$(TESTS))
+ -@$(call RM,$(SOURCES:.c=.o))