2017-03-19 16:48:12 +00:00
|
|
|
# Makefile for the disassembler regression tests
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
ifneq ($(shell echo),)
|
|
|
|
CMD_EXE = 1
|
|
|
|
endif
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
ifdef CMD_EXE
|
|
|
|
EXE = .exe
|
|
|
|
MKDIR = mkdir $(subst /,\,$1)
|
2020-11-17 18:34:22 +00:00
|
|
|
RMDIR = -rmdir /q /s $(subst /,\,$1)
|
2017-03-19 16:48:12 +00:00
|
|
|
else
|
|
|
|
EXE =
|
|
|
|
MKDIR = mkdir -p $1
|
|
|
|
RMDIR = $(RM) -r $1
|
|
|
|
endif
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-20 10:22:04 +00:00
|
|
|
ifdef QUIET
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
2022-10-17 09:50:59 +00:00
|
|
|
CA65 := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65)
|
|
|
|
LD65 := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
|
2017-03-19 16:48:12 +00:00
|
|
|
DA65 := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65)
|
|
|
|
|
|
|
|
WORKDIR = ../../testwrk/dasm
|
|
|
|
|
2020-11-17 18:34:22 +00:00
|
|
|
ISEQUAL = ../../testwrk/isequal$(EXE)
|
2017-03-19 16:48:12 +00:00
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
CFLAGS = -O2
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2023-02-19 14:30:07 +00:00
|
|
|
START = --start-addr 0x7000
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
.PHONY: all clean
|
|
|
|
|
|
|
|
SOURCES := $(wildcard *.s)
|
2022-10-17 09:50:59 +00:00
|
|
|
BINS = $(SOURCES:%disass.s=$(WORKDIR)/%reass.bin) $(WORKDIR)/65816-reass.bin
|
2020-11-17 18:34:22 +00:00
|
|
|
CPUS = $(SOURCES:%-disass.s=%)
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
all: $(BINS)
|
|
|
|
|
|
|
|
$(WORKDIR):
|
|
|
|
$(call MKDIR,$(WORKDIR))
|
|
|
|
|
2020-08-26 18:37:28 +00:00
|
|
|
$(ISEQUAL): ../isequal.c | $(WORKDIR)
|
2017-03-19 16:48:12 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
define DISASS_template
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
$(WORKDIR)/$1-disass.bin: $1-disass.s | $(WORKDIR)
|
|
|
|
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
$(WORKDIR)/$1-reass.s: $(WORKDIR)/$1-disass.bin
|
|
|
|
$(DA65) --cpu $1 $(START) -o $$@ $$<
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2020-08-26 18:37:28 +00:00
|
|
|
$(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(ISEQUAL)
|
2017-03-20 10:22:04 +00:00
|
|
|
$(if $(QUIET),echo dasm/$1-reass.bin)
|
2017-03-19 16:48:12 +00:00
|
|
|
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
|
2020-11-17 18:34:22 +00:00
|
|
|
$(ISEQUAL) $(WORKDIR)/$1-disass.bin $$@
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
endef # DISASS_template
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
$(foreach cpu,$(CPUS),$(eval $(call DISASS_template,$(cpu))))
|
2016-09-20 15:37:10 +00:00
|
|
|
|
2022-10-17 09:50:59 +00:00
|
|
|
$(WORKDIR)/test65816.bin: test65816.s | $(WORKDIR)
|
|
|
|
$(CA65) -o $(WORKDIR)/test65816.o $<
|
|
|
|
$(LD65) -o $@ -C 65816.cfg $(WORKDIR)/test65816.o
|
|
|
|
|
|
|
|
$(WORKDIR)/65816-reass.s: $(WORKDIR)/test65816.bin
|
|
|
|
$(DA65) --cpu 65816 -i 65816.info -o $@ $<
|
|
|
|
|
|
|
|
$(WORKDIR)/65816-reass.bin: $(WORKDIR)/65816-reass.s $(ISEQUAL)
|
|
|
|
$(if $(QUIET),echo dasm/65816-reass.bin)
|
|
|
|
$(CA65) -o $(WORKDIR)/65816-reass.o $<
|
|
|
|
$(LD65) -o $@ -C 65816.cfg $(WORKDIR)/65816-reass.o
|
|
|
|
$(ISEQUAL) --binary $(WORKDIR)/test65816.bin $@
|
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
clean:
|
|
|
|
@$(call RMDIR,$(WORKDIR))
|