Makefile: fixed build infrastructure for Contiki examples

The new structure of libcoap allows to clone Contiki in a
subdirectory. The example build now uses Makefile to first clone
Contiki and then invoke Makefile.contiki for the actual build.
The TARGET is set to minimal-net by default but can be changed to
any other (tested) target.
This commit is contained in:
Olaf Bergmann committed 2016-02-16 14:19:11 +01:00
1 parent 4c299f9da6
commit 0f062e557e
3 files changed
+15 -87

No files matched your search

+7 -23
View File
@@ -1,27 +1,11 @@
NODE_ADDR?=0x1000
CONTIKI=contiki
TARGET?=minimal-net
all: server
contiki:
git clone https://github.com/contiki-os/contiki.git
$(CONTIKI):
git clone https://github.com/contiki-os/contiki.git $@
cd $(CONTIKI)/apps && ln -s ../../../.. libcoap
# contiki and coap opts
CONTIKI=contiki
CFLAGS += -I.
# contiki library
PLATFORM_VPATH = $(CONTIKI)/cpu/native $(CONTIKI)/cpu/native/net $(CONTIKI)/platform/minimal-net
#PLATFORM_CPPFLAGS =
PLATFORM_CFLAGS = -I$(CONTIKI)/cpu/native/ -I$(CONTIKI)/platform/minimal-net
PLATFORM_OBJS = contiki-main.o tapdev6.o tapdev-drv.o clock.o serial-line.o
CONTIKIOBJS = $(PLATFORM_OBJS) ringbuf.o autostart.o list.o memb.o uiplib.o uip-nd6.o uip-neighbor.o uip-ds6.o uip-ds6-nbr.o linkaddr.o uip.o uip-udp-packet.o random.o ctimer.o timer.o etimer.o stimer.o procinit.o process.o udp-socket.o uip-icmp6.o tcpip.o uip-packetqueue.o uip-ds6-route.o nbr-table.o uip6.o uip.o uip-debug.o packetbuf.o
vpath %.c $(CONTIKI)/core $(CONTIKI)/core/lib $(CONTIKI)/core/sys $(CONTIKI)/core/dev $(CONTIKI)/core/net $(CONTIKI)/core/net/ip $(CONTIKI)/core/net/ipv4 $(CONTIKI)/core/net/ipv6 $(CONTIKI)/core/loader $(CONTIKI)/core/cfs $(PLATFORM_VPATH)
CFLAGS += -DCONTIKI_TARGET_MINIMAL_NET=1 -DWITH_UIP6=1 -DUIP6_CONF_IPV6=1 -DNETSTACK_CONF_WITH_IPV6=1 -DUIP_CONF_IPV6_RPL=0 -URPL_BORDER_ROUTER -DAUTOSTART_ENABLE -DNODE_ADDR=$(NODE_ADDR)
CFLAGS += -g3 -Wall -pedantic -O0
include Makefile.common
server: $(CONTIKI)
$(MAKE) -f Makefile.contiki V=1 CONTIKI=$(CONTIKI) TARGET=$(TARGET) NODE_ADDR=0x1000 server
-36
View File
@@ -1,36 +0,0 @@
top_srcdir ?= ../..
# coap library
CFLAGS += -std=gnu99
CFLAGS += -I$(top_srcdir)/include/coap -DCOAP_RESOURCES_NOHASH
vpath %.c $(top_srcdir)/src
COAPOBJS = net.o debug.o option.o resource.o hashkey.o pdu.o encode.o subscribe.o coap_io.o block.o uri.o mem.o
CFLAGS += -I$(CONTIKI)/core/ -I$(CONTIKI)/core/sys/ -I$(CONTIKI)/core/net/ip/ -I$(CONTIKI)/core/lib/ $(PLATFORM_CFLAGS)
CPPFLAGS += $(PLATFORM_CPPFLAGS)
# making an executable out of all of it
OBJS = server.o ${CONTIKIOBJS} ${COAPOBJS}
server: ${OBJS}
symbols.h: $(CONTIKI)/tools/empty-symbols.h
cp -p $< $@
symbols.c: $(CONTIKI)/tools/empty-symbols.c
cp -p $< $@
symbols.o: symbols.c symbols.h
clean:
rm -f core server ${OBJS} symbols.c symbols.h
distclean: clean
rm -rf *~ *.o contiki
.PHONY: clean distclean contiki
+8 -28
View File
@@ -1,15 +1,13 @@
NODE_ADDR?=0x1000
########################################################################
# platform-specific options
ifeq ($(TARGET), econotag)
CONTIKI_WITH_RPL=0
CFLAGS += -DUIP_CONF_TCP=0
CFLAGS += -DUIP_CONF_TCP=0 -DCOAP_MAX_BLOCK_SZX=1
endif
ifeq ($(TARGET), mbxxx)
CFLAGS += -DUIP_CONF_TCP=0 -DHAVE_ASSERT_H -DHAVE_LIMITS_H
CFLAGS += -DUIP_CONF_TCP=0 -DCOAP_MAX_BLOCK_SZX=1 -DHAVE_ASSERT_H -DHAVE_LIMITS_H
STM32W_CPUREV=CC
#STM32W_CPUREV=xB
endif
@@ -17,32 +15,14 @@ endif
# usually, you should not need changing anything beyond this line
########################################################################
CONTIKI?=../../../..
ifneq ($(NODE_ADDR),)
CFLAGS += -DNODE_ADDR=$(NODE_ADDR)
endif
all: server
CONTIKI=../../../..
#CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
CFLAGS += -DNODE_ADDR=$(NODE_ADDR) -DCOAP_MAX_BLOCK_SZX=1
#ifeq ($(UIP_CONF_IPV6_RPL),0)
#CFLAGS += -DUIP_CONF_IPV6_RPL=0 -DRPL_BORDER_ROUTER=0 -DUIP_CONF_ROUTER=0
#endif
#WITH_UIP6=1
#UIP_CONF_IPV6=1
# ifeq ($(TARGET), minimal-net)
# CFLAGS += -DHAVE_ASSERT_H -DWITH_UIP6=1
# ifneq ($(ROLE),client)
# UIP_LLADDR="{0x00,0x06,0x98,0x00,0x02,0x32}"
# CFLAGS+= -DUIP_CONF_LLADDR=$(UIP_LLADDR)
# else
# UIP_LLADDR="{0x00,0x06,0x98,0x00,0x02,0x30}"
# CFLAGS+= -DUDP_CONNECTION_ADDR="fe80::206:98ff:fe00:232" \
# -DUIP_CONF_LLADDR=$(UIP_LLADDR)
# endif
# endif
CFLAGS += -ffunction-sections
LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__