2017-03-19 16:48:12 +00:00
|
|
|
# Makefile for the assembler regression tests
|
2016-09-03 14:45:59 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
ifneq ($(shell echo),)
|
|
|
|
CMD_EXE = 1
|
|
|
|
endif
|
2016-09-03 14:45:59 +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-03 14:45:59 +00:00
|
|
|
|
2017-03-20 10:22:04 +00:00
|
|
|
ifdef QUIET
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
2020-08-26 18:37:28 +00:00
|
|
|
CA65 := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65)
|
|
|
|
LD65 := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
|
2016-09-03 14:45:59 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
WORKDIR = ../../testwrk/asm
|
2016-09-03 14:45:59 +00:00
|
|
|
|
2020-11-17 18:34:22 +00:00
|
|
|
ISEQUAL = ../../testwrk/isequal$(EXE)
|
2016-09-03 14:45:59 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
CC = gcc
|
|
|
|
CFLAGS = -O2
|
2016-09-03 14:45:59 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
.PHONY: all clean
|
2016-09-07 17:21:24 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
OPCODE_REFS := $(wildcard *-opcodes.ref)
|
2020-11-17 18:34:22 +00:00
|
|
|
OPCODE_BINS = $(OPCODE_REFS:%.ref=$(WORKDIR)/%.bin)
|
|
|
|
OPCODE_CPUS = $(OPCODE_REFS:%-opcodes.ref=%)
|
2016-09-07 17:21:24 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
CPUDETECT_REFS := $(wildcard *-cpudetect.ref)
|
2020-11-17 18:34:22 +00:00
|
|
|
CPUDETECT_BINS = $(CPUDETECT_REFS:%.ref=$(WORKDIR)/%.bin)
|
|
|
|
CPUDETECT_CPUS = $(CPUDETECT_REFS:%-cpudetect.ref=%)
|
2016-09-07 17:21:24 +00:00
|
|
|
|
2020-10-03 12:55:30 +00:00
|
|
|
all: $(OPCODE_BINS) $(CPUDETECT_BINS) $(WORKDIR)/paramcount.o
|
2016-09-03 14:45:59 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
$(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 $@ $<
|
|
|
|
|
|
|
|
define OPCODE_template
|
|
|
|
|
2020-08-26 18:37:28 +00:00
|
|
|
$(WORKDIR)/$1-opcodes.bin: $1-opcodes.s $(ISEQUAL)
|
2017-03-20 10:22:04 +00:00
|
|
|
$(if $(QUIET),echo asm/$1-opcodes.bin)
|
2020-11-17 18:34:22 +00:00
|
|
|
$(CA65) -t none --cpu $1 -l $$(@:.bin=.lst) -o $$(@:.bin=.o) $$<
|
|
|
|
$(LD65) -t none -o $$@ $$(@:.bin=.o) none.lib
|
|
|
|
$(ISEQUAL) $1-opcodes.ref $$@
|
2017-03-19 16:48:12 +00:00
|
|
|
|
|
|
|
endef # OPCODE_template
|
|
|
|
|
|
|
|
$(foreach cpu,$(OPCODE_CPUS),$(eval $(call OPCODE_template,$(cpu))))
|
|
|
|
|
|
|
|
define CPUDETECT_template
|
|
|
|
|
2020-11-17 20:06:05 +00:00
|
|
|
$(WORKDIR)/$1-cpudetect.bin: cpudetect.s $1-cpudetect.ref $(ISEQUAL)
|
2017-03-20 10:22:04 +00:00
|
|
|
$(if $(QUIET),echo asm/$1-cpudetect.bin)
|
2020-11-17 18:34:22 +00:00
|
|
|
$(CA65) -t none --cpu $1 -l $$(@:.bin=.lst) -o $$(@:.bin=.o) $$<
|
|
|
|
$(LD65) -t none -o $$@ $$(@:.bin=.o) none.lib
|
|
|
|
$(ISEQUAL) $1-cpudetect.ref $$@
|
2017-03-19 16:48:12 +00:00
|
|
|
|
|
|
|
endef # CPUDETECT_template
|
|
|
|
|
|
|
|
$(foreach cpu,$(CPUDETECT_CPUS),$(eval $(call CPUDETECT_template,$(cpu))))
|
|
|
|
|
2020-10-03 12:55:30 +00:00
|
|
|
$(WORKDIR)/%.o: %.s | $(WORKDIR)
|
2020-11-17 18:34:22 +00:00
|
|
|
$(CA65) -l $(@:.o=.lst) -o $@ $<
|
2020-09-29 17:03:42 +00:00
|
|
|
|
2017-03-19 16:48:12 +00:00
|
|
|
clean:
|
|
|
|
@$(call RMDIR,$(WORKDIR))
|