Add support for the SkyTraq GPS unit
[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_gps_print.c \
47         ao_state.c
48
49 #
50 # Receiver code
51 #
52 TELE_RECEIVER_SRC =\
53         ao_monitor.c \
54         ao_rssi.c
55
56 #
57 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
58 #
59
60 TELE_DRIVER_SRC = \
61         ao_convert.c \
62         ao_gps_skytraq.c \
63         ao_serial.c
64
65 #
66 # Drivers for partially-flled boards (TT, TD and TI)
67 #
68 TELE_FAKE_SRC = \
69         ao_adc_fake.c \
70         ao_ee_fake.c
71
72 #
73 # Debug dongle driver (only on TI)
74 #
75 DBG_DONGLE_SRC = \
76         ao_dbg.c
77
78 #
79 # Drivers only on TeleMetrum
80 #
81 TM_DRIVER_SRC = \
82         ao_adc.c \
83         ao_ee.c \
84         ao_gps_report.c \
85         ao_ignite.c
86
87 #
88 # Tasks run on TeleMetrum
89 #
90 TM_TASK_SRC = \
91         ao_flight.c \
92         ao_log.c \
93         ao_report.c \
94         ao_telemetry.c
95
96 TM_MAIN_SRC = \
97         ao_telemetrum.c
98
99 #
100 # All sources for TeleMetrum
101 #
102 TM_SRC = \
103         $(ALTOS_SRC) \
104         $(ALTOS_DRIVER_SRC) \
105         $(TELE_DRIVER_SRC) \
106         $(TELE_COMMON_SRC) \
107         $(TM_DRIVER_SRC) \
108         $(TM_TASK_SRC) \
109         $(TM_MAIN_SRC)
110
111 TI_MAIN_SRC = \
112         ao_tidongle.c
113
114 #
115 # All sources for the TI debug dongle
116 #
117 TI_SRC = \
118         $(ALTOS_SRC) \
119         $(ALTOS_DRIVER_SRC) \
120         $(TELE_RECEIVER_SRC) \
121         $(TELE_COMMON_SRC) \
122         $(TELE_FAKE_SRC) \
123         $(TI_MAIN_SRC) \
124         $(DBG_DONGLE_SRC)
125
126 TT_MAIN_SRC = \
127         ao_teleterra.c
128 #
129 # All sources for TeleTerra
130 #
131 TT_SRC = \
132         $(ALTOS_SRC) \
133         $(ALTOS_DRIVER_SRC) \
134         $(TELE_RECEIVER_SRC) \
135         $(TELE_DRIVER_SRC) \
136         $(TELE_COMMON_SRC) \
137         $(TELE_FAKE_SRC) \
138         $(TT_MAIN_SRC)
139
140
141 #
142 # Sources for TeleDongle
143 #
144
145 TD_MAIN_SRC = \
146         ao_teledongle.c
147
148 TD_SRC = \
149         $(ALTOS_SRC) \
150         $(ALTOS_DRIVER_SRC) \
151         $(TELE_RECEIVER_SRC) \
152         $(TELE_COMMON_SRC) \
153         $(TELE_FAKE_SRC) \
154         $(TD_MAIN_SRC)
155
156 SRC = \
157         $(ALTOS_SRC) \
158         $(ALTOS_DRIVER_SRC) \
159         $(TELE_DRIVER_SRC) \
160         $(TELE_RECEIVER_SRC) \
161         $(TELE_COMMON_SRC) \
162         $(TELE_FAKE_SRC) \
163         $(TM_DRIVER_SRC) \
164         $(TM_TASK_SRC) \
165         $(TM_MAIN_SRC) \
166         $(TI_MAIN_SRC) \
167         $(TD_MAIN_SRC) \
168         $(TT_MAIN_SRC)
169
170 TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum.rel
171 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
172 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
173 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
174
175 PROD_REL=\
176         ao_product-telemetrum.rel \
177         ao_product-tidongle.rel \
178         ao_product-teleterra.rel \
179         ao_product-teledongle.rel
180
181 REL=$(SRC:.c=.rel) $(PROD_REL)
182 ADB=$(REL:.rel=.adb)
183 ASM=$(REL:.rel=.asm)
184 LNK=$(REL:.rel=.lnk)
185 LST=$(REL:.rel=.lst)
186 RST=$(REL:.rel=.rst)
187 SYM=$(REL:.rel=.sym)
188
189 PROGS=  telemetrum.ihx tidongle.ihx \
190         teleterra.ihx teledongle.ihx
191
192 HOST_PROGS=ao_flight_test ao_gps_test ao_gps_test_skytraq
193
194 PCDB=$(PROGS:.ihx=.cdb)
195 PLNK=$(PROGS:.ihx=.lnk)
196 PMAP=$(PROGS:.ihx=.map)
197 PMEM=$(PROGS:.ihx=.mem)
198 PAOM=$(PROGS:.ihx=)
199
200 %.rel : %.c $(INC)
201         $(CC) -c $(CFLAGS) -o$*.rel $*.c
202
203 all: $(PROGS) $(HOST_PROGS)
204
205 telemetrum.ihx: $(TM_REL) Makefile
206         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
207         sh check-stack ao.h telemetrum.mem
208
209 tidongle.ihx: $(TI_REL) Makefile
210         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
211         sh check-stack ao.h tidongle.mem
212
213 tidongle.ihx: telemetrum.ihx
214
215 teleterra.ihx: $(TT_REL) Makefile
216         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
217         sh check-stack ao.h teleterra.mem
218
219 teleterra.ihx: tidongle.ihx
220
221 teledongle.ihx: $(TD_REL) Makefile
222         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
223         sh check-stack ao.h teledongle.mem
224
225 teledongle.ihx: teleterra.ihx
226
227 altitude.h: make-altitude
228         nickle make-altitude > altitude.h
229
230 TELEMETRUM_DEFS=ao-telemetrum.h
231 TELETERRA_DEFS=ao-teleterra.h
232 TELEDONGLE_DEFS=ao-teledongle.h
233 TIDONGLE_DEFS=ao-tidongle.h
234
235 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
236         $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
237 ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS)
238         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
239
240 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
241         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
242
243 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
244         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
245
246 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
247         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
248
249 $(TELEMETRUM_DEFS): ao-make-product.5c
250         nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
251
252 $(TELETERRA_DEFS): ao-make-product.5c
253         nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
254
255 $(TELEDONGLE_DEFS): ao-make-product.5c
256         nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
257
258 $(TIDONGLE_DEFS): ao-make-product.5c
259         nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
260
261 distclean:      clean
262
263 clean:
264         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
265         rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
266         rm -f $(ALL_DEFS) $(HOST_PROGS)
267         rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
268
269 install:
270
271 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
272         cc -g -o $@ ao_flight_test.c
273
274 ao_gps_test: ao_gps_sirf.c ao_gps_test.c ao_gps_print.c ao_host.h
275         cc -g -o $@ ao_gps_test.c
276
277 ao_gps_test_skytraq: ao_gps_skytraq.c ao_gps_test_skytraq.c ao_gps_print.c ao_host.h
278         cc -g -o $@ ao_gps_test_skytraq.c