Clear more files on make clean
[fw/altos] / Makefile
1 #
2 # AltOS build
3 #
4
5 CC=sdcc
6
7 CFLAGS=--model-small --debug --opt-code-speed 
8
9 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
10         --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
11
12 SERIAL=1
13
14 INC = \
15         ao.h \
16         cc1111.h \
17         altitude.h \
18         25lc1024.h
19
20 #
21 # Common AltOS sources
22 #
23 ALTOS_SRC = \
24         ao_cmd.c \
25         ao_dbg.c \
26         ao_dma.c \
27         ao_mutex.c \
28         ao_panic.c \
29         ao_task.c \
30         ao_timer.c \
31         _bp.c
32
33 #
34 # Shared AltOS drivers
35 #
36 ALTOS_DRIVER_SRC = \
37         ao_beep.c \
38         ao_config.c \
39         ao_led.c \
40         ao_radio.c \
41         ao_stdio.c \
42         ao_usb.c
43
44 TELE_COMMON_SRC = \
45         ao_gps_print.c
46
47 #
48 # Receiver code
49 #
50 TELE_RECEIVER_SRC =\
51         ao_monitor.c
52
53 #
54 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
55 #
56
57 TELE_DRIVER_SRC = \
58         ao_convert.c \
59         ao_gps.c \
60         ao_serial.c
61
62 #
63 # Drivers for partially-flled boards (TT, TD and TI)
64 #
65 TELE_FAKE_SRC = \
66         ao_adc_fake.c \
67         ao_ee_fake.c
68
69
70 # Drivers only on TeleMetrum
71 #
72 TM_DRIVER_SRC = \
73         ao_adc.c \
74         ao_ee.c \
75         ao_gps_report.c \
76         ao_ignite.c
77
78 #
79 # Tasks run on TeleMetrum
80 #
81 TM_TASK_SRC = \
82         ao_flight.c \
83         ao_log.c \
84         ao_report.c \
85         ao_telemetry.c
86
87 TM_MAIN_SRC = \
88         ao_telemetrum.c
89
90 #
91 # All sources for TeleMetrum
92 #
93 TM_SRC = \
94         $(ALTOS_SRC) \
95         $(ALTOS_DRIVER_SRC) \
96         $(TELE_DRIVER_SRC) \
97         $(TELE_RECEIVER_SRC) \
98         $(TELE_COMMON_SRC) \
99         $(TM_DRIVER_SRC) \
100         $(TM_TASK_SRC) \
101         $(TM_MAIN_SRC)
102
103 TI_MAIN_SRC = \
104         ao_tidongle.c
105
106 #
107 # All sources for the TI debug dongle
108 #
109 TI_SRC = \
110         $(ALTOS_SRC) \
111         $(ALTOS_DRIVER_SRC) \
112         $(TELE_RECEIVER_SRC) \
113         $(TELE_COMMON_SRC) \
114         $(TELE_FAKE_SRC) \
115         $(TI_MAIN_SRC)
116         
117 TT_MAIN_SRC = \
118         ao_teleterra.c
119 #
120 # All sources for TeleTerra
121 #
122 TT_SRC = \
123         $(ALTOS_SRC) \
124         $(ALTOS_DRIVER_SRC) \
125         $(TELE_RECEIVER_SRC) \
126         $(TELE_DRIVER_SRC) \
127         $(TELE_COMMON_SRC) \
128         $(TELE_FAKE_SRC) \
129         $(TT_MAIN_SRC)
130         
131         
132 #
133 # Sources for TeleDongle
134 #
135
136 TD_MAIN_SRC = \
137         ao_teledongle.c
138
139 TD_SRC = \
140         $(ALTOS_SRC) \
141         $(ALTOS_DRIVER_SRC) \
142         $(TELE_RECEIVER_SRC) \
143         $(TELE_COMMON_SRC) \
144         $(TELE_FAKE_SRC) \
145         $(TD_MAIN_SRC)
146
147 SRC = \
148         $(ALTOS_SRC) \
149         $(ALTOS_DRIVER_SRC) \
150         $(TELE_DRIVER_SRC) \
151         $(TELE_RECEIVER_SRC) \
152         $(TELE_COMMON_SRC) \
153         $(TELE_FAKE_SRC) \
154         $(TM_DRIVER_SRC) \
155         $(TM_TASK_SRC) \
156         $(TM_MAIN_SRC) \
157         $(TI_MAIN_SRC) \
158         $(TD_MAIN_SRC) \
159         $(TT_MAIN_SRC)
160
161 TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum-$(SERIAL).rel
162 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle-$(SERIAL).rel
163 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra-$(SERIAL).rel
164 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle-$(SERIAL).rel
165
166 PROD_REL=\
167         ao_product-telemetrum-$(SERIAL).rel \
168         ao_product-tidongle-$(SERIAL).rel \
169         ao_product-teleterra-$(SERIAL).rel \
170         ao_product-teledongle-$(SERIAL).rel
171
172 REL=$(SRC:.c=.rel) $(PROD_REL)
173 ADB=$(REL:.rel=.adb)
174 ASM=$(REL:.rel=.asm)
175 LNK=$(REL:.rel=.lnk)
176 LST=$(REL:.rel=.lst)
177 RST=$(REL:.rel=.rst)
178 SYM=$(REL:.rel=.sym)
179
180 PROGS=  telemetrum-$(SERIAL).ihx tidongle-$(SERIAL).ihx \
181         teleterra-$(SERIAL).ihx teledongle-$(SERIAL).ihx
182
183 HOST_PROGS=ao_flight_test
184
185 PCDB=$(PROGS:.ihx=.cdb)
186 PLNK=$(PROGS:.ihx=.lnk)
187 PMAP=$(PROGS:.ihx=.map)
188 PMEM=$(PROGS:.ihx=.mem)
189 PAOM=$(PROGS:.ihx=)
190
191 %.rel : %.c $(INC)
192         $(CC) -c $(CFLAGS) -o$*.rel $*.c
193
194 all: $(PROGS) $(HOST_PROGS)
195
196 telemetrum-$(SERIAL).ihx: $(TM_REL) Makefile
197         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
198         sh check-stack ao.h telemetrum-$(SERIAL).mem
199
200 tidongle-$(SERIAL).ihx: $(TI_REL) Makefile
201         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
202         sh check-stack ao.h tidongle-$(SERIAL).mem
203
204 tidongle-$(SERIAL).ihx: telemetrum-$(SERIAL).ihx
205
206 teleterra-$(SERIAL).ihx: $(TT_REL) Makefile
207         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
208         sh check-stack ao.h teleterra-$(SERIAL).mem
209
210 teleterra-$(SERIAL).ihx: tidongle-$(SERIAL).ihx
211
212 teledongle-$(SERIAL).ihx: $(TD_REL) Makefile
213         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
214         sh check-stack ao.h teledongle-$(SERIAL).mem
215
216 teledongle-$(SERIAL).ihx: teleterra-$(SERIAL).ihx
217
218 altitude.h: make-altitude
219         nickle make-altitude > altitude.h
220
221 TELEMETRUM_DEFS=ao-telemetrum-$(SERIAL).h
222 TELETERRA_DEFS=ao-teleterra-$(SERIAL).h
223 TELEDONGLE_DEFS=ao-teledongle-$(SERIAL).h
224 TIDONGLE_DEFS=ao-tidongle-$(SERIAL).h
225
226 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
227         $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
228 ao_product-telemetrum-$(SERIAL).rel: ao_product.c $(TELEMETRUM_DEFS)
229         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
230
231 ao_product-teleterra-$(SERIAL).rel: ao_product.c $(TELETERRA_DEFS)
232         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
233
234 ao_product-teledongle-$(SERIAL).rel: ao_product.c $(TELEDONGLE_DEFS)
235         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
236
237 ao_product-tidongle-$(SERIAL).rel: ao_product.c $(TIDONGLE_DEFS)
238         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
239
240 $(TELEMETRUM_DEFS): ao-make-product.5c
241         nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -s $(SERIAL) > $@
242
243 $(TELETERRA_DEFS): ao-make-product.5c
244         nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -s $(SERIAL) > $@
245
246 $(TELEDONGLE_DEFS): ao-make-product.5c
247         nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -s $(SERIAL) > $@
248
249 $(TIDONGLE_DEFS): ao-make-product.5c
250         nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -s $(SERIAL) > $@
251
252 clean:
253         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
254         rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
255         rm -f $(ALL_DEFS)
256
257 install:
258
259 ao_flight_test: ao_flight.c ao_flight_test.c
260         cc -g -o $@ ao_flight_test.c