1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Add include paths automatocally for USEMODULES

Application developers use `$(USEMODULES)` in their Makefiles to have
the relevant functionally automagically added to their apps. This even
does basic dependency tracking by means of `Makefile.dep`.

But an important thing is missing: the automatic adding of include
paths. This is inconvenient, error prone, and will hinder the RIOT core
developers in future to change folder structures.
This commit is contained in:
René Kijewski 2014-02-26 23:23:15 +01:00
parent a6fd531783
commit de29e4184c
23 changed files with 84 additions and 77 deletions

View File

@ -106,6 +106,16 @@ OBJ = $(SRC:%.c=${BINDIR}${PROJECT}/%.o)
$(BINDIR)$(PROJECT).a: $(OBJ)
$(AD)$(AR) -rc $(BINDIR)$(PROJECT).a $(OBJ)
# add extra include paths for packages in $(USEMODULE)
export USEMODULE_INCLUDES =
include $(RIOTBASE)/sys/Makefile.include
include $(RIOTBASE)/drivers/Makefile.include
USEMODULE_INCLUDES_ = $(shell echo $(USEMODULE_INCLUDES) | tr ' ' '\n' | awk '!a[$$0]++' | tr '\n' ' ')
INCLUDES += $(USEMODULE_INCLUDES_:%=-I%)
# include Makefile.includes for packages in $(USEPKG)
$(RIOTBASE)/pkg/%/Makefile.include::
$(AD)"$(MAKE)" -C $(RIOTBASE)/pkg/$* Makefile.include

12
drivers/Makefile.include Normal file
View File

@ -0,0 +1,12 @@
ifneq (,$(filter cc2420,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/drivers/cc2420/include
endif
ifneq (,$(filter cc110x,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/drivers/cc110x/include
endif
ifneq (,$(filter cc110x_ng,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/drivers/cc110x_ng/include
endif
ifneq (,$(filter at86rf231,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/drivers/at86rf231/include
endif

View File

@ -48,6 +48,4 @@ USEMODULE += crypto_sha256
USEMODULE += ccn_lite
USEMODULE += ccn_lite_client
export INCLUDES = -I$(RIOTBASE)/sys/net/include
include $(RIOTBASE)/Makefile.include

View File

@ -46,6 +46,4 @@ USEMODULE += rtc
USEMODULE += crypto_sha256
USEMODULE += ccn_lite
export INCLUDES = -I$(RIOTBASE)/sys/net/include/
include $(RIOTBASE)/Makefile.include

View File

@ -55,6 +55,4 @@ ifneq (,$(filter native,$(BOARD)))
USEMODULE += random
endif
export INCLUDES += -I${RIOTBASE}/core/include/ -I${RIOTBASE}/sys/include/ -I${RIOTBASE}/drivers/include/
include $(RIOTBASE)/Makefile.include

View File

@ -49,6 +49,4 @@ USEMODULE += sixlowpan
USEMODULE += rpl
USEMODULE += destiny
export INCLUDES += -I$(RIOTBASE)/sys/net/include -I$(RIOTBASE)/sys/net/routing/rpl -I$(RIOTBASE)/drivers/cc110x
include $(RIOTBASE)/Makefile.include

View File

@ -15,7 +15,6 @@ ifneq (,$(filter ps,$(USEMODULE)))
DIRS += ps
endif
ifneq (,$(filter posix,$(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/sys/posix/include
DIRS += posix
endif
ifneq (,$(filter pnet,$(USEMODULE)))

60
sys/Makefile.include Normal file
View File

@ -0,0 +1,60 @@
ifneq (,$(filter destiny,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
endif
ifneq (,$(filter net_help,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
USEMODULE_INCLUDES += $(RIOTBASE)/drivers/cc110x
USEMODULE_INCLUDES += $(RIOTBASE)/drivers/cc110x_ng/include
endif
ifneq (,$(filter net_if,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
endif
ifneq (,$(filter protocol_multiplex,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
endif
ifneq (,$(filter sixlowpan,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
endif
ifneq (,$(filter rpl,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/routing/rpl
endif
ifneq (,$(filter ieee802154,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
endif
ifneq (,$(filter ccn_lite,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/ccn_lite
endif
ifneq (,$(filter ccn_lite_client,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include
endif
ifneq (,$(filter crypto_3des,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/include/crypto
endif
ifneq (,$(filter crypto_aes,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/include/crypto
endif
ifneq (,$(filter crypto_rc5,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/include/crypto
endif
ifneq (,$(filter crypto_sha256,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/include/crypto
endif
ifneq (,$(filter crypto_skipjack,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/include/crypto
endif
ifneq (,$(filter crypto_twofish,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/include/crypto
endif
ifneq (,$(filter posix,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/include
endif
ifneq (,$(filter pnet,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/pnet/include
endif
ifneq (,$(filter pthread,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/posix/pthread/include
endif

View File

@ -1,8 +1,3 @@
SRC = 3des.c
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
MODULE = crypto_3des
include $(RIOTBASE)/Makefile.base

View File

@ -1,8 +1,3 @@
SRC = aes.c
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
MODULE = crypto_aes
include $(RIOTBASE)/Makefile.base

View File

@ -1,8 +1,3 @@
SRC = rc5.c
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
MODULE = crypto_rc5
include $(RIOTBASE)/Makefile.base

View File

@ -1,8 +1,3 @@
SRC = sha256.c
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
MODULE = crypto_sha256
include $(RIOTBASE)/Makefile.base

View File

@ -1,8 +1,3 @@
SRC = skipjack.c
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
MODULE = crypto_skipjack
include $(RIOTBASE)/Makefile.base

View File

@ -1,8 +1,3 @@
SRC = twofish.c
OBJ = $(SRC:%.c=$(BINDIR)%.o)
DEP = $(SRC:%.c=$(BINDIR)%.d)
MODULE = crypto_twofish
include $(RIOTBASE)/Makefile.base

View File

@ -1,5 +1,3 @@
MODULE:=$(shell basename $(CURDIR))
INCLUDES += -I$(RIOTBASE)/sys/net/include
include $(RIOTBASE)/Makefile.base

View File

@ -1,5 +1,3 @@
INCLUDES += -I$(RIOTBASE)/sys/net/include
MODULE:=protocol_multiplex
MODULE = protocol_multiplex
include $(RIOTBASE)/Makefile.base

View File

@ -1,5 +1,3 @@
MODULE =pnet
CFLAGS += -isystem $(RIOTBASE)/sys/posix/pnet/include
include $(RIOTBASE)/Makefile.base

View File

@ -1,7 +1,3 @@
MODULE = pthread
CFLAGS += -isystem $(RIOTBASE)/sys/posix/pthread/include
export INCLUDES += -I$(RIOTBASE)/sys/posix/pthread/include
include $(RIOTBASE)/Makefile.base

View File

@ -14,7 +14,6 @@ ifneq (,$(filter cc110x,$(USEMODULE)))
endif
endif
ifneq (,$(filter net_if,$(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/sys/net/include
SRC += sc_net_if.c
endif
ifneq (,$(filter mci,$(USEMODULE)))

View File

@ -12,6 +12,4 @@ USEMODULE += auto_init
USEMODULE += net_if
USEMODULE += defaulttransceiver
export INCLUDES += -I$(RIOTBASE)/sys/net/include
include $(RIOTBASE)/Makefile.include

View File

@ -1,4 +1,4 @@
export PROJECT =test_pnet
export PROJECT = test_pnet
include ../Makefile.tests_common
USEMODULE += auto_init
@ -7,13 +7,4 @@ USEMODULE += pnet
USEMODULE += vtimer
USEMODULE += defaulttransceiver
ifeq ($(BOARD),native)
CFLAGS += -isystem $(RIOTBASE)/sys/net/include \
-isystem $(RIOTBASE)/sys/posix/pnet/include
else
export INCLUDES += -I$(RIOTBASE)/sys/net/include \
-I$(RIOTBASE)/sys/posix/pnet/include \
-I$(RIOTBASE)/sys/posix/include
endif
include $(RIOTBASE)/Makefile.include

View File

@ -4,11 +4,4 @@ include ../Makefile.tests_common
USEMODULE += posix
USEMODULE += pthread
ifeq ($(BOARD),native)
CFLAGS += -isystem $(RIOTBASE)/sys/posix/pthread/include
else
export INCLUDES += -I$(RIOTBASE)/sys/posix/pthread/include \
-I$(RIOTBASE)/sys/posix/include
endif
include $(RIOTBASE)/Makefile.include

View File

@ -4,11 +4,4 @@ include ../Makefile.tests_common
USEMODULE += posix
USEMODULE += pthread
ifeq ($(BOARD),native)
CFLAGS += -isystem $(RIOTBASE)/sys/posix/pthread/include
else
export INCLUDES = -I$(RIOTBASE)/sys/posix/pthread/include \
-I$(RIOTBASE)/sys/posix/include
endif
include $(RIOTBASE)/Makefile.include