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
21 # Common AltOS sources
34 # Shared AltOS drivers
56 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
65 # Drivers for partially-flled boards (TT, TD and TI)
72 # Drivers only on TeleMetrum
81 # Tasks run on TeleMetrum
93 # All sources for TeleMetrum
108 # All sources for the TI debug dongle
112 $(ALTOS_DRIVER_SRC) \
113 $(TELE_RECEIVER_SRC) \
121 # All sources for TeleTerra
125 $(ALTOS_DRIVER_SRC) \
126 $(TELE_RECEIVER_SRC) \
134 # Sources for TeleDongle
142 $(ALTOS_DRIVER_SRC) \
143 $(TELE_RECEIVER_SRC) \
150 $(ALTOS_DRIVER_SRC) \
152 $(TELE_RECEIVER_SRC) \
162 TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum.rel
163 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
164 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
165 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
168 ao_product-telemetrum.rel \
169 ao_product-tidongle.rel \
170 ao_product-teleterra.rel \
171 ao_product-teledongle.rel
173 REL=$(SRC:.c=.rel) $(PROD_REL)
181 PROGS= telemetrum.ihx tidongle.ihx \
182 teleterra.ihx teledongle.ihx
184 HOST_PROGS=ao_flight_test ao_gps_test
186 PCDB=$(PROGS:.ihx=.cdb)
187 PLNK=$(PROGS:.ihx=.lnk)
188 PMAP=$(PROGS:.ihx=.map)
189 PMEM=$(PROGS:.ihx=.mem)
193 $(CC) -c $(CFLAGS) -o$*.rel $*.c
195 all: $(PROGS) $(HOST_PROGS)
197 telemetrum.ihx: $(TM_REL) Makefile
198 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
199 sh check-stack ao.h telemetrum.mem
201 tidongle.ihx: $(TI_REL) Makefile
202 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
203 sh check-stack ao.h tidongle.mem
205 tidongle.ihx: telemetrum.ihx
207 teleterra.ihx: $(TT_REL) Makefile
208 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
209 sh check-stack ao.h teleterra.mem
211 teleterra.ihx: tidongle.ihx
213 teledongle.ihx: $(TD_REL) Makefile
214 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
215 sh check-stack ao.h teledongle.mem
217 teledongle.ihx: teleterra.ihx
219 altitude.h: make-altitude
220 nickle make-altitude > altitude.h
222 TELEMETRUM_DEFS=ao-telemetrum.h
223 TELETERRA_DEFS=ao-teleterra.h
224 TELEDONGLE_DEFS=ao-teledongle.h
225 TIDONGLE_DEFS=ao-tidongle.h
227 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
228 $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
229 ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS)
230 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
232 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
233 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
235 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
236 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
238 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
239 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
241 $(TELEMETRUM_DEFS): ao-make-product.5c
242 nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
244 $(TELETERRA_DEFS): ao-make-product.5c
245 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
247 $(TELEDONGLE_DEFS): ao-make-product.5c
248 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
250 $(TIDONGLE_DEFS): ao-make-product.5c
251 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -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
266 ao_gps_test: ao_gps.c ao_gps_test.c ao_host.h
267 cc -g -o $@ ao_gps_test.c