Add configuration support
[fw/altos] / Makefile
1 #
2 # AltOS build
3 #
4
5 CC=sdcc
6
7 CFLAGS=--model-small --debug --opt-code-speed 
8
9 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
10         --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
11
12 INC = \
13         ao.h \
14         cc1111.h \
15         altitude.h \
16         25lc1024.h
17
18 #
19 # Common AltOS sources
20 #
21 ALTOS_SRC = \
22         ao_cmd.c \
23         ao_dbg.c \
24         ao_dma.c \
25         ao_mutex.c \
26         ao_panic.c \
27         ao_task.c \
28         ao_timer.c \
29         _bp.c
30
31 #
32 # Shared AltOS drivers
33 #
34 ALTOS_DRIVER_SRC = \
35         ao_beep.c \
36         ao_config.c \
37         ao_led.c \
38         ao_radio.c \
39         ao_stdio.c \
40         ao_usb.c
41
42 TELE_COMMON_SRC = \
43         ao_gps_print.c
44
45 #
46 # Receiver code
47 #
48 TELE_RECEIVER_SRC =\
49         ao_monitor.c
50
51 #
52 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
53 #
54
55 TELE_DRIVER_SRC = \
56         ao_convert.c \
57         ao_gps.c \
58         ao_serial.c
59
60 #
61 # Drivers for partially-flled boards (TT, TD and TI)
62 #
63 TELE_FAKE_SRC = \
64         ao_adc_fake.c \
65         ao_ee_fake.c
66
67
68 # Drivers only on TeleMetrum
69 #
70 TM_DRIVER_SRC = \
71         ao_adc.c \
72         ao_ee.c \
73         ao_gps_report.c \
74         ao_ignite.c
75
76 #
77 # Tasks run on TeleMetrum
78 #
79 TM_TASK_SRC = \
80         ao_flight.c \
81         ao_log.c \
82         ao_report.c \
83         ao_telemetry.c \
84         ao_telemetrum.c
85
86 #
87 # All sources for TeleMetrum
88 #
89 TM_SRC = \
90         $(ALTOS_SRC) \
91         $(ALTOS_DRIVER_SRC) \
92         $(TELE_DRIVER_SRC) \
93         $(TELE_RECEIVER_SRC) \
94         $(TELE_COMMON_SRC) \
95         $(TM_DRIVER_SRC) \
96         $(TM_TASK_SRC)
97
98 TI_TASK_SRC = \
99         ao_tidongle.c
100
101 #
102 # All sources for the TI debug dongle
103 #
104 TI_SRC = \
105         $(ALTOS_SRC) \
106         $(ALTOS_DRIVER_SRC) \
107         $(TELE_RECEIVER_SRC) \
108         $(TELE_COMMON_SRC) \
109         $(TELE_FAKE_SRC) \
110         $(TI_TASK_SRC)
111         
112 TT_TASK_SRC = \
113         ao_teleterra.c
114 #
115 # All sources for TeleTerra
116 #
117 TT_SRC = \
118         $(ALTOS_SRC) \
119         $(ALTOS_DRIVER_SRC) \
120         $(TELE_RECEIVER_SRC) \
121         $(TELE_DRIVER_SRC) \
122         $(TELE_COMMON_SRC) \
123         $(TELE_FAKE_SRC) \
124         $(TT_TASK_SRC)
125         
126         
127 #
128 # Sources for TeleDongle
129 #
130
131 TD_TASK_SRC = \
132         ao_teledongle.c
133
134 TD_SRC = \
135         $(ALTOS_SRC) \
136         $(ALTOS_DRIVER_SRC) \
137         $(TELE_RECEIVER_SRC) \
138         $(TELE_COMMON_SRC) \
139         $(TELE_FAKE_SRC) \
140         $(TD_TASK_SRC)
141
142 SRC = \
143         $(ALTOS_SRC) \
144         $(ALTOS_DRIVER_SRC) \
145         $(TELE_DRIVER_SRC) \
146         $(TELE_RECEIVER_SRC) \
147         $(TELE_COMMON_SRC) \
148         $(TELE_FAKE_SRC) \
149         $(TM_DRIVER_SRC) \
150         $(TM_TASK_SRC) \
151         $(TI_TASK_SRC) \
152         $(TT_TASK_SRC) \
153         $(TD_TASK_SRC)
154
155 TM_REL=$(TM_SRC:.c=.rel)
156 TI_REL=$(TI_SRC:.c=.rel)
157 TT_REL=$(TT_SRC:.c=.rel)
158 TD_REL=$(TD_SRC:.c=.rel)
159
160 ADB=$(SRC:.c=.adb)
161 ASM=$(SRC:.c=.asm)
162 LNK=$(SRC:.c=.lnk)
163 LST=$(SRC:.c=.lst)
164 REL=$(SRC:.c=.rel)
165 RST=$(SRC:.c=.rst)
166 SYM=$(SRC:.c=.sym)
167
168 PROGS=telemetrum.ihx tidongle.ihx teleterra.ihx teledongle.ihx
169
170 HOST_PROGS=ao_flight_test
171
172 PCDB=$(PROGS:.ihx=.cdb)
173 PLNK=$(PROGS:.ihx=.lnk)
174 PMAP=$(PROGS:.ihx=.map)
175 PMEM=$(PROGS:.ihx=.mem)
176 PAOM=$(PROGS:.ihx=)
177
178 %.rel : %.c $(INC)
179         $(CC) -c $(CFLAGS) -o$*.rel $*.c
180
181 all: $(PROGS) $(HOST_PROGS)
182
183 telemetrum.ihx: $(TM_REL) Makefile
184         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
185         sh check-stack ao.h telemetrum.mem
186
187 tidongle.ihx: $(TI_REL) Makefile
188         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
189         sh check-stack ao.h tidongle.mem
190
191 tidongle.ihx: telemetrum.ihx
192
193 teleterra.ihx: $(TT_REL) Makefile
194         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
195         sh check-stack ao.h teleterra.mem
196
197 teleterra.ihx: tidongle.ihx
198
199 teledongle.ihx: $(TD_REL) Makefile
200         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
201         sh check-stack ao.h teledongle.mem
202
203 teledongle.ihx: teleterra.ihx
204
205 altitude.h: make-altitude
206         nickle make-altitude > altitude.h
207
208 clean:
209         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
210         rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
211
212 install:
213
214 ao_flight_test: ao_flight.c ao_flight_test.c
215         cc -g -o $@ ao_flight_test.c