7 VERSION=$(shell git describe)
9 CFLAGS=--model-small --debug --opt-code-speed
11 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
12 --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
23 # Common AltOS sources
36 # Shared AltOS drivers
58 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
67 # Drivers for partially-flled boards (TT, TD and TI)
74 # Drivers only on TeleMetrum
83 # Tasks run on TeleMetrum
95 # All sources for TeleMetrum
110 # All sources for the TI debug dongle
114 $(ALTOS_DRIVER_SRC) \
115 $(TELE_RECEIVER_SRC) \
123 # All sources for TeleTerra
127 $(ALTOS_DRIVER_SRC) \
128 $(TELE_RECEIVER_SRC) \
136 # Sources for TeleDongle
144 $(ALTOS_DRIVER_SRC) \
145 $(TELE_RECEIVER_SRC) \
152 $(ALTOS_DRIVER_SRC) \
154 $(TELE_RECEIVER_SRC) \
164 TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum-$(SERIAL).rel
165 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle-$(SERIAL).rel
166 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra-$(SERIAL).rel
167 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle-$(SERIAL).rel
170 ao_product-telemetrum-$(SERIAL).rel \
171 ao_product-tidongle-$(SERIAL).rel \
172 ao_product-teleterra-$(SERIAL).rel \
173 ao_product-teledongle-$(SERIAL).rel
175 REL=$(SRC:.c=.rel) $(PROD_REL)
183 PROGS= telemetrum-$(SERIAL).ihx tidongle-$(SERIAL).ihx \
184 teleterra-$(SERIAL).ihx teledongle-$(SERIAL).ihx
186 HOST_PROGS=ao_flight_test
188 PCDB=$(PROGS:.ihx=.cdb)
189 PLNK=$(PROGS:.ihx=.lnk)
190 PMAP=$(PROGS:.ihx=.map)
191 PMEM=$(PROGS:.ihx=.mem)
195 $(CC) -c $(CFLAGS) -o$*.rel $*.c
197 all: $(PROGS) $(HOST_PROGS)
199 telemetrum-$(SERIAL).ihx: $(TM_REL) Makefile
200 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
201 sh check-stack ao.h telemetrum-$(SERIAL).mem
203 tidongle-$(SERIAL).ihx: $(TI_REL) Makefile
204 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
205 sh check-stack ao.h tidongle-$(SERIAL).mem
207 tidongle-$(SERIAL).ihx: telemetrum-$(SERIAL).ihx
209 teleterra-$(SERIAL).ihx: $(TT_REL) Makefile
210 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
211 sh check-stack ao.h teleterra-$(SERIAL).mem
213 teleterra-$(SERIAL).ihx: tidongle-$(SERIAL).ihx
215 teledongle-$(SERIAL).ihx: $(TD_REL) Makefile
216 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
217 sh check-stack ao.h teledongle-$(SERIAL).mem
219 teledongle-$(SERIAL).ihx: teleterra-$(SERIAL).ihx
221 altitude.h: make-altitude
222 nickle make-altitude > altitude.h
224 TELEMETRUM_DEFS=ao-telemetrum-$(SERIAL).h
225 TELETERRA_DEFS=ao-teleterra-$(SERIAL).h
226 TELEDONGLE_DEFS=ao-teledongle-$(SERIAL).h
227 TIDONGLE_DEFS=ao-tidongle-$(SERIAL).h
229 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
230 $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
231 ao_product-telemetrum-$(SERIAL).rel: ao_product.c $(TELEMETRUM_DEFS)
232 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
234 ao_product-teleterra-$(SERIAL).rel: ao_product.c $(TELETERRA_DEFS)
235 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
237 ao_product-teledongle-$(SERIAL).rel: ao_product.c $(TELEDONGLE_DEFS)
238 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
240 ao_product-tidongle-$(SERIAL).rel: ao_product.c $(TIDONGLE_DEFS)
241 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
243 $(TELEMETRUM_DEFS): ao-make-product.5c
244 nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -s $(SERIAL) -v $(VERSION) > $@
246 $(TELETERRA_DEFS): ao-make-product.5c
247 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -s $(SERIAL) -v $(VERSION) > $@
249 $(TELEDONGLE_DEFS): ao-make-product.5c
250 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -s $(SERIAL) -v $(VERSION) > $@
252 $(TIDONGLE_DEFS): ao-make-product.5c
253 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -s $(SERIAL) -v $(VERSION) > $@
256 rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
257 rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
258 rm -f $(ALL_DEFS) $(HOST_PROGS)
259 rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
263 ao_flight_test: ao_flight.c ao_flight_test.c
264 cc -g -o $@ ao_flight_test.c