]> git.sur5r.net Git - cc65/blob - libsrc/c16/Makefile
Ignore only top level directories.
[cc65] / libsrc / c16 / Makefile
1 #
2 # makefile for CC65 runtime library (C16)
3 #
4
5 .SUFFIXES: .o .s .c
6
7 #--------------------------------------------------------------------------
8 # Programs and flags
9
10 SYS     = c16
11
12 AS      = ../../src/ca65/ca65
13 CC      = ../../src/cc65/cc65
14 CO      = ../../src/co65/co65
15 LD      = ../../src/ld65/ld65
16
17 AFLAGS  = -t $(SYS) --forget-inc-paths -I. -I../../asminc
18 CFLAGS  = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
19
20 #--------------------------------------------------------------------------
21 # Rules
22
23 %.o:    %.c
24         @$(CC) $(CFLAGS) $<
25         @$(AS) -o $@ $(AFLAGS) $(*).s
26
27 %.o:    %.s
28         @$(AS) -g -o $@ $(AFLAGS) $<
29
30 %-emd.o: %.emd
31         @$(CO) -o $(*)-emd.s --code-label _$(subst -,_,$(*)) $<
32         @$(AS) -o $@ $(AFLAGS) $(*)-emd.s
33
34 %-joy.o: %.joy
35         @$(CO) -o $(*)-joy.s --code-label _$(subst -,_,$(*)) $<
36         @$(AS) -o $@ $(AFLAGS) $(*)-joy.s
37
38 %-ser.o: %.ser
39         @$(CO) -o $(*)-ser.s --code-label _$(subst -,_,$(*)) $<
40         @$(AS) -o $@ $(AFLAGS) $(*)-ser.s
41
42 %-tgi.o: %.tgi
43         @$(CO) -o $(*)-tgi.s --code-label _$(subst -,_,$(*)) $<
44         @$(AS) -o $@ $(AFLAGS) $(*)-tgi.s
45
46 %.emd:  %.o ../runtime/zeropage.o
47         @$(LD) -o $@ -t module $^
48
49 %.joy:  %.o ../runtime/zeropage.o
50         @$(LD) -o $@ -t module $^
51
52 %.ser:  %.o ../runtime/zeropage.o
53         @$(LD) -o $@ -t module $^
54
55 %.tgi:  %.o ../runtime/zeropage.o
56         @$(LD) -o $@ -t module $^
57
58 #--------------------------------------------------------------------------
59 # Object files
60
61 OBJS =  _scrsize.o              \
62         break.o                 \
63         cgetc.o                 \
64         clrscr.o                \
65         color.o                 \
66         conio.o                 \
67         cputc.o                 \
68         crt0.o                  \
69         devnum.o                \
70         get_tv.o                \
71         irq.o                   \
72         joy_stat_stddrv.o       \
73         joy_stddrv.o            \
74         kbhit.o                 \
75         kclose.o                \
76         kernal.o                \
77         mainargs.o              \
78         randomize.o             \
79         revers.o                \
80         status.o                \
81         systime.o               \
82         sysuname.o              \
83         $(EMDS:.emd=-emd.o)     \
84         $(JOYS:.joy=-joy.o)     \
85         $(SERS:.ser=-ser.o)     \
86         $(TGIS:.tgi=-tgi.o)
87
88
89 #--------------------------------------------------------------------------
90 # Drivers
91
92 EMDS = c16-ram.emd
93
94 JOYS = c16-stdjoy.joy
95
96 SERS =
97
98 TGIS =
99
100 #--------------------------------------------------------------------------
101 # Targets
102
103 .PHONY: all clean zap
104
105 all:    $(OBJS) $(EMDS) $(JOYS) $(SERS) $(TGIS)
106
107 ../runtime/zeropage.o:
108         $(MAKE) -C $(dir $@) $(notdir $@)
109
110 clean:
111         @$(RM) $(OBJS) \
112                $(EMDS:.emd=.o) $(EMDS:.emd=-emd.s) \
113                $(JOYS:.joy=.o) $(JOYS:.joy=-joy.s) \
114                $(SERS:.ser=.o) $(SERS:.ser=-ser.s) \
115                $(TGIS:.tgi=.o) $(TGIS:.tgi=-tgi.s)
116
117 zap:    clean
118         @$(RM) $(EMDS) $(JOYS) $(SERS) $(TGIS)