]> git.sur5r.net Git - cc65/blob - libsrc/nes/Makefile
9e8eef13280536019c2ebfe2c6faa861e751c505
[cc65] / libsrc / nes / Makefile
1 #
2 # makefile for CC65 runtime library
3 #
4
5 .SUFFIXES: .o .s .c
6
7 #--------------------------------------------------------------------------
8 # Programs and flags
9
10 SYS     = nes
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../../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-name _$(subst -,_,$(*)) $<
32         @$(AS) -o $@ $(AFLAGS) $(*)-emd.s
33
34 %-joy.o: %.joy
35         @$(CO) -o $(*)-joy.s --code-name _$(subst -,_,$(*)) $<
36         @$(AS) -o $@ $(AFLAGS) $(*)-joy.s
37
38 %-mou.o: %.mou
39         @$(CO) -o $(*)-mou.s --code-name _$(subst -,_,$(*)) $<
40         @$(AS) -o $@ $(AFLAGS) $(*)-mou.s
41
42 %-ser.o: %.ser
43         @$(CO) -o $(*)-ser.s --code-name _$(subst -,_,$(*)) $<
44         @$(AS) -o $@ $(AFLAGS) $(*)-ser.s
45
46 %-tgi.o: %.tgi
47         @$(CO) -o $(*)-tgi.s --code-name _$(subst -,_,$(*)) $<
48         @$(AS) -o $@ $(AFLAGS) $(*)-tgi.s
49
50 %.emd:  %.o ../runtime/zeropage.o
51         @$(LD) -o $@ -t module $^
52
53 %.joy:  %.o ../runtime/zeropage.o
54         @$(LD) -o $@ -t module $^
55
56 %.mou:  %.o ../runtime/zeropage.o
57         @$(LD) -o $@ -t module $^
58
59 %.ser:  %.o ../runtime/zeropage.o
60         @$(LD) -o $@ -t module $^
61
62 %.tgi:  %.o ../runtime/zeropage.o
63         @$(LD) -o $@ -t module $^
64
65 #--------------------------------------------------------------------------
66 # Object files
67
68 OBJS =  _scrsize.o              \
69         cclear.o                \
70         chline.o                \
71         clock.o                 \
72         clrscr.o                \
73         color.o                 \
74         cputc.o                 \
75         crt0.o                  \
76         ctype.o                 \
77         cvline.o                \
78         get_tv.o                \
79         gotox.o                 \
80         gotoxy.o                \
81         gotoy.o                 \
82         mainargs.o              \
83         ppu.o                   \
84         ppubuf.o                \
85         randomize.o             \
86         revers.o                \
87         setcursor.o             \
88         sysuname.o              \
89         tgi_colors.o            \
90         waitvblank.o            \
91         wherex.o                \
92         wherey.o                \
93         $(EMDS:.emd=-emd.o)     \
94         $(JOYS:.joy=-joy.o)     \
95         $(MOUS:.mou=-mou.o)     \
96         $(SERS:.ser=-ser.o)     \
97         $(TGIS:.tgi=-tgi.o)
98
99 #--------------------------------------------------------------------------
100 # Drivers
101
102 EMDS =
103
104 JOYS = nes-stdjoy.joy
105
106 MOUS =
107
108 SERS =
109
110 TGIS = nes-64-56-2.tgi
111
112 #--------------------------------------------------------------------------
113 # Targets
114
115 .PHONY: all clean zap
116
117 all:    $(OBJS) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)
118
119 ../runtime/popa.o:
120         $(MAKE) -C $(dir $@) $(notdir $@)
121
122 ../runtime/zeropage.o:
123         $(MAKE) -C $(dir $@) $(notdir $@)
124
125 nes-64-56-2.tgi:        nes-64-56-2.o           \
126                         ../runtime/popa.o       \
127                         ../runtime/zeropage.o   \
128                         clrscr.o                \
129                         cputc.o                 \
130                         get_tv.o                \
131                         gotoxy.o                \
132                         ppu.o                   \
133                         ppubuf.o                \
134                         setcursor.o
135         @$(LD) -o $@ -t module $^
136
137 clean:
138         @$(RM) $(OBJS) \
139                $(EMDS:.emd=.o) $(EMDS:.emd=-emd.s) \
140                $(JOYS:.joy=.o) $(JOYS:.joy=-joy.s) \
141                $(MOUS:.mou=.o) $(MOUS:.mou=-mou.s) \
142                $(SERS:.ser=.o) $(SERS:.ser=-ser.s) \
143                $(TGIS:.tgi=.o) $(TGIS:.tgi=-tgi.s)
144
145 zap:    clean
146         @$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)