forked from steventroughtonsmith/rpc8e-cc65
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
97 lines (77 loc) · 1.74 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
ifdef SystemRoot
RM = del /Q
fixpath = $(subst /,\,$1)
else
RM = rm -f
fixpath = $(subst \,/.$1)
endif
export RM
CC = cl65
CFLAGS = --cpu 65816 -Osir -g -T -t none -c -Iinclude
AS = ca65
AFLAGS = --cpu 65816 --verbose -t none -g
TEST_OBJ_DIR = test
TEST_SRC_DIR = test
RP_CFG = rpc8e.cfg
RP_MAP = test.map
RP_LIB = rpc8e.lib
RP_OBJ_DIR = rpc8e
RP_SRC_DIR = rpc8e
RP_OBJS = \
conio.o \
dio.o \
write.o \
io.o \
crt0.o \
ctype.o \
mmu.o \
oserror.o
TEST_IMGS = \
test_printf.img \
test_loop.img \
test_assert.img \
test_ctype.img \
test_dio.img \
test_errno.img \
test_limits.img \
test_locale.img \
test_setjmp.img \
test_signal.img \
test_stdarg.img \
test_stddef.img
PADIMAGE_OBJS = \
padimage.o
.PHONY: all
all: upstream rpc8e.lib
.PHONY: upstream
upstream:
$(MAKE) -C upstream
rpc8e.lib: $(RP_OBJS:%.o=$(RP_OBJ_DIR)/%.o)
$(RM) $@
ar65 a $@ $^ upstream/common/*.o upstream/runtime/*.o
%.o: %.c
$(CC) $(CFLAGS) -o $@ $^
%.o: %.s
$(AS) $(AFLAGS) -o $@ $^
.PHONY: package
package: library padimage
tar --transform "s,^,cc65-rpc8_$$(svn info | grep Revision | cut -d\ -f2)/,S" -cjf cc65-rpc8_$$(svn info | grep Revision | cut -d\ -f2).tar.bz2 padimage.c padimage rpc8e.cfg rpc8e.lib
padimage: util/padimage.c
gcc -O -o $@ $^
.PHONY: test
test: all padimage $(TEST_IMGS)
%.img: $(TEST_OBJ_DIR)/%.o
ld65 -o $@ --define __STACKSIZE__="$200" -C $(RP_CFG) -m $(RP_MAP) $^ $(RP_LIB)
./padimage $@
.PHONY: clean
clean:
make -C upstream clean
$(RM) test.map $(TEST_IMGS) rpc8e.lib padimage
$(RM) $(call fixpath, $(RP_OBJS:%.o=$(RP_OBJ_DIR)/%.o))
.PHONY: distclean
distclean: clean
make -C upstream distclean
$(RM) rpc8e.lib padimage cc65-rpc8_*.tar.bz2 || true
.PHONY: getupstream
getupstream:
make -C upstream getupstream