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
58 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
66 # Drivers for partially-flled boards (TT, TD and TI)
73 # Debug dongle driver (only on TI)
79 # Drivers only on TeleMetrum
88 # Drivers only on TeleMetrum
90 TM_SIRF_DRIVER_SRC = \
93 # Drivers only on TeleMetrum
99 # Tasks run on TeleMetrum
111 # All sources for TeleMetrum
115 $(ALTOS_DRIVER_SRC) \
124 $(TM_SIRF_DRIVER_SRC)
134 # All sources for the TI debug dongle
138 $(ALTOS_DRIVER_SRC) \
139 $(TELE_RECEIVER_SRC) \
148 # All sources for TeleTerra
152 $(ALTOS_DRIVER_SRC) \
153 $(TELE_RECEIVER_SRC) \
161 # Sources for TeleDongle
169 $(ALTOS_DRIVER_SRC) \
170 $(TELE_RECEIVER_SRC) \
177 $(ALTOS_DRIVER_SRC) \
179 $(TELE_RECEIVER_SRC) \
183 $(TM_SIRF_DRIVER_SRC) \
184 $(TM_SKY_DRIVER_SRC) \
191 TM_SIRF_REL=$(TM_SIRF_SRC:.c=.rel) ao_product-telemetrum.rel
192 TM_SKY_REL=$(TM_SKY_SRC:.c=.rel) ao_product-telemetrum.rel
193 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
194 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
195 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
198 ao_product-telemetrum.rel \
199 ao_product-tidongle.rel \
200 ao_product-teleterra.rel \
201 ao_product-teledongle.rel
203 REL=$(SRC:.c=.rel) $(PROD_REL)
211 PROGS= telemetrum-sirf.ihx telemetrum-sky.ihx tidongle.ihx \
212 teleterra.ihx teledongle.ihx
214 HOST_PROGS=ao_flight_test ao_gps_test ao_gps_test_skytraq
216 PCDB=$(PROGS:.ihx=.cdb)
217 PLNK=$(PROGS:.ihx=.lnk)
218 PMAP=$(PROGS:.ihx=.map)
219 PMEM=$(PROGS:.ihx=.mem)
223 $(CC) -c $(CFLAGS) -o$*.rel $*.c
225 all: $(PROGS) $(HOST_PROGS)
227 telemetrum-sirf.ihx: $(TM_SIRF_REL) Makefile
228 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SIRF_REL)
229 sh check-stack ao.h telemetrum-sirf.mem
231 telemetrum-sky.ihx: $(TM_SKY_REL) Makefile
232 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SKY_REL)
233 sh check-stack ao.h telemetrum-sky.mem
235 telemetrum-sky.ihx: telemetrum-sirf.ihx
237 tidongle.ihx: $(TI_REL) Makefile
238 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
239 sh check-stack ao.h tidongle.mem
241 tidongle.ihx: telemetrum-sky.ihx
243 teleterra.ihx: $(TT_REL) Makefile
244 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
245 sh check-stack ao.h teleterra.mem
247 teleterra.ihx: tidongle.ihx
249 teledongle.ihx: $(TD_REL) Makefile
250 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
251 sh check-stack ao.h teledongle.mem
253 teledongle.ihx: teleterra.ihx
255 altitude.h: make-altitude
256 nickle make-altitude > altitude.h
258 TELEMETRUM_DEFS=ao-telemetrum.h
259 TELETERRA_DEFS=ao-teleterra.h
260 TELEDONGLE_DEFS=ao-teledongle.h
261 TIDONGLE_DEFS=ao-tidongle.h
263 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
264 $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
265 ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS)
266 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
268 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
269 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
271 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
272 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
274 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
275 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
277 $(TELEMETRUM_DEFS): ao-make-product.5c
278 nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
280 $(TELETERRA_DEFS): ao-make-product.5c
281 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
283 $(TELEDONGLE_DEFS): ao-make-product.5c
284 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
286 $(TIDONGLE_DEFS): ao-make-product.5c
287 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
292 rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
293 rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
294 rm -f $(ALL_DEFS) $(HOST_PROGS)
295 rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
299 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
300 cc -g -o $@ ao_flight_test.c
302 ao_gps_test: ao_gps_sirf.c ao_gps_test.c ao_gps_print.c ao_host.h
303 cc -g -o $@ ao_gps_test.c
305 ao_gps_test_skytraq: ao_gps_skytraq.c ao_gps_test_skytraq.c ao_gps_print.c ao_host.h
306 cc -g -o $@ ao_gps_test_skytraq.c