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
61 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
69 # Drivers for partially-flled boards (TT, TD and TI)
76 # Debug dongle driver (only on TI)
82 # Drivers only on TeleMetrum
91 # Drivers only on TeleMetrum
93 TM_SIRF_DRIVER_SRC = \
96 # Drivers only on TeleMetrum
102 # Tasks run on TeleMetrum
114 # All sources for TeleMetrum
118 $(ALTOS_DRIVER_SRC) \
127 $(TM_SIRF_DRIVER_SRC)
137 # All sources for the TI debug dongle
141 $(ALTOS_DRIVER_SRC) \
142 $(TELE_RECEIVER_SRC) \
151 # All sources for TeleTerra
155 $(ALTOS_DRIVER_SRC) \
156 $(TELE_RECEIVER_SRC) \
164 # Sources for TeleDongle
172 $(ALTOS_DRIVER_SRC) \
173 $(TELE_RECEIVER_SRC) \
180 $(ALTOS_DRIVER_SRC) \
182 $(TELE_RECEIVER_SRC) \
186 $(TM_SIRF_DRIVER_SRC) \
187 $(TM_SKY_DRIVER_SRC) \
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
201 ao_product-telemetrum.rel \
202 ao_product-tidongle.rel \
203 ao_product-teleterra.rel \
204 ao_product-teledongle.rel
206 REL=$(SRC:.c=.rel) $(PROD_REL)
214 PROGS= telemetrum-sirf.ihx telemetrum-sky.ihx tidongle.ihx \
215 teleterra.ihx teledongle.ihx
217 HOST_PROGS=ao_flight_test ao_gps_test ao_gps_test_skytraq
219 PCDB=$(PROGS:.ihx=.cdb)
220 PLNK=$(PROGS:.ihx=.lnk)
221 PMAP=$(PROGS:.ihx=.map)
222 PMEM=$(PROGS:.ihx=.mem)
226 $(CC) -c $(CFLAGS) -o$*.rel $*.c
228 all: $(PROGS) $(HOST_PROGS)
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
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
238 telemetrum-sky.ihx: telemetrum-sirf.ihx
240 tidongle.ihx: $(TI_REL) Makefile
241 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
242 sh check-stack ao.h tidongle.mem
244 tidongle.ihx: telemetrum-sky.ihx
246 teleterra.ihx: $(TT_REL) Makefile
247 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
248 sh check-stack ao.h teleterra.mem
250 teleterra.ihx: tidongle.ihx
252 teledongle.ihx: $(TD_REL) Makefile
253 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
254 sh check-stack ao.h teledongle.mem
256 teledongle.ihx: teleterra.ihx
258 altitude.h: make-altitude
259 nickle make-altitude > altitude.h
261 TELEMETRUM_DEFS=ao-telemetrum.h
262 TELETERRA_DEFS=ao-teleterra.h
263 TELEDONGLE_DEFS=ao-teledongle.h
264 TIDONGLE_DEFS=ao-tidongle.h
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
271 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
272 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
274 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
275 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
277 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
278 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
280 $(TELEMETRUM_DEFS): ao-make-product.5c
281 nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
283 $(TELETERRA_DEFS): ao-make-product.5c
284 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
286 $(TELEDONGLE_DEFS): ao-make-product.5c
287 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
289 $(TIDONGLE_DEFS): ao-make-product.5c
290 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
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)
304 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
305 cc -g -o $@ ao_flight_test.c
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
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