-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (51 loc) · 1.35 KB
/
Makefile
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
LD65 = ld65 -m $(@:bin=map)
CA65 = ca65 -I include
#
# The ordering of sources matters for many reasons.
# Especially the SYSINIT and IRQCODE segments contain
# code that will run back-to-back in the order below
#
ROMSRC = src/_sysinit.a65 # MUST BE FIRST
ROMSRC += src/_systab.a65
ROMSRC += src/viab.a65
ROMSRC += src/console.a65
ROMSRC += src/memory.a65
ROMSRC += src/exec.a65
ROMSRC += src/task.a65 # MUST BE LAST w/ IRQCODE
ROMSRC += src/filesys.a65
ROMSRC += src/romfs.a65
ROMSRC += src/romvec.a65
ROMOBJ = $(ROMSRC:a65=o)
TARGETS += $(ROMOBJ)
.PHONY: depend
depend: depend.mk
.PHONE: all
all: $(TARGETS)
TARGETS += rom.srec
rom.srec: rom.bin
bin2srec -o $@ -i $<
TARGETS += rom.bin
rom.bin: $(ROMOBJ) depend.mk rom.cfg
$(LD65) -C rom.cfg -o $@ $(ROMOBJ)
TARGETS += rom.h
rom.h: rom.bin
hexdump -v -e '16/1 "0x%02x," "\n"' $< >$@
TARGETS += include/version.i65
include/version.i65: include/version.tmp
@cmp -s $@ $< || mv $< $@
_git_version = $(shell git describe --always)
TARGETS += include/version.tmp
.PHONY: include/version.tmp
include/version.tmp: include/version.in
@sed <$< >$@ s/__GIT_VERSION__/$(_git_version)/
.PHONY: clean
clean:
rm -f $(TARGETS)
TARGETS += depend.mk
depend.mk: $(ROMSRC:a65=mkdep)
cat $< > $@
TARGETS += $(ROMSRC:a65=mkdep)
%.mkdep: %.a65
$(CA65) --create-dep $@ $<
src/_sysinit.a65: include/version.i65
-include depend.mk