-
Notifications
You must be signed in to change notification settings - Fork 194
/
Makefile
357 lines (283 loc) · 9.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
PROJECT?=6lbr-demo
# Configuration
WITH_RPL?=1
RPL_NON_STORING?=0
WITH_LLSEC?=0
WITH_ADAPTIVESEC?=0
WITH_TCP?=0
WITH_TSCH?=0
# Applications
WITH_SHELL?=0
WITH_UDPCLIENT?=1
WITH_WEBSERVER?=0
WITH_COAPSERVER?=0
WITH_TINYDTLS?=0
WITH_DTLSECHO?=0
WITH_DTLS_COAP?=0
WITH_COAP_PROFILE?=IPSO_APP_FW
WITH_MULTICAST_CLIENT?=0
# UDP client configuration
UDP_PERIOD?=5
WITH_UDP_CLIENT_AUTOSTART?=1
# Platform specific
CC2538_FW=bin
# End of user configuration section
all: $(PROJECT)
CONTIKI?=../..
PROJECTDIR?=.
APPDIRS += $(PROJECTDIR)/apps
PROJECTDIRS += $(PROJECTDIR)/platform $(PROJECTDIR)/platform/contiki $(PROJECTDIR)/platform/$(TARGET)
PROJECTDIRS += $(PROJECTDIR)/apps/webserver $(PROJECTDIR)/apps/udp-client \
$(PROJECTDIR)/apps/shell \
$(PROJECTDIR)/apps/dtls-echo $(PROJECTDIR)/apps/coap/rest-types
CONTIKI_WITH_IPV6 = 1
ifneq ($(RF_CHANNEL),)
CFLAGS +=-DRF_CHANNEL=$(RF_CHANNEL) -DUSER_RF_CHANNEL
endif
ifeq ($(WITH_TSCH),1)
CFLAGS +=-DWITH_TSCH=1
MODULES+=core/net/mac/tsch
endif
ifeq ($(WITH_RPL),1)
CONTIKI_WITH_RPL = 1
CFLAGS += -DRPL_NON_STORING=$(RPL_NON_STORING)
else
CONTIKI_WITH_RPL = 0
endif
ifneq ($(WITH_SHELL),0)
CFLAGS += -DSHELL=1 -DCETIC_6LBR_TRACE_PING=1
APPS += serial-shell
PROJECT_SOURCEFILES += shell-6lbr.c
endif
WITH_DELAY_IP?=0
ifneq ($(WITH_DELAY_IP),0)
CFLAGS += -DSLIP_RADIO=1 -DWITH_DELAY_IP=1
endif
ifneq ($(WITH_UDPCLIENT),0)
CFLAGS += -DUDPCLIENT=1
PROJECT_SOURCEFILES += udp-client.c
else
CFLAGS += -DUDPCLIENT=0
endif
ifneq ($(WITH_WEBSERVER),0)
CFLAGS += -DWEBSERVER=1
PROJECT_SOURCEFILES += sky-websense.c httpd-simple.c
WITH_TCP=1
endif
ifneq ($(WITH_COAPSERVER),0)
APPS += er-coap rest-engine coap
ifeq ($(WITH_COAP_PROFILE),)
WITH_COAP_PROFILE=IPSO_APP_FW
endif
ifeq ($(WITH_COAP_PROFILE),IPSO_APP_FW)
APPS += ipso-app-fw
RESOURCES_TEMPLATE=$(PROJECTDIR)/tools/coap/ipso-app-fw-resource-template.h
VALID_COAP_PROFILE=1
endif
ifeq ($(WITH_COAP_PROFILE),LWM2M)
APPS += lwm2m
RESOURCES_TEMPLATE=$(PROJECTDIR)/tools/coap/ipso-so-resource-template.h
VALID_COAP_PROFILE=1
endif
ifneq ($(VALID_COAP_PROFILE),1)
$(error Invalid CoAP Profile)
endif
endif
ifneq ($(WITH_MULTICAST_CLIENT),0)
CFLAGS += -DMULTICAST_CLIENT=1
PROJECTDIRS += $(PROJECTDIR)/apps/multicast-client
PROJECT_SOURCEFILES += multicast-client.c
MODULES += core/net/ipv6/multicast
else
CFLAGS += -DMULTICAST_CLIENT=0
endif
ifneq ($(WITH_TCP),1)
CFLAGS += -DUIP_CONF_TCP=0
endif
ifneq ($(WITH_TCP),1)
CFLAGS += -DUIP_CONF_TCP=0
endif
ifneq ($(UDP_PERIOD),)
CFLAGS += -DCETIC_6LBR_UDP_PERIOD=$(UDP_PERIOD)
endif
ifneq ($(WITH_UDP_CLIENT_AUTOSTART),0)
CFLAGS += -DUDP_CLIENT_AUTOSTART=1
endif
ifneq ($(WITH_LLSEC),0)
CFLAGS += -DWITH_LLSEC=1 -DWITH_ADAPTIVESEC=$(WITH_ADAPTIVESEC)
MODULES += core/net/llsec/noncoresec
MODULES += core/net/llsec/adaptivesec
endif
ifneq ($(WITH_TINYDTLS), 0)
APPS += tinydtls
CFLAGS += -DWITH_TINYDTLS=1
CFLAGS += -DUIP_CONF_TCP=0
PROJECTDIRS+=$(CONTIKI)/apps/tinydtls/aes $(CONTIKI)/apps/tinydtls/sha2 $(CONTIKI)/apps/tinydtls/ecc
endif
ifneq ($(WITH_DTLSECHO), 0)
CFLAGS += -DWITH_DTLS_ECHO=1
PROJECT_SOURCEFILES += dtls-echo.c
endif
# Platform specific configuration
ifeq ($(TARGET),)
TARGET=native
endif
MSP430_20BITS=1
SMALL=1
ifeq ($(TARGET),sky)
MSP430_20BITS=0
endif
CFLAGS+=-DMSP430_20BITS=$(MSP430_20BITS)
ifneq ($(MSP430_20BITS), 0)
ifeq ($(TARGET),z1)
CFLAGS+=-mmemory-model=medium
LDFLAGS+=-mmemory-model=medium
endif
ifeq ($(TARGET),wismote)
TARGET_MEMORY_MODEL=huge
LDFLAGS+=-Wl,-Ttext=0x8000
endif
endif
ifeq ($(TARGET),sky)
WITH_CETIC_6LN_NVM?=0
ifeq ($(WITH_CETIC_6LN_NVM),1)
PROJECT_SOURCEFILES += f1611-nvm.c
endif
endif
ifeq ($(TARGET),cc2538dk)
PROJECTDIRS += $(PROJECTDIR)/dev/sht21
PROJECT_SOURCEFILES += sht21.c
WITH_CETIC_6LN_NVM?=0
ifeq ($(WITH_CETIC_6LN_NVM),1)
PROJECT_SOURCEFILES += cc2538dk-nvm.c
endif
endif
ifeq ($(TARGET),zoul)
WITH_CETIC_6LN_NVM?=0
ifeq ($(WITH_CETIC_6LN_NVM),1)
PROJECT_SOURCEFILES += zoul-nvm.c
endif
endif
ifeq ($(TARGET),srf06-cc26xx)
ifeq ($(BOARD),sensortag/cc2650)
WITH_CETIC_6LN_NVM?=0
CFLAGS+=-DWITH_CETIC_6LN_NVM=$(WITH_CETIC_6LN_NVM)
ifeq ($(WITH_CETIC_6LN_NVM),1)
PROJECT_SOURCEFILES += sensortag-nvm.c
endif
endif
endif
ifeq ($(TARGET),cooja)
PROJECTDIRS += $(PROJECTDIR)/platform/native
WITH_CETIC_6LN_NVM?=0
ifeq ($(WITH_CETIC_6LN_NVM),1)
PROJECT_SOURCEFILES += native-nvm.c
endif
endif
ifeq ($(TARGET),native)
WITH_CETIC_6LN_NVM?=0
ifeq ($(WITH_CETIC_6LN_NVM),1)
PROJECT_SOURCEFILES += native-nvm.c
endif
endif
ifeq ($(WITH_CETIC_6LN_NVM),1)
PROJECTDIRS += $(PROJECTDIR)/apps/nvm
CFLAGS+=-DWITH_CETIC_6LN_NVM=1
PROJECT_SOURCEFILES += nvm-config.c
endif
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
ifneq ($(PROJECT_CONF),)
CFLAGS += -DUSER_PROJECT_CONF_H=\"$(PROJECT_CONF)\"
endif
-include $(PROJECTDIR)/platform/contiki/Makefile.contiki
-include $(PROJECTDIR)/platform/$(TARGET)/Makefile.$(TARGET)
ifneq ("$(wildcard $(PROJECTDIR)/platform/$(TARGET)/6ln-conf-$(TARGET).h)","")
CFLAGS+=-DCETIC_6LN_PLATFORM_CONF=\"6ln-conf-$(TARGET).h\"
endif
PROJECT_SOURCEFILES += 6lbr-demo-main.c
ifneq ($(USER_MODULES),)
USER_MODULES_DEFINE=${addprefix INIT_USER_MOD(,${addsuffix );,${strip $(USER_MODULES)}}}
CFLAGS+=-DUSER_MODULES="$(USER_MODULES_DEFINE)"
endif
ifneq ($(WITH_COAPSERVER),0)
RESOURCE_FILES=$(addsuffix -resource.h,$(RESOURCES))
FULL_RESOURCE_FILES=$(addprefix $(PROJECTDIR)/dyn_resources/,$(RESOURCE_FILES))
RESOURCES_TEMPLATE?=$(PROJECTDIR)/tools/coap/resource-template.h
$(FULL_RESOURCE_FILES): $(PROJECTDIR)/dynamic-resources.mk
-include $(PROJECTDIR)/dynamic-resources.mk
$(PROJECTDIR)/dynamic-resources.mk:
mkdir -p $(PROJECTDIR)/dyn_resources
$(PROJECTDIR)/tools/coap/mk_resource.sh $(RESOURCES_TEMPLATE) $(RESOURCES)
mv -f $(RESOURCE_FILES) $(PROJECTDIR)/dyn_resources/
@echo 'GEN_FILES+=$(FULL_RESOURCE_FILES)' > $(PROJECTDIR)/dynamic-resources.mk
PROJECTDIRS+=$(PROJECTDIR)/dyn_resources
endif
CLEAN+=$(PROJECTDIR)/dyn_resources/* $(PROJECTDIR)/dynamic-resources.mk
.PHONY: $(FULL_RESOURCE_FILES)
all_sky: bin_sky/6lbr-demo.sky
all_z1: bin_z1/6lbr-demo-webserver.z1 bin_z1/6lbr-demo-coapserver.z1
all_econotag: bin_econotag/6lbr-demo-coapserver.econotag
all_cc2538dk: bin_cc2538dk/6lbr-demo-coapserver.cc2538dk bin_cc2538dk/6lbr-demo-llsec-coapserver.cc2538dk bin_cc2538dk/6lbr-demo-dtls-coapserver.cc2538dk
all_zoul: bin_zoul/6lbr-demo-coapserver.zoul bin_zoul/6lbr-demo-llsec-coapserver.zoul bin_zoul/6lbr-demo-dtls-coapserver.zoul
bin_sky/6lbr-demo.sky:
mkdir -p bin_sky
$(MAKE) TARGET=sky clean
$(MAKE) TARGET=sky RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.sky bin_sky/6lbr-demo.sky
bin_sky/6lbr-demo-webserver.sky:
mkdir -p bin_sky
$(MAKE) TARGET=sky clean
$(MAKE) TARGET=sky WITH_UDPCLIENT=0 WITH_WEBSERVER=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.sky bin_sky/6lbr-demo-webserver.sky
bin_sky/6lbr-demo-coapserver.sky:
mkdir -p bin_sky
$(MAKE) TARGET=sky clean
$(MAKE) TARGET=sky WITH_UDPCLIENT=0 WITH_COAPSERVER=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.sky bin_sky/6lbr-demo-coapserver.sky
bin_z1/6lbr-demo-webserver.z1:
mkdir -p bin_z1
$(MAKE) TARGET=z1 clean
$(MAKE) TARGET=z1 WITH_UDPCLIENT=0 WITH_WEBSERVER=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.z1 bin_z1/6lbr-demo-webserver.z1
bin_z1/6lbr-demo-coapserver.z1:
mkdir -p bin_z1
$(MAKE) TARGET=z1 clean
$(MAKE) TARGET=z1 MSP430_20BITS=0 WITH_UDPCLIENT=0 WITH_COAPSERVER=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.z1 bin_z1/6lbr-demo-coapserver.z1
bin_econotag/6lbr-demo-coapserver.econotag:
mkdir -p bin_econotag
$(MAKE) TARGET=econotag clean
$(MAKE) TARGET=econotag WITH_UDPCLIENT=0 WITH_COAPSERVER=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo_econotag.bin bin_econotag/6lbr-demo-coapserver.econotag
bin_cc2538dk/6lbr-demo-llsec-coapserver.cc2538dk:
mkdir -p bin_cc2538dk
$(MAKE) TARGET=cc2538dk clean
$(MAKE) TARGET=cc2538dk WITH_UDPCLIENT=0 WITH_COAPSERVER=1 WITH_LLSEC=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.$(CC2538_FW) bin_cc2538dk/6lbr-demo-llsec-coapserver.$(CC2538_FW)
bin_cc2538dk/6lbr-demo-coapserver.cc2538dk:
mkdir -p bin_cc2538dk
$(MAKE) TARGET=cc2538dk clean
$(MAKE) TARGET=cc2538dk WITH_UDPCLIENT=0 WITH_COAPSERVER=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.$(CC2538_FW) bin_cc2538dk/6lbr-demo-coapserver.$(CC2538_FW)
bin_cc2538dk/6lbr-demo-dtls-coapserver.cc2538dk:
mkdir -p bin_cc2538dk
$(MAKE) TARGET=cc2538dk clean
$(MAKE) TARGET=cc2538dk WITH_UDPCLIENT=0 WITH_COAPSERVER=1 WITH_TINYDTLS=1 WITH_DTLS_COAP=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.$(CC2538_FW) bin_cc2538dk/6lbr-demo-dtls-coapserver.$(CC2538_FW)
bin_zoul/6lbr-demo-llsec-coapserver.zoul:
mkdir -p bin_zoul
$(MAKE) TARGET=zoul clean
$(MAKE) TARGET=zoul WITH_UDPCLIENT=0 WITH_COAPSERVER=1 WITH_LLSEC=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.$(CC2538_FW) bin_zoul/6lbr-demo-llsec-coapserver.$(CC2538_FW)
bin_zoul/6lbr-demo-coapserver.zoul:
mkdir -p bin_zoul
$(MAKE) TARGET=zoul clean
$(MAKE) TARGET=zoul WITH_UDPCLIENT=0 WITH_COAPSERVER=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.$(CC2538_FW) bin_zoul/6lbr-demo-coapserver.$(CC2538_FW)
bin_zoul/6lbr-demo-dtls-coapserver.zoul:
mkdir -p bin_zoul
$(MAKE) TARGET=zoul clean
$(MAKE) TARGET=zoul WITH_UDPCLIENT=0 WITH_COAPSERVER=1 WITH_TINYDTLS=1 WITH_DTLS_COAP=1 RF_CHANNEL=$(RF_CHANNEL)
cp 6lbr-demo.$(CC2538_FW) bin_zoul/6lbr-demo-dtls-coapserver.$(CC2538_FW)
include $(CONTIKI)/Makefile.include
.PHONY: all_sky all_z1 all_econotag all_cc2538dk all_zoul bin_sky/* bin_z1/* bin_econotag/* bin_cc2538dk/* bin_zoul/*