1 # Makefile for the disassembler 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)
24 DA65 := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65)
26 WORKDIR = ../../testwrk/dasm
28 DIFF = $(WORKDIR)/bdiff$(EXE)
33 START = --start-addr 0x8000
37 SOURCES := $(wildcard *.s)
38 CPUS = $(foreach src,$(SOURCES),$(src:%-disass.s=%))
39 BINS = $(foreach cpu,$(CPUS),$(WORKDIR)/$(cpu)-reass.bin)
41 # default target defined later
45 $(call MKDIR,$(WORKDIR))
47 $(DIFF): ../bdiff.c | $(WORKDIR)
48 $(CC) $(CFLAGS) -o $@ $<
50 define DISASS_template
52 $(WORKDIR)/$1-disass.bin: $1-disass.s | $(WORKDIR)
53 $(CL65) --cpu $1 -t none $(START) -o $$@ $$<
55 $(WORKDIR)/$1-reass.s: $(WORKDIR)/$1-disass.bin
56 $(DA65) --cpu $1 $(START) -o $$@ $$<
58 $(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(DIFF)
59 $(if $(QUIET),echo dasm/$1-reass.bin)
60 $(CL65) --cpu $1 -t none $(START) -o $$@ $$<
61 $(DIFF) $$@ $(WORKDIR)/$1-disass.bin
63 endef # DISASS_template
65 $(foreach cpu,$(CPUS),$(eval $(call DISASS_template,$(cpu))))
68 @$(call RMDIR,$(WORKDIR))
69 @$(call DEL,$(SOURCES:.s=.o))