1 # Makefile for the assembler regression tests
9 MKDIR = mkdir $(subst /,\,$1)
10 RMDIR = -rmdir /s /q $(subst /,\,$1)
11 DEL = del /f $(subst /,\,$1)
23 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
25 WORKDIR = ../../testwrk/asm
27 DIFF = $(WORKDIR)/bdiff$(EXE)
34 OPCODE_REFS := $(wildcard *-opcodes.ref)
35 OPCODE_CPUS = $(foreach ref,$(OPCODE_REFS),$(ref:%-opcodes.ref=%))
36 OPCODE_BINS = $(foreach cpu,$(OPCODE_CPUS),$(WORKDIR)/$(cpu)-opcodes.bin)
38 CPUDETECT_REFS := $(wildcard *-cpudetect.ref)
39 CPUDETECT_CPUS = $(foreach ref,$(CPUDETECT_REFS),$(ref:%-cpudetect.ref=%))
40 CPUDETECT_BINS = $(foreach cpu,$(CPUDETECT_CPUS),$(WORKDIR)/$(cpu)-cpudetect.bin)
42 all: $(OPCODE_BINS) $(CPUDETECT_BINS)
45 $(call MKDIR,$(WORKDIR))
47 $(DIFF): ../bdiff.c | $(WORKDIR)
48 $(CC) $(CFLAGS) -o $@ $<
50 define OPCODE_template
52 $(WORKDIR)/$1-opcodes.bin: $1-opcodes.s $(DIFF)
53 $(if $(QUIET),echo asm/$1-opcodes.bin)
54 $(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-opcodes.lst -o $$@ $$<
55 $(DIFF) $$@ $1-opcodes.ref
57 endef # OPCODE_template
59 $(foreach cpu,$(OPCODE_CPUS),$(eval $(call OPCODE_template,$(cpu))))
61 define CPUDETECT_template
63 $(WORKDIR)/$1-cpudetect.bin: cpudetect.s $(DIFF)
64 $(if $(QUIET),echo asm/$1-cpudetect.bin)
65 $(CL65) --cpu $1 -t none -l $(WORKDIR)/$1-cpudetect.lst -o $$@ $$<
66 $(DIFF) $$@ $1-cpudetect.ref
68 endef # CPUDETECT_template
70 $(foreach cpu,$(CPUDETECT_CPUS),$(eval $(call CPUDETECT_template,$(cpu))))
73 @$(call RMDIR,$(WORKDIR))
74 @$(call DEL,$(OPCODE_REFS:.ref=.o) cpudetect.o)