1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-03 10:07:02 +00:00
cc65/test/dasm/Makefile

70 lines
1.4 KiB
Makefile
Raw Normal View History

2017-03-19 16:48:12 +00:00
# Makefile for the disassembler regression tests
2017-03-19 16:48:12 +00:00
ifneq ($(shell echo),)
CMD_EXE = 1
endif
2017-03-19 16:48:12 +00:00
ifdef CMD_EXE
EXE = .exe
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
else
EXE =
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
endif
ifdef QUIET
.SILENT:
endif
2017-03-19 16:48:12 +00:00
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
DA65 := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65)
WORKDIR = ../../testwrk/dasm
DIFF = $(WORKDIR)/bdiff$(EXE)
CC = gcc
CFLAGS = -O2
START = --start-addr 0x8000
2017-03-19 16:48:12 +00:00
.PHONY: all clean
SOURCES := $(wildcard *.s)
CPUS = $(foreach src,$(SOURCES),$(src:%-disass.s=%))
BINS = $(foreach cpu,$(CPUS),$(WORKDIR)/$(cpu)-reass.bin)
# default target defined later
2017-03-19 16:48:12 +00:00
all: $(BINS)
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(DIFF): ../bdiff.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
2017-03-19 16:48:12 +00:00
define DISASS_template
2017-03-19 16:48:12 +00:00
$(WORKDIR)/$1-disass.bin: $1-disass.s | $(WORKDIR)
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
2017-03-19 16:48:12 +00:00
$(WORKDIR)/$1-reass.s: $(WORKDIR)/$1-disass.bin
$(DA65) --cpu $1 $(START) -o $$@ $$<
2017-03-19 16:48:12 +00:00
$(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(DIFF)
$(if $(QUIET),echo dasm/$1-reass.bin)
2017-03-19 16:48:12 +00:00
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
$(DIFF) $$@ $(WORKDIR)/$1-disass.bin
2017-03-19 16:48:12 +00:00
endef # DISASS_template
2017-03-19 16:48:12 +00:00
$(foreach cpu,$(CPUS),$(eval $(call DISASS_template,$(cpu))))
2017-03-19 16:48:12 +00:00
clean:
@$(call RMDIR,$(WORKDIR))
@$(call DEL,$(SOURCES:.s=.o))