1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-20 12:32:58 +00:00
cc65/test/dasm/Makefile
Oliver Schmidt c658acbf85 Avoid cl65 in tests.
cl65 creates intermediate files based on the source file name in the source file directory. Calling cl65 in parallel with the same source file causes those intermediate files to get overwritten.

Fixes #1080
2020-08-26 20:39:34 +02:00

67 lines
1.3 KiB
Makefile

# Makefile for the disassembler regression tests
ifneq ($(shell echo),)
CMD_EXE = 1
endif
ifdef CMD_EXE
EXE = .exe
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
else
EXE =
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif
ifdef QUIET
.SILENT:
endif
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
DA65 := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65)
WORKDIR = ../../testwrk/dasm
ISEQUAL = $(WORKDIR)/isequal$(EXE)
CC = gcc
CFLAGS = -O2
START = --start-addr 0x8000
.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
all: $(BINS)
$(WORKDIR):
$(call MKDIR,$(WORKDIR))
$(ISEQUAL): ../isequal.c | $(WORKDIR)
$(CC) $(CFLAGS) -o $@ $<
define DISASS_template
$(WORKDIR)/$1-disass.bin: $1-disass.s | $(WORKDIR)
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
$(WORKDIR)/$1-reass.s: $(WORKDIR)/$1-disass.bin
$(DA65) --cpu $1 $(START) -o $$@ $$<
$(WORKDIR)/$1-reass.bin: $(WORKDIR)/$1-reass.s $(ISEQUAL)
$(if $(QUIET),echo dasm/$1-reass.bin)
$(CL65) --cpu $1 -t none $(START) -o $$@ $$<
$(ISEQUAL) $$@ $(WORKDIR)/$1-disass.bin
endef # DISASS_template
$(foreach cpu,$(CPUS),$(eval $(call DISASS_template,$(cpu))))
clean:
@$(call RMDIR,$(WORKDIR))