Build system: automatically include Makefiles from PROJECTDIRS

This commit is contained in:
Simon Duquennoy 2017-12-18 09:21:47 -08:00
parent c2d301a434
commit a0961ac2a1
6 changed files with 9 additions and 21 deletions

View File

@ -60,6 +60,8 @@ CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFI
PROJECT_SOURCEFILES += ${foreach d, $(PROJECTDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}} PROJECT_SOURCEFILES += ${foreach d, $(PROJECTDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}}
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}} PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
PROJECT_INCLUDES = ${strip ${wildcard ${foreach d, $(PROJECTDIRS), $(d)/Makefile.${notdir $(d)}}}}
-include $(PROJECT_INCLUDES)
# Provide way to create $(OBJECTDIR) if it has been removed by make clean # Provide way to create $(OBJECTDIR) if it has been removed by make clean
$(OBJECTDIR): $(OBJECTDIR):

View File

@ -5,14 +5,14 @@ CONTIKI = ../..
include $(CONTIKI)/Makefile.identify-target include $(CONTIKI)/Makefile.identify-target
ifeq ($(TARGET),native) ifeq ($(TARGET),native)
SOURCES_DIR = native PROJECTDIRS += native
CFLAGS += -DPROJECT_CONF_PATH=\"native/project-conf.h\"
else else
SOURCES_DIR = embedded PROJECTDIRS += embedded
# For embedded platforms, include platform-specific directory
PROJECTDIRS += embedded/$(TARGET)
CFLAGS += -DPROJECT_CONF_PATH=\"embedded/project-conf.h\"
endif endif
include $(SOURCES_DIR)/Makefile
PROJECTDIRS += common PROJECTDIRS += common
PROJECTDIRS += $(SOURCES_DIR)
CFLAGS += -DPROJECT_CONF_PATH=\"$(SOURCES_DIR)/project-conf.h\"
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View File

@ -1,7 +1,3 @@
### Optionally, the target can add its own Makefile, to do things like e.g.
### add more source files to the build or define make variables.
-include $(SOURCES_DIR)/$(TARGET)/Makefile.$(TARGET)
$(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c $(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c
(cd $(CONTIKI)/tools && $(MAKE) tunslip6) (cd $(CONTIKI)/tools && $(MAKE) tunslip6)

View File

@ -1,3 +1 @@
PROJECT_SOURCEFILES += slip-bridge-putchar.c
CFLAGS += -DTARGET_CONF_PATH=\"target-conf.h\" CFLAGS += -DTARGET_CONF_PATH=\"target-conf.h\"

View File

@ -4,11 +4,7 @@ CONTIKI = ../..
PROJECT_SOURCEFILES += sensniff-mac.c netstack.c PROJECT_SOURCEFILES += sensniff-mac.c netstack.c
PROJECTDIRS += pool $(TARGET) PROJECTDIRS += pool $(TARGET)
include $(CONTIKI)/Makefile.identify-target include $(CONTIKI)/Makefile.identify-target
### Optionally, the target can add its own Makefile, to do things like e.g.
### add more source files to the build or define make variables.
-include $(TARGET)/Makefile.$(TARGET)
all: $(CONTIKI_PROJECT) all: $(CONTIKI_PROJECT)

View File

@ -5,10 +5,6 @@ MODULES += os/services/slip-cmd
CONTIKI=../.. CONTIKI=../..
include $(CONTIKI)/Makefile.identify-target include $(CONTIKI)/Makefile.identify-target
### Optionally, the target can add its own Makefile, to do things like e.g.
### add more source files to the build or define make variables.
-include $(TARGET)/Makefile.$(TARGET)
PROJECTDIRS += $(TARGET) PROJECTDIRS += $(TARGET)
PROJECT_SOURCEFILES += slip-net.c PROJECT_SOURCEFILES += slip-net.c