moved the MAKE_NET code in makefile include so that platform makefiles are before decisions

This commit is contained in:
Joakim Eriksson 2017-10-07 18:12:45 +02:00
parent 1143d6f5aa
commit 5d87cd1b5f
3 changed files with 31 additions and 34 deletions

View File

@ -79,6 +79,34 @@ ifneq ("$(wildcard project-conf.h)","")
CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\"
endif
MODULES += os os/net os/net/mac os/storage
oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}}
CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}}
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
# Provide way to create $(OBJECTDIR) if it has been removed by make clean
$(OBJECTDIR):
mkdir $@
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
### Include target makefile (TODO Unsafe?)
target_makefile := $(wildcard $(CONTIKI)/arch/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
# Check if the target makefile exists, and create the object directory if necessary.
ifeq ($(strip $(target_makefile)),)
${error The target platform "$(TARGET)" does not exist (maybe it was misspelled?)}
else
ifneq (1, ${words $(target_makefile)})
${error More than one TARGET Makefile found: $(target_makefile)}
endif
include $(target_makefile)
endif
# Configure MAC layer
# The different options
@ -91,6 +119,7 @@ MAKE_MAC_OTHER = 3
MAKE_MAC ?= MAKE_MAC_CSMA
ifeq ($(MAKE_MAC),MAKE_MAC_NULLMAC)
MODULES+=os/net/mac/nullmac
CFLAGS += -DMAC_CONF_WITH_NULLMAC=1
endif
@ -147,34 +176,6 @@ else
CFLAGS += -DUIP_CONF_IPV6_RPL=0
endif
MODULES += os os/net os/net/mac os/storage
oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}}
CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}}
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
# Provide way to create $(OBJECTDIR) if it has been removed by make clean
$(OBJECTDIR):
mkdir $@
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
### Include target makefile (TODO Unsafe?)
target_makefile := $(wildcard $(CONTIKI)/arch/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
# Check if the target makefile exists, and create the object directory if necessary.
ifeq ($(strip $(target_makefile)),)
${error The target platform "$(TARGET)" does not exist (maybe it was misspelled?)}
else
ifneq (1, ${words $(target_makefile)})
${error More than one TARGET Makefile found: $(target_makefile)}
endif
include $(target_makefile)
endif
ifeq ($(WITH_IP64),1)
MODULES += os/services/ip64
endif

View File

@ -50,14 +50,9 @@ endif
### Banking Guesswork:
### Generic examples do not specify banking.
### We automatically turn it on if its unspecified and if we are building with
### MAKE_NET_IPV6
### We automatically turn it on if its unspecified.
ifndef HAVE_BANKING
ifeq ($(MAKE_NET),MAKE_NET_IPV6)
HAVE_BANKING=1
else
HAVE_BANKING=0
endif
endif
### Does the project want us to offset the firmware?

View File

@ -11,6 +11,7 @@ ifeq ($(NRF52_JLINK_PATH),)
endif
endif
MAKE_NET ?= MAKE_NET_IPV6
ifneq ($(MAKE_NET),MAKE_NET_IPV6)
$(error Only IPv6 stack is supported!)
endif