1##############################################################################
2# Main makefile for basic_modem
3##############################################################################
4-include app_makefiles/app_printing.mk
5-include app_makefiles/app_options.mk
6
7
8#-----------------------------------------------------------------------------
9# default action: print help
10#-----------------------------------------------------------------------------
11help:
12	$(call echo_help_b, "Available TARGETs:	sx128x	lr1110	lr1120	lr1121	sx1261	sx1262	sx1268 sx1272 sx1276")
13	$(call echo_help, "")
14	$(call echo_help_b, "-------------------------------- Clean -------------------------------------")
15	$(call echo_help, " * make clean_<TARGET>             : clean basic_modem app and lib for a given target")
16	$(call echo_help, " * make clean_all                  : clean all")
17	$(call echo_help, " * make clean_app                  : clean basic_modem app")
18	$(call echo_help, "")
19	$(call echo_help_b, "----------------------------- Compilation ----------------------------------")
20	$(call echo_help, " * make <TARGET>                   : build basic_modem app and lib on a given target")
21	$(call echo_help, "")
22	$(call echo_help_b, "---------------------------- All inclusive ---------------------------------")
23	$(call echo_help, " * make full_<TARGET>              : clean and build basic_modem on a given target")
24	$(call echo_help, "")
25	$(call echo_help_b, "---------------------- Optional build parameters ---------------------------")
26	$(call echo_help, " * BOARD=xxx                       : choose which mcu board will be used:(default is NUCLEO_L476)")
27	$(call echo_help, " *                                  - NUCLEO_L476")
28	$(call echo_help, " *                                  - NUCLEO_L073")
29	$(call echo_help, " * MODEM_APP=xxx                   : choose which modem application to build:(default is PERIODICAL_UPLINK)")
30	$(call echo_help, " *                                  - PERIODICAL_UPLINK")
31	$(call echo_help, " *                                  - HW_MODEM")
32	$(call echo_help, " *                                  - PORTING_TESTS")
33	$(call echo_help, " *                                  - LCTT_CERTIF")
34	$(call echo_help, " * REGION=xxx                      : choose which region should be compiled (default: all)")
35	$(call echo_help, " *                                  - AS_923")
36	$(call echo_help, " *                                  - AU_915")
37	$(call echo_help, " *                                  - CN_470")
38	$(call echo_help, " *                                  - CN_470_RP_1_0")
39	$(call echo_help, " *                                  - EU_868")
40	$(call echo_help, " *                                  - IN_865")
41	$(call echo_help, " *                                  - KR_920")
42	$(call echo_help, " *                                  - RU_864")
43	$(call echo_help, " *                                  - US_915")
44	$(call echo_help, " *                                  - WW_2G4 (to be used only for lr1120 and sx128x targets)")
45	$(call echo_help, " * CRYPTO=xxx                      : choose which crypto should be compiled (default: SOFT)")
46	$(call echo_help, " *                                  - SOFT")
47	$(call echo_help, " *                                  - LR11XX (only for lr1110 and lr1120 targets)")
48	$(call echo_help, " *                                  - LR11XX_WITH_CREDENTIALS (only for lr1110 and lr1120 targets)")
49	$(call echo_help, " * LBM_TRACE=yes/no                : choose to enable or disable modem trace print (default: trace is ON)")
50	$(call echo_help, " * APP_TRACE=yes/no                : choose to enable or disable application trace print (default: trace is ON)")
51	$(call echo_help, " * ALLOW_RELAY_TX=yes/no           : choose to enable or disable RelayTx (default: no)")
52	$(call echo_help, " * ALLOW_RELAY_RX=yes/no           : choose to enable or disable RelayRx (default: no)")
53	$(call echo_help_b, "-------------------- Optional makefile parameters --------------------------")
54	$(call echo_help, " * MULTITHREAD=no                  : Disable multithreaded build")
55	$(call echo_help, " * VERBOSE=yes                     : Increase build verbosity")
56	$(call echo_help, " * SIZE=yes                        : Display size for all objects")
57	$(call echo_help, " * DEBUG=yes                       : Compile library and application with debug symbols")
58
59
60
61#-----------------------------------------------------------------------------
62# Makefile include selection
63#-----------------------------------------------------------------------------
64ifeq ($(TARGET_RADIO),lr1110)
65-include app_makefiles/app_lr11xx.mk
66endif
67
68ifeq ($(TARGET_RADIO),lr1120)
69-include app_makefiles/app_lr11xx.mk
70endif
71
72ifeq ($(TARGET_RADIO),lr1121)
73-include app_makefiles/app_lr11xx.mk
74endif
75
76ifeq ($(TARGET_RADIO),sx1261)
77-include app_makefiles/app_sx126x.mk
78endif
79
80ifeq ($(TARGET_RADIO),sx1262)
81-include app_makefiles/app_sx126x.mk
82endif
83
84ifeq ($(TARGET_RADIO),sx1268)
85-include app_makefiles/app_sx126x.mk
86endif
87
88ifeq ($(TARGET_RADIO),sx128x)
89-include app_makefiles/app_sx128x.mk
90endif
91
92ifeq ($(TARGET_RADIO),sx1272)
93-include app_makefiles/app_sx127x.mk
94endif
95
96ifeq ($(TARGET_RADIO),sx1276)
97-include app_makefiles/app_sx127x.mk
98endif
99
100#-----------------------------------------------------------------------------
101-include app_makefiles/app_common.mk
102
103.PHONY: clean_all help
104
105#-----------------------------------------------------------------------------
106# Clean
107#-----------------------------------------------------------------------------
108clean_all: clean_app
109	$(MAKE) -C $(LORA_BASICS_MODEM) clean_all $(MTHREAD_FLAG)
110
111clean_lr1110:
112	$(MAKE) clean_modem TARGET_RADIO=lr1110
113	$(MAKE) clean_target TARGET_RADIO=lr1110
114
115clean_lr1120:
116	$(MAKE) clean_modem TARGET_RADIO=lr1120
117	$(MAKE) clean_target TARGET_RADIO=lr1120
118
119clean_lr1121:
120	$(MAKE) clean_modem TARGET_RADIO=lr1121
121	$(MAKE) clean_target TARGET_RADIO=lr1121
122
123clean_sx1261:
124	$(MAKE) clean_modem TARGET_RADIO=sx1261
125	$(MAKE) clean_target TARGET_RADIO=sx1261
126
127clean_sx1262:
128	$(MAKE) clean_modem TARGET_RADIO=sx1262
129	$(MAKE) clean_target TARGET_RADIO=sx1262
130
131clean_sx1268:
132	$(MAKE) clean_modem TARGET_RADIO=sx1268
133	$(MAKE) clean_target TARGET_RADIO=sx1268
134
135clean_sx128x:
136	$(MAKE) clean_modem TARGET_RADIO=sx128x
137	$(MAKE) clean_target TARGET_RADIO=sx128x
138
139clean_sx1272:
140	$(MAKE) clean_modem TARGET_RADIO=sx1272
141	$(MAKE) clean_target TARGET_RADIO=sx1272
142
143clean_sx1276:
144	$(MAKE) clean_modem TARGET_RADIO=sx1276
145	$(MAKE) clean_target TARGET_RADIO=sx1276
146
147clean:
148	$(MAKE) clean_modem
149	$(MAKE) clean_target
150
151clean_app:
152	-rm -rf $(APPBUILD_ROOT)*
153
154
155#-----------------------------------------------------------------------------
156# Application Compilation
157#-----------------------------------------------------------------------------
158
159#-- Generic -------------------------------------------------------------------
160app:
161ifeq ($(TARGET_RADIO),nc)
162	$(call echo_error,"No radio selected! Please specified the target radio using TARGET_RADIO=radio_name option")
163else
164ifneq ($(CRYPTO),SOFT)
165ifneq ($(LBM_NB_OF_STACK),1)
166	$(call echo_error, "----------------------------------------------------------")
167	$(call echo_error, "More than one stack compiled: only soft crypto can be used")
168	$(call echo_error, "Please use CRYPTO=SOFT option")
169	$(call echo_error, "----------------------------------------------------------")
170	exit 1
171endif
172ifneq ($(TARGET_RADIO),lr1110)
173ifneq ($(TARGET_RADIO),lr1120)
174ifneq ($(TARGET_RADIO),lr1121)
175	$(call echo_error, "------------------------------------------------------------")
176	$(call echo_error, "sx126x, sx127x and sx128x radio tagets: only soft crypto can be used")
177	$(call echo_error, "Please use CRYPTO=SOFT option")
178	$(call echo_error, "------------------------------------------------------------")
179	exit 1
180endif
181endif
182endif
183endif
184	$(MAKE) app_build
185endif
186
187#-- LR1110 -------------------------------------------------------------------
188lr1110:
189	$(MAKE) app TARGET_RADIO=lr1110 $(MTHREAD_FLAG)
190
191full_lr1110:
192	$(MAKE) clean_modem TARGET_RADIO=lr1110
193	$(MAKE) clean_target TARGET_RADIO=lr1110
194	$(MAKE) app TARGET_RADIO=lr1110 $(MTHREAD_FLAG)
195
196#-- LR1120 -------------------------------------------------------------------
197lr1120:
198	$(MAKE) app TARGET_RADIO=lr1120 $(MTHREAD_FLAG)
199
200full_lr1120:
201	$(MAKE) clean_modem TARGET_RADIO=lr1120
202	$(MAKE) clean_target TARGET_RADIO=lr1120
203	$(MAKE) app TARGET_RADIO=lr1120 $(MTHREAD_FLAG)
204
205#-- LR1121 -------------------------------------------------------------------
206lr1121:
207	$(MAKE) app TARGET_RADIO=lr1121 $(MTHREAD_FLAG)
208
209full_lr1121:
210	$(MAKE) clean_modem TARGET_RADIO=lr1121
211	$(MAKE) clean_target TARGET_RADIO=lr1121
212	$(MAKE) app TARGET_RADIO=lr1121 $(MTHREAD_FLAG)
213
214#-- SX1261 -------------------------------------------------------------------
215sx1261:
216	$(MAKE) app TARGET_RADIO=sx1261 $(MTHREAD_FLAG)
217
218full_sx1261:
219	$(MAKE) clean_modem TARGET_RADIO=sx1261
220	$(MAKE) clean_target TARGET_RADIO=sx1261
221	$(MAKE) app TARGET_RADIO=sx1261 $(MTHREAD_FLAG)
222
223#-- SX1262 -------------------------------------------------------------------
224sx1262:
225	$(MAKE) app TARGET_RADIO=sx1262 $(MTHREAD_FLAG)
226
227full_sx1262:
228	$(MAKE) clean_modem TARGET_RADIO=sx1262
229	$(MAKE) clean_target TARGET_RADIO=sx1262
230	$(MAKE) app TARGET_RADIO=sx1262 $(MTHREAD_FLAG)
231
232#-- SX1268 -------------------------------------------------------------------
233sx1268:
234	$(MAKE) app TARGET_RADIO=sx1268 $(MTHREAD_FLAG)
235
236full_sx1268:
237	$(MAKE) clean_modem TARGET_RADIO=sx1268
238	$(MAKE) clean_target TARGET_RADIO=sx1268
239	$(MAKE) app TARGET_RADIO=sx1268 $(MTHREAD_FLAG)
240
241#-- SX128x -------------------------------------------------------------------
242sx128x:
243	$(MAKE) app TARGET_RADIO=sx128x $(MTHREAD_FLAG)
244
245full_sx128x:
246	$(MAKE) clean_modem TARGET_RADIO=sx128x
247	$(MAKE) clean_target TARGET_RADIO=sx128x
248	$(MAKE) app TARGET_RADIO=sx128x $(MTHREAD_FLAG)
249
250#-- SX1272 -------------------------------------------------------------------
251sx1272:
252	$(MAKE) app TARGET_RADIO=sx1272 $(MTHREAD_FLAG)
253
254full_sx1272:
255	$(MAKE) clean_modem TARGET_RADIO=sx1272
256	$(MAKE) clean_target TARGET_RADIO=sx1272
257	$(MAKE) app TARGET_RADIO=sx1272 $(MTHREAD_FLAG)
258
259#-- SX1276 -------------------------------------------------------------------
260sx1276:
261	$(MAKE) app TARGET_RADIO=sx1276 $(MTHREAD_FLAG)
262
263full_sx1276:
264	$(MAKE) clean_modem TARGET_RADIO=sx1276
265	$(MAKE) clean_target TARGET_RADIO=sx1276
266	$(MAKE) app TARGET_RADIO=sx1276 $(MTHREAD_FLAG)
267