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