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
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.rel
165 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
166 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
167 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
170 ao_product-telemetrum.rel \
171 ao_product-tidongle.rel \
172 ao_product-teleterra.rel \
173 ao_product-teledongle.rel
175 REL=$(SRC:.c=.rel) $(PROD_REL)
183 PROGS= telemetrum.ihx tidongle.ihx \
184 teleterra.ihx teledongle.ihx
186 HOST_PROGS=ao_flight_test ao_gps_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.ihx: $(TM_REL) Makefile
200 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
201 sh check-stack ao.h telemetrum.mem
203 tidongle.ihx: $(TI_REL) Makefile
204 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
205 sh check-stack ao.h tidongle.mem
207 tidongle.ihx: telemetrum.ihx
209 teleterra.ihx: $(TT_REL) Makefile
210 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
211 sh check-stack ao.h teleterra.mem
213 teleterra.ihx: tidongle.ihx
215 teledongle.ihx: $(TD_REL) Makefile
216 $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
217 sh check-stack ao.h teledongle.mem
219 teledongle.ihx: teleterra.ihx
221 altitude.h: make-altitude
222 nickle make-altitude > altitude.h
224 TELEMETRUM_DEFS=ao-telemetrum.h
225 TELETERRA_DEFS=ao-teleterra.h
226 TELEDONGLE_DEFS=ao-teledongle.h
227 TIDONGLE_DEFS=ao-tidongle.h
229 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
230 $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
231 ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS)
232 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
234 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
235 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
237 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
238 $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
240 ao_product-tidongle.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 -v $(VERSION) > $@
246 $(TELETERRA_DEFS): ao-make-product.5c
247 nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
249 $(TELEDONGLE_DEFS): ao-make-product.5c
250 nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
252 $(TIDONGLE_DEFS): ao-make-product.5c
253 nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
258 rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
259 rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
260 rm -f $(ALL_DEFS) $(HOST_PROGS)
261 rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
265 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
266 cc -g -o $@ ao_flight_test.c
268 ao_gps_test: ao_gps.c ao_gps_test.c ao_gps_print.c ao_host.h
269 cc -g -o $@ ao_gps_test.c