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)
66 # Drivers for partially-flled boards (TT, TD and TI)
73 # Debug dongle driver (only on TI)
79 # Drivers only on TeleMetrum
88 # Tasks run on TeleMetrum
100 # All sources for TeleMetrum
104 $(ALTOS_DRIVER_SRC) \
115 # All sources for the TI debug dongle
119 $(ALTOS_DRIVER_SRC) \
120 $(TELE_RECEIVER_SRC) \
129 # All sources for TeleTerra
133 $(ALTOS_DRIVER_SRC) \
134 $(TELE_RECEIVER_SRC) \
142 # Sources for TeleDongle
150 $(ALTOS_DRIVER_SRC) \
151 $(TELE_RECEIVER_SRC) \
158 $(ALTOS_DRIVER_SRC) \
160 $(TELE_RECEIVER_SRC) \
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
176 ao_product-telemetrum.rel \
177 ao_product-tidongle.rel \
178 ao_product-teleterra.rel \
179 ao_product-teledongle.rel
181 REL=$(SRC:.c=.rel) $(PROD_REL)
189 PROGS= telemetrum.ihx tidongle.ihx \
190 teleterra.ihx teledongle.ihx
192 HOST_PROGS=ao_flight_test ao_gps_test
194 PCDB=$(PROGS:.ihx=.cdb)
195 PLNK=$(PROGS:.ihx=.lnk)
196 PMAP=$(PROGS:.ihx=.map)
197 PMEM=$(PROGS:.ihx=.mem)
201 $(CC) -c $(CFLAGS) -o$*.rel $*.c
203 all: $(PROGS) $(HOST_PROGS)
205 telemetrum.ihx: $(TM_REL) Makefile
206 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
207 sh check-stack ao.h telemetrum.mem
209 tidongle.ihx: $(TI_REL) Makefile
210 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
211 sh check-stack ao.h tidongle.mem
213 tidongle.ihx: telemetrum.ihx
215 teleterra.ihx: $(TT_REL) Makefile
216 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
217 sh check-stack ao.h teleterra.mem
219 teleterra.ihx: tidongle.ihx
221 teledongle.ihx: $(TD_REL) Makefile
222 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
223 sh check-stack ao.h teledongle.mem
225 teledongle.ihx: teleterra.ihx
227 altitude.h: make-altitude
228 nickle make-altitude > altitude.h
230 TELEMETRUM_DEFS=ao-telemetrum.h
231 TELETERRA_DEFS=ao-teleterra.h
232 TELEDONGLE_DEFS=ao-teledongle.h
233 TIDONGLE_DEFS=ao-tidongle.h
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
240 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
241 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
243 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
244 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
246 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
247 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
249 $(TELEMETRUM_DEFS): ao-make-product.5c
250 nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
252 $(TELETERRA_DEFS): ao-make-product.5c
253 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
255 $(TELEDONGLE_DEFS): ao-make-product.5c
256 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
258 $(TIDONGLE_DEFS): ao-make-product.5c
259 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
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)
271 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
272 cc -g -o $@ ao_flight_test.c
274 ao_gps_test: ao_gps.c ao_gps_test.c ao_gps_print.c ao_host.h
275 cc -g -o $@ ao_gps_test.c