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
57 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
65 # Drivers for partially-flled boards (TT, TD and TI)
72 # Debug dongle driver (only on TI)
78 # Drivers only on TeleMetrum
87 # Drivers only on TeleMetrum
89 TM_SIRF_DRIVER_SRC = \
92 # Drivers only on TeleMetrum
98 # Tasks run on TeleMetrum
110 # All sources for TeleMetrum
114 $(ALTOS_DRIVER_SRC) \
123 $(TM_SIRF_DRIVER_SRC)
133 # All sources for the TI debug dongle
137 $(ALTOS_DRIVER_SRC) \
138 $(TELE_RECEIVER_SRC) \
147 # All sources for TeleTerra
151 $(ALTOS_DRIVER_SRC) \
152 $(TELE_RECEIVER_SRC) \
160 # Sources for TeleDongle
168 $(ALTOS_DRIVER_SRC) \
169 $(TELE_RECEIVER_SRC) \
176 $(ALTOS_DRIVER_SRC) \
178 $(TELE_RECEIVER_SRC) \
182 $(TM_SIRF_DRIVER_SRC) \
183 $(TM_SKY_DRIVER_SRC) \
190 TM_SIRF_REL=$(TM_SIRF_SRC:.c=.rel) ao_product-telemetrum.rel
191 TM_SKY_REL=$(TM_SKY_SRC:.c=.rel) ao_product-telemetrum.rel
192 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
193 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
194 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
197 ao_product-telemetrum.rel \
198 ao_product-tidongle.rel \
199 ao_product-teleterra.rel \
200 ao_product-teledongle.rel
202 REL=$(SRC:.c=.rel) $(PROD_REL)
210 PROGS= telemetrum-sirf.ihx telemetrum-sky.ihx tidongle.ihx \
211 teleterra.ihx teledongle.ihx
213 HOST_PROGS=ao_flight_test ao_gps_test ao_gps_test_skytraq
215 PCDB=$(PROGS:.ihx=.cdb)
216 PLNK=$(PROGS:.ihx=.lnk)
217 PMAP=$(PROGS:.ihx=.map)
218 PMEM=$(PROGS:.ihx=.mem)
222 $(CC) -c $(CFLAGS) -o$*.rel $*.c
224 all: $(PROGS) $(HOST_PROGS)
226 telemetrum-sirf.ihx: $(TM_SIRF_REL) Makefile
227 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SIRF_REL)
228 sh check-stack ao.h telemetrum-sirf.mem
230 telemetrum-sky.ihx: $(TM_SKY_REL) Makefile
231 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SKY_REL)
232 sh check-stack ao.h telemetrum-sky.mem
234 telemetrum-sky.ihx: telemetrum-sirf.ihx
236 tidongle.ihx: $(TI_REL) Makefile
237 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
238 sh check-stack ao.h tidongle.mem
240 tidongle.ihx: telemetrum-sky.ihx
242 teleterra.ihx: $(TT_REL) Makefile
243 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
244 sh check-stack ao.h teleterra.mem
246 teleterra.ihx: tidongle.ihx
248 teledongle.ihx: $(TD_REL) Makefile
249 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
250 sh check-stack ao.h teledongle.mem
252 teledongle.ihx: teleterra.ihx
254 altitude.h: make-altitude
255 nickle make-altitude > altitude.h
257 TELEMETRUM_DEFS=ao-telemetrum.h
258 TELETERRA_DEFS=ao-teleterra.h
259 TELEDONGLE_DEFS=ao-teledongle.h
260 TIDONGLE_DEFS=ao-tidongle.h
262 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
263 $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
264 ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS)
265 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
267 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
268 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
270 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
271 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
273 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
274 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
276 $(TELEMETRUM_DEFS): ao-make-product.5c
277 nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
279 $(TELETERRA_DEFS): ao-make-product.5c
280 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
282 $(TELEDONGLE_DEFS): ao-make-product.5c
283 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
285 $(TIDONGLE_DEFS): ao-make-product.5c
286 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
291 rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
292 rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
293 rm -f $(ALL_DEFS) $(HOST_PROGS)
294 rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
298 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
299 cc -g -o $@ ao_flight_test.c
301 ao_gps_test: ao_gps_sirf.c ao_gps_test.c ao_gps_print.c ao_host.h
302 cc -g -o $@ ao_gps_test.c
304 ao_gps_test_skytraq: ao_gps_skytraq.c ao_gps_test_skytraq.c ao_gps_print.c ao_host.h
305 cc -g -o $@ ao_gps_test_skytraq.c