c79638acfbd30c62a6047739677979369a9d58b7
[fw/altos] / src / Makefile.proto
1 #
2 # AltOS build
3 #
4 #
5 vpath %.c ..
6 vpath %.h ..
7 vpath make-altitude ..
8 vpath ao-make-product.5c ..
9
10 CC=sdcc
11
12 ifndef VERSION
13 include ../Version
14 endif
15
16 CFLAGS=--model-small --debug --opt-code-speed
17
18 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
19         --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
20
21 INC = \
22         ao.h \
23         ao_pins.h \
24         cc1111.h \
25         altitude.h \
26         25lc1024.h
27
28 #
29 # Common AltOS sources
30 #
31 ALTOS_SRC = \
32         ao_cmd.c \
33         ao_dma.c \
34         ao_mutex.c \
35         ao_panic.c \
36         ao_task.c \
37         ao_timer.c \
38         ao_romconfig.c \
39         _bp.c
40
41 #
42 # Shared AltOS drivers
43 #
44 ALTOS_DRIVER_SRC = \
45         ao_beep.c \
46         ao_config.c \
47         ao_led.c \
48         ao_radio.c \
49         ao_stdio.c \
50         ao_usb.c
51
52 TELE_COMMON_SRC = \
53         ao_packet.c \
54         ao_packet_slave.c \
55         ao_state.c
56
57 #
58 # Receiver code
59 #
60 TELE_RECEIVER_SRC =\
61         ao_monitor.c \
62         ao_gps_print.c \
63         ao_packet_master.c \
64         ao_rssi.c
65
66 #
67 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
68 #
69
70 TELE_DRIVER_SRC = \
71         ao_convert.c \
72         ao_serial.c
73
74 #
75 # Spi bus driver
76 #
77 SPI_DRIVER_SRC = \
78         ao_spi.c
79
80 #
81 # Debug dongle driver (only on TI)
82 #
83 DBG_SRC = \
84         ao_dbg.c
85
86 #
87 # Drivers only on TeleMetrum
88 #
89 TM_DRIVER_SRC = \
90         ao_adc.c \
91         ao_gps_report.c \
92         ao_ignite.c
93
94 #
95 # 25LC1024 driver source
96 EE_DRIVER_SRC = \
97         ao_ee.c
98
99 #
100 # AT45DB161D driver source
101
102 FLASH_DRIVER_SRC = \
103         ao_flash.c
104
105 #
106 # SiRF driver source
107 #
108 SIRF_DRIVER_SRC = \
109         ao_gps_sirf.c
110 #
111 # Skytraq driver source
112 #
113 SKY_DRIVER_SRC = \
114         ao_gps_skytraq.c
115
116 #
117 # Tasks run on TeleMetrum
118 #
119 TM_TASK_SRC = \
120         ao_flight.c \
121         ao_log.c \
122         ao_report.c \
123         ao_telemetry.c
124
125 TM_MAIN_SRC = \
126         ao_telemetrum.c
127
128 #
129 # Base sources for TeleMetrum
130 #
131 TM_BASE_SRC = \
132         $(ALTOS_SRC) \
133         $(ALTOS_DRIVER_SRC) \
134         $(TELE_DRIVER_SRC) \
135         $(TELE_COMMON_SRC) \
136         $(TM_DRIVER_SRC) \
137         $(TM_TASK_SRC) \
138         $(TM_MAIN_SRC)
139
140 TI_MAIN_SRC = \
141         ao_tidongle.c
142
143 #
144 # All sources for the TI debug dongle
145 #
146 TI_SRC = \
147         $(ALTOS_SRC) \
148         $(ALTOS_DRIVER_SRC) \
149         $(TELE_RECEIVER_SRC) \
150         $(TELE_COMMON_SRC) \
151         $(TI_MAIN_SRC) \
152         $(DBG_SRC)
153
154 TT_MAIN_SRC = \
155         ao_teleterra.c
156 #
157 # All sources for TeleTerra
158 #
159 TT_SRC = \
160         $(ALTOS_SRC) \
161         $(ALTOS_DRIVER_SRC) \
162         $(TELE_RECEIVER_SRC) \
163         $(TELE_DRIVER_SRC) \
164         $(TELE_COMMON_SRC) \
165         $(TT_MAIN_SRC)
166
167
168 #
169 # Sources for TeleDongle
170 #
171
172 TD_MAIN_SRC = \
173         ao_teledongle.c
174
175 TD_SRC = \
176         $(ALTOS_SRC) \
177         $(ALTOS_DRIVER_SRC) \
178         $(TELE_RECEIVER_SRC) \
179         $(TELE_COMMON_SRC) \
180         $(TD_MAIN_SRC)
181
182 include Makefile.defs
183
184 CFLAGS += $(PRODUCT_DEF) -I.
185
186 NICKLE=nickle
187 CHECK_STACK=sh ../check-stack
188
189 REL=$(SRC:.c=.rel) ao_product.rel
190 ADB=$(REL:.rel=.adb)
191 ASM=$(REL:.rel=.asm)
192 LNK=$(REL:.rel=.lnk)
193 LST=$(REL:.rel=.lst)
194 RST=$(REL:.rel=.rst)
195 SYM=$(REL:.rel=.sym)
196
197 PCDB=$(PROG:.ihx=.cdb)
198 PLNK=$(PROG:.ihx=.lnk)
199 PMAP=$(PROG:.ihx=.map)
200 PMEM=$(PROG:.ihx=.mem)
201 PAOM=$(PROG:.ihx=)
202
203 V=0
204 # The user has explicitly enabled quiet compilation.
205 ifeq ($(V),0)
206 quiet = @printf "  $1 $2 $@\n"; $($1)
207 endif
208 # Otherwise, print the full command line.
209 quiet ?= $($1)
210
211 %.rel : %.c $(INC)
212         $(call quiet,CC,$(PRODUCT_DEF)) $(CFLAGS) -c -o$@ $<
213
214 all: ../$(PROG)
215
216 ../$(PROG): $(REL) Makefile Makefile.defs ../Makefile.proto
217         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
218         $(call quiet,CHECK_STACK) ../ao.h $(PMEM)
219
220 ../altitude.h: make-altitude
221         nickle $< > $@
222
223 ao_product.h: ao-make-product.5c ../Version
224         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
225
226 ao_product.rel: ao_product.c ao_product.h
227         $(call quiet,CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"ao_product.h\"' -o$@ $<
228
229 distclean:      clean
230
231 clean:
232         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
233         rm -f $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
234         rm -f ao_product.h
235         rm -f ../$(PROG)
236
237 install:
238
239 uninstall: