update changelogs for Debian build
[fw/altos] / src / Makefile
1 #
2 # AltOS build
3 #
4 #
5 CC=sdcc
6
7 ifndef VERSION
8 VERSION=$(shell git describe)
9 endif
10
11 CFLAGS=--model-small --debug --opt-code-speed
12
13 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
14         --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
15
16 INC = \
17         ao.h \
18         cc1111.h \
19         altitude.h \
20         25lc1024.h
21
22 #
23 # Common AltOS sources
24 #
25 ALTOS_SRC = \
26         ao_cmd.c \
27         ao_dbg.c \
28         ao_dma.c \
29         ao_mutex.c \
30         ao_panic.c \
31         ao_task.c \
32         ao_timer.c \
33         _bp.c
34
35 #
36 # Shared AltOS drivers
37 #
38 ALTOS_DRIVER_SRC = \
39         ao_beep.c \
40         ao_config.c \
41         ao_led.c \
42         ao_radio.c \
43         ao_stdio.c \
44         ao_usb.c
45
46 TELE_COMMON_SRC = \
47         ao_gps_print.c \
48         ao_state.c
49
50 #
51 # Receiver code
52 #
53 TELE_RECEIVER_SRC =\
54         ao_monitor.c \
55         ao_rssi.c
56
57 #
58 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
59 #
60
61 TELE_DRIVER_SRC = \
62         ao_convert.c \
63         ao_gps.c \
64         ao_serial.c
65
66 #
67 # Drivers for partially-flled boards (TT, TD and TI)
68 #
69 TELE_FAKE_SRC = \
70         ao_adc_fake.c \
71         ao_ee_fake.c
72
73 #
74 # Drivers only on TeleMetrum
75 #
76 TM_DRIVER_SRC = \
77         ao_adc.c \
78         ao_ee.c \
79         ao_gps_report.c \
80         ao_ignite.c
81
82 #
83 # Tasks run on TeleMetrum
84 #
85 TM_TASK_SRC = \
86         ao_flight.c \
87         ao_log.c \
88         ao_report.c \
89         ao_telemetry.c
90
91 TM_MAIN_SRC = \
92         ao_telemetrum.c
93
94 #
95 # All sources for TeleMetrum
96 #
97 TM_SRC = \
98         $(ALTOS_SRC) \
99         $(ALTOS_DRIVER_SRC) \
100         $(TELE_DRIVER_SRC) \
101         $(TELE_COMMON_SRC) \
102         $(TM_DRIVER_SRC) \
103         $(TM_TASK_SRC) \
104         $(TM_MAIN_SRC)
105
106 TI_MAIN_SRC = \
107         ao_tidongle.c
108
109 #
110 # All sources for the TI debug dongle
111 #
112 TI_SRC = \
113         $(ALTOS_SRC) \
114         $(ALTOS_DRIVER_SRC) \
115         $(TELE_RECEIVER_SRC) \
116         $(TELE_COMMON_SRC) \
117         $(TELE_FAKE_SRC) \
118         $(TI_MAIN_SRC)
119
120 TT_MAIN_SRC = \
121         ao_teleterra.c
122 #
123 # All sources for TeleTerra
124 #
125 TT_SRC = \
126         $(ALTOS_SRC) \
127         $(ALTOS_DRIVER_SRC) \
128         $(TELE_RECEIVER_SRC) \
129         $(TELE_DRIVER_SRC) \
130         $(TELE_COMMON_SRC) \
131         $(TELE_FAKE_SRC) \
132         $(TT_MAIN_SRC)
133
134
135 #
136 # Sources for TeleDongle
137 #
138
139 TD_MAIN_SRC = \
140         ao_teledongle.c
141
142 TD_SRC = \
143         $(ALTOS_SRC) \
144         $(ALTOS_DRIVER_SRC) \
145         $(TELE_RECEIVER_SRC) \
146         $(TELE_COMMON_SRC) \
147         $(TELE_FAKE_SRC) \
148         $(TD_MAIN_SRC)
149
150 SRC = \
151         $(ALTOS_SRC) \
152         $(ALTOS_DRIVER_SRC) \
153         $(TELE_DRIVER_SRC) \
154         $(TELE_RECEIVER_SRC) \
155         $(TELE_COMMON_SRC) \
156         $(TELE_FAKE_SRC) \
157         $(TM_DRIVER_SRC) \
158         $(TM_TASK_SRC) \
159         $(TM_MAIN_SRC) \
160         $(TI_MAIN_SRC) \
161         $(TD_MAIN_SRC) \
162         $(TT_MAIN_SRC)
163
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
168
169 PROD_REL=\
170         ao_product-telemetrum.rel \
171         ao_product-tidongle.rel \
172         ao_product-teleterra.rel \
173         ao_product-teledongle.rel
174
175 REL=$(SRC:.c=.rel) $(PROD_REL)
176 ADB=$(REL:.rel=.adb)
177 ASM=$(REL:.rel=.asm)
178 LNK=$(REL:.rel=.lnk)
179 LST=$(REL:.rel=.lst)
180 RST=$(REL:.rel=.rst)
181 SYM=$(REL:.rel=.sym)
182
183 PROGS=  telemetrum.ihx tidongle.ihx \
184         teleterra.ihx teledongle.ihx
185
186 HOST_PROGS=ao_flight_test ao_gps_test
187
188 PCDB=$(PROGS:.ihx=.cdb)
189 PLNK=$(PROGS:.ihx=.lnk)
190 PMAP=$(PROGS:.ihx=.map)
191 PMEM=$(PROGS:.ihx=.mem)
192 PAOM=$(PROGS:.ihx=)
193
194 %.rel : %.c $(INC)
195         $(CC) -c $(CFLAGS) -o$*.rel $*.c
196
197 all: $(PROGS) $(HOST_PROGS)
198
199 telemetrum.ihx: $(TM_REL) Makefile
200         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
201         sh check-stack ao.h telemetrum.mem
202
203 tidongle.ihx: $(TI_REL) Makefile
204         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
205         sh check-stack ao.h tidongle.mem
206
207 tidongle.ihx: telemetrum.ihx
208
209 teleterra.ihx: $(TT_REL) Makefile
210         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
211         sh check-stack ao.h teleterra.mem
212
213 teleterra.ihx: tidongle.ihx
214
215 teledongle.ihx: $(TD_REL) Makefile
216         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
217         sh check-stack ao.h teledongle.mem
218
219 teledongle.ihx: teleterra.ihx
220
221 altitude.h: make-altitude
222         nickle make-altitude > altitude.h
223
224 TELEMETRUM_DEFS=ao-telemetrum.h
225 TELETERRA_DEFS=ao-teleterra.h
226 TELEDONGLE_DEFS=ao-teledongle.h
227 TIDONGLE_DEFS=ao-tidongle.h
228
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
233
234 ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
235         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
236
237 ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
238         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
239
240 ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
241         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
242
243 $(TELEMETRUM_DEFS): ao-make-product.5c
244         nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
245
246 $(TELETERRA_DEFS): ao-make-product.5c
247         nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
248
249 $(TELEDONGLE_DEFS): ao-make-product.5c
250         nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
251
252 $(TIDONGLE_DEFS): ao-make-product.5c
253         nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
254
255 distclean:      clean
256
257 clean:
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)
262
263 install:
264
265 ao_flight_test: ao_flight.c ao_flight_test.c ao_host.h
266         cc -g -o $@ ao_flight_test.c
267
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