diff --git a/Makefile.include b/Makefile.include index 8027d9e9e7..330768004e 100644 --- a/Makefile.include +++ b/Makefile.include @@ -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 diff --git a/drivers/Makefile.include b/drivers/Makefile.include new file mode 100644 index 0000000000..49e12e4ee6 --- /dev/null +++ b/drivers/Makefile.include @@ -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 diff --git a/examples/ccn-lite-client/Makefile b/examples/ccn-lite-client/Makefile index 36772c5f1b..57420b8359 100644 --- a/examples/ccn-lite-client/Makefile +++ b/examples/ccn-lite-client/Makefile @@ -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 diff --git a/examples/ccn-lite-relay/Makefile b/examples/ccn-lite-relay/Makefile index d0e72dbdb0..b5ad2a0207 100644 --- a/examples/ccn-lite-relay/Makefile +++ b/examples/ccn-lite-relay/Makefile @@ -46,6 +46,4 @@ USEMODULE += rtc USEMODULE += crypto_sha256 USEMODULE += ccn_lite -export INCLUDES = -I$(RIOTBASE)/sys/net/include/ - include $(RIOTBASE)/Makefile.include diff --git a/examples/default/Makefile b/examples/default/Makefile index 55f92b0c61..04f948076c 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -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 diff --git a/examples/rpl_udp/Makefile b/examples/rpl_udp/Makefile index 2228c286b9..0a0d91c5e0 100644 --- a/examples/rpl_udp/Makefile +++ b/examples/rpl_udp/Makefile @@ -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 diff --git a/sys/Makefile b/sys/Makefile index 6c4147b771..2c91b56ba6 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -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))) diff --git a/sys/Makefile.include b/sys/Makefile.include new file mode 100644 index 0000000000..4a35e9508c --- /dev/null +++ b/sys/Makefile.include @@ -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 diff --git a/sys/crypto/3des/Makefile b/sys/crypto/3des/Makefile index d049bc5d83..1f5e5d84ef 100644 --- a/sys/crypto/3des/Makefile +++ b/sys/crypto/3des/Makefile @@ -1,8 +1,3 @@ -SRC = 3des.c - -OBJ = $(SRC:%.c=$(BINDIR)%.o) -DEP = $(SRC:%.c=$(BINDIR)%.d) - MODULE = crypto_3des include $(RIOTBASE)/Makefile.base diff --git a/sys/crypto/aes/Makefile b/sys/crypto/aes/Makefile index f387f13b02..f00a84dbc6 100644 --- a/sys/crypto/aes/Makefile +++ b/sys/crypto/aes/Makefile @@ -1,8 +1,3 @@ -SRC = aes.c - -OBJ = $(SRC:%.c=$(BINDIR)%.o) -DEP = $(SRC:%.c=$(BINDIR)%.d) - MODULE = crypto_aes include $(RIOTBASE)/Makefile.base diff --git a/sys/crypto/rc5/Makefile b/sys/crypto/rc5/Makefile index 38207c4cc3..a78c1bd74f 100644 --- a/sys/crypto/rc5/Makefile +++ b/sys/crypto/rc5/Makefile @@ -1,8 +1,3 @@ -SRC = rc5.c - -OBJ = $(SRC:%.c=$(BINDIR)%.o) -DEP = $(SRC:%.c=$(BINDIR)%.d) - MODULE = crypto_rc5 include $(RIOTBASE)/Makefile.base diff --git a/sys/crypto/sha256/Makefile b/sys/crypto/sha256/Makefile index 9794942fc1..f14689585d 100644 --- a/sys/crypto/sha256/Makefile +++ b/sys/crypto/sha256/Makefile @@ -1,8 +1,3 @@ -SRC = sha256.c - -OBJ = $(SRC:%.c=$(BINDIR)%.o) -DEP = $(SRC:%.c=$(BINDIR)%.d) - MODULE = crypto_sha256 include $(RIOTBASE)/Makefile.base diff --git a/sys/crypto/skipjack/Makefile b/sys/crypto/skipjack/Makefile index 87f66d593e..69ce210ded 100644 --- a/sys/crypto/skipjack/Makefile +++ b/sys/crypto/skipjack/Makefile @@ -1,8 +1,3 @@ -SRC = skipjack.c - -OBJ = $(SRC:%.c=$(BINDIR)%.o) -DEP = $(SRC:%.c=$(BINDIR)%.d) - MODULE = crypto_skipjack include $(RIOTBASE)/Makefile.base diff --git a/sys/crypto/twofish/Makefile b/sys/crypto/twofish/Makefile index 7cfdd35787..18c4e9d0fb 100644 --- a/sys/crypto/twofish/Makefile +++ b/sys/crypto/twofish/Makefile @@ -1,8 +1,3 @@ -SRC = twofish.c - -OBJ = $(SRC:%.c=$(BINDIR)%.o) -DEP = $(SRC:%.c=$(BINDIR)%.d) - MODULE = crypto_twofish include $(RIOTBASE)/Makefile.base diff --git a/sys/net/crosslayer/net_help/Makefile b/sys/net/crosslayer/net_help/Makefile index 26925d685f..c6e31807e8 100644 --- a/sys/net/crosslayer/net_help/Makefile +++ b/sys/net/crosslayer/net_help/Makefile @@ -1,5 +1,3 @@ MODULE:=$(shell basename $(CURDIR)) -INCLUDES += -I$(RIOTBASE)/sys/net/include - include $(RIOTBASE)/Makefile.base diff --git a/sys/net/link_layer/protocol-multiplex/Makefile b/sys/net/link_layer/protocol-multiplex/Makefile index 764e02c5b2..c5126f06a4 100644 --- a/sys/net/link_layer/protocol-multiplex/Makefile +++ b/sys/net/link_layer/protocol-multiplex/Makefile @@ -1,5 +1,3 @@ -INCLUDES += -I$(RIOTBASE)/sys/net/include - -MODULE:=protocol_multiplex +MODULE = protocol_multiplex include $(RIOTBASE)/Makefile.base diff --git a/sys/posix/pnet/Makefile b/sys/posix/pnet/Makefile index 8549b59171..44ad39401f 100644 --- a/sys/posix/pnet/Makefile +++ b/sys/posix/pnet/Makefile @@ -1,5 +1,3 @@ MODULE =pnet -CFLAGS += -isystem $(RIOTBASE)/sys/posix/pnet/include - include $(RIOTBASE)/Makefile.base diff --git a/sys/posix/pthread/Makefile b/sys/posix/pthread/Makefile index 96b84f147b..f849d335bc 100644 --- a/sys/posix/pthread/Makefile +++ b/sys/posix/pthread/Makefile @@ -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 diff --git a/sys/shell/commands/Makefile b/sys/shell/commands/Makefile index c82630b778..64938e4899 100644 --- a/sys/shell/commands/Makefile +++ b/sys/shell/commands/Makefile @@ -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))) diff --git a/tests/test_net_if/Makefile b/tests/test_net_if/Makefile index 028d6ac58c..073f4b76ab 100644 --- a/tests/test_net_if/Makefile +++ b/tests/test_net_if/Makefile @@ -12,6 +12,4 @@ USEMODULE += auto_init USEMODULE += net_if USEMODULE += defaulttransceiver -export INCLUDES += -I$(RIOTBASE)/sys/net/include - include $(RIOTBASE)/Makefile.include diff --git a/tests/test_pnet/Makefile b/tests/test_pnet/Makefile index ef5a45b08a..b1c34b788e 100644 --- a/tests/test_pnet/Makefile +++ b/tests/test_pnet/Makefile @@ -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 diff --git a/tests/test_pthread/Makefile b/tests/test_pthread/Makefile index 6e2a46c23e..2deaa76c45 100644 --- a/tests/test_pthread/Makefile +++ b/tests/test_pthread/Makefile @@ -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 diff --git a/tests/test_pthread_cooperation/Makefile b/tests/test_pthread_cooperation/Makefile index 2590de5206..3430409269 100644 --- a/tests/test_pthread_cooperation/Makefile +++ b/tests/test_pthread_cooperation/Makefile @@ -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