8 VERSION=$(shell git describe)
11 CFLAGS=--model-small --debug --opt-code-speed
13 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
14 --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
23 # Common AltOS sources
35 # Shared AltOS drivers
60 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
68 # Drivers for partially-flled boards (TT, TD and TI)
75 # Debug dongle driver (only on TI)
81 # Drivers only on TeleMetrum
90 # Drivers only on TeleMetrum
92 TM_SIRF_DRIVER_SRC = \
95 # Drivers only on TeleMetrum
101 # Tasks run on TeleMetrum
113 # All sources for TeleMetrum
117 $(ALTOS_DRIVER_SRC) \
126 $(TM_SIRF_DRIVER_SRC)
136 # All sources for the TI debug dongle
140 $(ALTOS_DRIVER_SRC) \
141 $(TELE_RECEIVER_SRC) \
150 # All sources for TeleTerra
154 $(ALTOS_DRIVER_SRC) \
155 $(TELE_RECEIVER_SRC) \
163 # Sources for TeleDongle
171 $(ALTOS_DRIVER_SRC) \
172 $(TELE_RECEIVER_SRC) \
179 $(ALTOS_DRIVER_SRC) \
181 $(TELE_RECEIVER_SRC) \
185 $(TM_SIRF_DRIVER_SRC) \
186 $(TM_SKY_DRIVER_SRC) \
193 TM_SIRF_REL=$(TM_SIRF_SRC:.c=.rel) ao_product-telemetrum.rel
194 TM_SKY_REL=$(TM_SKY_SRC:.c=.rel) ao_product-telemetrum.rel
195 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
196 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
197 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
200 ao_product-telemetrum.rel \
201 ao_product-tidongle.rel \
202 ao_product-teleterra.rel \
203 ao_product-teledongle.rel
205 REL=$(SRC:.c=.rel) $(PROD_REL)
213 PROGS= telemetrum-sirf.ihx telemetrum-sky.ihx tidongle.ihx \
214 teleterra.ihx teledongle.ihx
216 HOST_PROGS=ao_flight_test ao_gps_test ao_gps_test_skytraq
218 PCDB=$(PROGS:.ihx=.cdb)
219 PLNK=$(PROGS:.ihx=.lnk)
220 PMAP=$(PROGS:.ihx=.map)
221 PMEM=$(PROGS:.ihx=.mem)
225 $(CC) -c $(CFLAGS) -o$*.rel $*.c
227 all: $(PROGS) $(HOST_PROGS)
229 telemetrum-sirf.ihx: $(TM_SIRF_REL) Makefile
230 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SIRF_REL)
231 sh check-stack ao.h telemetrum-sirf.mem
233 telemetrum-sky.ihx: $(TM_SKY_REL) Makefile
234 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SKY_REL)
235 sh check-stack ao.h telemetrum-sky.mem
237 telemetrum-sky.ihx: telemetrum-sirf.ihx
239 tidongle.ihx: $(TI_REL) Makefile
240 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
241 sh check-stack ao.h tidongle.mem
243 tidongle.ihx: telemetrum-sky.ihx
245 teleterra.ihx: $(TT_REL) Makefile
246 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
247 sh check-stack ao.h teleterra.mem
249 teleterra.ihx: tidongle.ihx
251 teledongle.ihx: $(TD_REL) Makefile
252 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
253 sh check-stack ao.h teledongle.mem
255 teledongle.ihx: teleterra.ihx
257 altitude.h: make-altitude
258 nickle make-altitude > altitude.h
260 TELEMETRUM_DEFS=ao-telemetrum.h
261 TELETERRA_DEFS=ao-teleterra.h
262 TELEDONGLE_DEFS=ao-teledongle.h
263 TIDONGLE_DEFS=ao-tidongle.h
265 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
266 $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
267 ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS)
268 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
270 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
271 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
273 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
274 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
276 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
277 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
279 $(TELEMETRUM_DEFS): ao-make-product.5c
280 nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
282 $(TELETERRA_DEFS): ao-make-product.5c
283 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
285 $(TELEDONGLE_DEFS): ao-make-product.5c
286 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
288 $(TIDONGLE_DEFS): ao-make-product.5c
289 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
294 rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
295 rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
296 rm -f $(ALL_DEFS) $(HOST_PROGS)
297 rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
303 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
304 cc -g -o $@ ao_flight_test.c
306 ao_gps_test: ao_gps_sirf.c ao_gps_test.c ao_gps_print.c ao_host.h
307 cc -g -o $@ ao_gps_test.c
309 ao_gps_test_skytraq: ao_gps_skytraq.c ao_gps_test_skytraq.c ao_gps_print.c ao_host.h
310 cc -g -o $@ ao_gps_test_skytraq.c