8ef86be5415c81c9074266a7e9a5207d35b67302
[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_led.c \
37         ao_radio.c \
38         ao_stdio.c \
39         ao_usb.c
40
41 TELE_COMMON_SRC = \
42         ao_gps_print.c
43
44 #
45 # Receiver code
46 #
47 TELE_RECEIVER_SRC =\
48         ao_monitor.c
49
50 #
51 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
52 #
53
54 TELE_DRIVER_SRC = \
55         ao_convert.c \
56         ao_gps.c \
57         ao_serial.c
58
59
60 # Drivers only on TeleMetrum
61 #
62 TM_DRIVER_SRC = \
63         ao_adc.c \
64         ao_ee.c \
65         ao_ignite.c
66
67 #
68 # Tasks run on TeleMetrum
69 #
70 TM_TASK_SRC = \
71         ao_flight.c \
72         ao_log.c \
73         ao_report.c \
74         ao_telemetry.c \
75         ao_telemetrum.c
76
77 #
78 # All sources for TeleMetrum
79 #
80 TM_SRC = \
81         $(ALTOS_SRC) \
82         $(ALTOS_DRIVER_SRC) \
83         $(TELE_DRIVER_SRC) \
84         $(TELE_RECEIVER_SRC) \
85         $(TELE_COMMON_SRC) \
86         $(TM_DRIVER_SRC) \
87         $(TM_TASK_SRC)
88
89 TI_TASK_SRC = \
90         ao_tidongle.c
91
92 #
93 # All sources for the TI debug dongle
94 #
95 TI_SRC = \
96         $(ALTOS_SRC) \
97         $(ALTOS_DRIVER_SRC) \
98         $(TELE_RECEIVER_SRC) \
99         $(TELE_COMMON_SRC) \
100         $(TI_TASK_SRC)
101         
102 TT_TASK_SRC = \
103         ao_teleterra.c
104 #
105 # All sources for TeleTerra
106 #
107 TT_SRC = \
108         $(ALTOS_SRC) \
109         $(ALTOS_DRIVER_SRC) \
110         $(TELE_RECEIVER_SRC) \
111         $(TELE_DRIVER_SRC) \
112         $(TELE_COMMON_SRC) \
113         $(TT_TASK_SRC)
114         
115         
116 #
117 # Sources for TeleDongle
118 #
119
120 TD_TASK_SRC = \
121         ao_teledongle.c
122
123 TD_SRC = \
124         $(ALTOS_SRC) \
125         $(ALTOS_DRIVER_SRC) \
126         $(TELE_RECEIVER_SRC) \
127         $(TELE_COMMON_SRC) \
128         $(TD_TASK_SRC)
129
130 SRC = \
131         $(ALTOS_SRC) \
132         $(ALTOS_DRIVER_SRC) \
133         $(TELE_DRIVER_SRC) \
134         $(TELE_RECEIVER_SRC) \
135         $(TELE_COMMON_SRC) \
136         $(TM_DRIVER_SRC) \
137         $(TM_TASK_SRC) \
138         $(TI_TASK_SRC) \
139         $(TT_TASK_SRC) \
140         $(TD_TASK_SRC)
141
142 TM_REL=$(TM_SRC:.c=.rel)
143 TI_REL=$(TI_SRC:.c=.rel)
144 TT_REL=$(TT_SRC:.c=.rel)
145 TD_REL=$(TD_SRC:.c=.rel)
146
147 ADB=$(SRC:.c=.adb)
148 ASM=$(SRC:.c=.asm)
149 LNK=$(SRC:.c=.lnk)
150 LST=$(SRC:.c=.lst)
151 REL=$(SRC:.c=.rel)
152 RST=$(SRC:.c=.rst)
153 SYM=$(SRC:.c=.sym)
154
155 PROGS=telemetrum.ihx tidongle.ihx teleterra.ihx teledongle.ihx
156
157 HOST_PROGS=ao_flight_test
158
159 PCDB=$(PROGS:.ihx=.cdb)
160 PLNK=$(PROGS:.ihx=.lnk)
161 PMAP=$(PROGS:.ihx=.map)
162 PMEM=$(PROGS:.ihx=.mem)
163 PAOM=$(PROGS:.ihx=)
164
165 %.rel : %.c $(INC)
166         $(CC) -c $(CFLAGS) -o$*.rel $*.c
167
168 all: $(PROGS) $(HOST_PROGS)
169
170 telemetrum.ihx: $(TM_REL) Makefile
171         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
172         sh check-stack ao.h telemetrum.mem
173
174 tidongle.ihx: $(TI_REL) Makefile
175         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
176         sh check-stack ao.h tidongle.mem
177
178 tidongle.ihx: telemetrum.ihx
179
180 teleterra.ihx: $(TT_REL) Makefile
181         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
182         sh check-stack ao.h teleterra.mem
183
184 teleterra.ihx: tidongle.ihx
185
186 teledongle.ihx: $(TD_REL) Makefile
187         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
188         sh check-stack ao.h teledongle.mem
189
190 teledongle.ihx: teleterra.ihx
191
192 altitude.h: make-altitude
193         nickle make-altitude > altitude.h
194
195 clean:
196         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
197         rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
198
199 install:
200
201 ao_flight_test: ao_flight.c ao_flight_test.c
202         cc -g -o $@ ao_flight_test.c