2a6b7adc4f217b4dba59d3b4e2b416de154281dc
[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
66 #
67 # Tasks run on TeleMetrum
68 #
69 TM_TASK_SRC = \
70         ao_flight.c \
71         ao_log.c \
72         ao_report.c \
73         ao_telemetry.c \
74         ao_telemetrum.c
75
76 #
77 # All sources for TeleMetrum
78 #
79 TM_SRC = \
80         $(ALTOS_SRC) \
81         $(ALTOS_DRIVER_SRC) \
82         $(TELE_DRIVER_SRC) \
83         $(TELE_COMMON_SRC) \
84         $(TM_DRIVER_SRC) \
85         $(TM_TASK_SRC)
86
87 TI_TASK_SRC = \
88         ao_tidongle.c
89
90 #
91 # All sources for the TI debug dongle
92 #
93 TI_SRC = \
94         $(ALTOS_SRC) \
95         $(ALTOS_DRIVER_SRC) \
96         $(TELE_RECEIVER_SRC) \
97         $(TELE_COMMON_SRC) \
98         $(TI_TASK_SRC)
99         
100 TT_TASK_SRC = \
101         ao_teleterra.c
102 #
103 # All sources for TeleTerra
104 #
105 TT_SRC = \
106         $(ALTOS_SRC) \
107         $(ALTOS_DRIVER_SRC) \
108         $(TELE_RECEIVER_SRC) \
109         $(TELE_DRIVER_SRC) \
110         $(TELE_COMMON_SRC) \
111         $(TT_TASK_SRC)
112         
113         
114 #
115 # Sources for TeleDongle
116 #
117
118 TD_TASK_SRC = \
119         ao_teledongle.c
120
121 TD_SRC = \
122         $(ALTOS_SRC) \
123         $(ALTOS_DRIVER_SRC) \
124         $(TELE_RECEIVER_SRC) \
125         $(TELE_COMMON_SRC) \
126         $(TD_TASK_SRC)
127
128 SRC = \
129         $(ALTOS_SRC) \
130         $(ALTOS_DRIVER_SRC) \
131         $(TELE_DRIVER_SRC) \
132         $(TELE_RECEIVER_SRC) \
133         $(TELE_COMMON_SRC) \
134         $(TM_DRIVER_SRC) \
135         $(TM_TASK_SRC) \
136         $(TI_TASK_SRC) \
137         $(TT_TASK_SRC) \
138         $(TD_TASK_SRC)
139
140 TM_REL=$(TM_SRC:.c=.rel)
141 TI_REL=$(TI_SRC:.c=.rel)
142 TT_REL=$(TT_SRC:.c=.rel)
143 TD_REL=$(TD_SRC:.c=.rel)
144
145 ADB=$(SRC:.c=.adb)
146 ASM=$(SRC:.c=.asm)
147 LNK=$(SRC:.c=.lnk)
148 LST=$(SRC:.c=.lst)
149 REL=$(SRC:.c=.rel)
150 RST=$(SRC:.c=.rst)
151 SYM=$(SRC:.c=.sym)
152
153 PROGS=telemetrum.ihx tidongle.ihx teleterra.ihx teledongle.ihx
154
155 PCDB=$(PROGS:.ihx=.cdb)
156 PLNK=$(PROGS:.ihx=.lnk)
157 PMAP=$(PROGS:.ihx=.map)
158 PMEM=$(PROGS:.ihx=.mem)
159 PAOM=$(PROGS:.ihx=)
160
161 %.rel : %.c $(INC)
162         $(CC) -c $(CFLAGS) -o$*.rel $*.c
163
164 all: $(PROGS)
165
166 telemetrum.ihx: $(TM_REL) Makefile
167         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
168         sh check-stack ao.h telemetrum.mem
169
170 tidongle.ihx: $(TI_REL) Makefile
171         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
172         sh check-stack ao.h tidongle.mem
173
174 tidongle.ihx: telemetrum.ihx
175
176 teleterra.ihx: $(TT_REL) Makefile
177         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
178         sh check-stack ao.h teleterra.mem
179
180 teleterra.ihx: tidongle.ihx
181
182 teledongle.ihx: $(TD_REL) Makefile
183         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
184         sh check-stack ao.h teledongle.mem
185
186 teledongle.ihx: teleterra.ihx
187
188 altitude.h: make-altitude
189         nickle make-altitude > altitude.h
190
191 clean:
192         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
193         rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
194
195 install: