forked from dominicbeesley/beeb6809
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.defs.bak
66 lines (60 loc) · 2.81 KB
/
Makefile.defs.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.PHONY: all clean
MLCa:=$(words $(MAKEFILE_LIST))
MLCb:=$(shell echo "$(MLCa) - 1" | bc)
CALLER_MAKE=$(realpath $(lastword $(wordlist 1,$(MLCb),$(MAKEFILE_LIST))))
AS=asm6809 -R
TOP:=$(realpath $(dir $(lastword $(MAKEFILE_LIST))))
INC:=$(TOP)/includes
OSDEPS:=$(INC)/hardware.inc $(INC)/mosrom.inc $(INC)/common.inc $(INC)/noice.inc
SCRIPTS:=$(TOP)/scripts
RELDIR:=$(shell realpath --relative-to=$(TOP) $(shell dirname $(CALLER_MAKE)))
BEEBOUT=$(TOP)/BEEB/$(RELDIR)
CHIPKITOUT=$(TOP)/CHIPKIT/$(RELDIR)
FLEXOUT=$(TOP)/FLEX/$(RELDIR)
MATCHBOXOUT=$(TOP)/MATCHBOX/$(RELDIR)
TARGETS_BEEB_PRE=$(addprefix $(BEEBOUT)/,$(TARGETS) $(TARGETS_BEEB))
TARGETS_CHIPKIT_PRE=$(addprefix $(CHIPKITOUT)/,$(TARGETS) $(TARGETS_CHIPKIT))
TARGETS_FLEX_PRE=$(addprefix $(FLEXOUT)/,$(TARGETS_FLEX))
TARGETS_MATCHBOX_PRE=$(addprefix $(MATCHBOXOUT)/,$(TARGETS_MATCHBOX))
$(CHIPKITOUT)/%.hex: %.asm $(DEPS)
$(AS) $(ASFLAGS) --define MACH_CHIPKIT=1 -S -o $@ -l $(basename $@).lst $<
perl $(SCRIPTS)/getsymbols.pl <$(basename $@).lst >$(basename $@).sym
$(BEEBOUT)/%.hex: %.asm $(DEPS)
$(AS) $(ASFLAGS) --define MACH_BEEB=1 -S -o $@ -l $(basename $@).lst $<
perl $(SCRIPTS)/getsymbols.pl <$(basename $@).lst >$(basename $@).sym
$(MATCHBOXOUT)/%.hex: %.asm $(DEPS)
$(AS) $(ASFLAGS) --define MACH_MATCHBOX=1 -S -o $@ -l $(basename $@).lst $<
perl $(SCRIPTS)/getsymbols.pl <$(basename $@).lst >$(basename $@).sym
$(FLEXOUT)/%.hex: %.asm $(DEPS)
$(AS) $(ASFLAGS) --define MACH_FLEX=1 -S -o $@ -l $(basename $@).lst $<
perl $(SCRIPTS)/getsymbols.pl <$(basename $@).lst >$(basename $@).sym
$(CHIPKITOUT)/%.bin: %.asm $(DEPS)
$(AS) $(ASFLAGS) --define MACH_CHIPKIT=1 -o $@ -l $(basename $@).lst $<
perl $(SCRIPTS)/getsymbols.pl <$(basename $@).lst >$(basename $@).sym
$(BEEBOUT)/%.bin: %.asm $(DEPS)
$(AS) $(ASFLAGS) --define MACH_BEEB=1 -o $@ -l $(basename $@).lst $<
perl $(SCRIPTS)/getsymbols.pl <$(basename $@).lst >$(basename $@).sym
$(MATCHBOXOUT)/%.bin: %.asm $(DEPS)
$(AS) $(ASFLAGS) --define MACH_MATCHBOX=1 -o $@ -l $(basename $@).lst $<
perl $(SCRIPTS)/getsymbols.pl <$(basename $@).lst >$(basename $@).sym
all: all_beeb all_chipkit all_matchbox all_flex
all_chipkit: dirs_chipkit $(TARGETS_CHIPKIT_PRE) $(TARGETS_EXTRA) $(TARGETS_EXTRA_CHIPKIT)
all_beeb: dirs_beeb $(TARGETS_BEEB_PRE) $(TARGETS_EXTRA) $(TARGETS_EXTRA_BEEB)
all_matchbox: dirs_matchbox $(TARGETS_MATCHBOX_PRE)
all_flex: dirs_flex $(TARGETS_FLEX_PRE)
dirs_chipkit:
mkdir -p $(CHIPKITOUT)
dirs_beeb:
mkdir -p $(BEEBOUT)
dirs_matchbox:
mkdir -p $(MATCHBOXOUT)
dirs_flex:
mkdir -p $(FLEXOUT)
clean:
$(foreach cln,$(TARGETS_CHIPKIT_PRE) $(TARGETS_BEEB_PRE) $(TARGETS_MATCHBOX_PRE) $(TARGETS_FLEX_PRE), \
rm -f $(basename $(cln)).bin $(basename $(cln)).lst $(basename $(cln)).sym $(basename $(cln)).hex ;\
rm -f $(cln) \
)
$(foreach cln,$(CLEAN_EXTRA), \
rm -f $(cln) \
)