Factored out setup directory search path for source files into Makefile.include.

- All compilers used support the -I option for setting an include search directory.

- The Contiki source tree follows the (common) approach of placing declarations (in headerf iles) in the same directory as definitions (in source files).

As a result it makes sense to use the -I compiler option for just the same set of directories used for the vpath gnumake directive.

Note: I checked several builds but nevertheless one or the other might need some additional adjustsments. Sorry for the inconvenience.
This commit is contained in:
oliverschmidt 2007-05-19 07:54:53 +00:00
parent 41adb8caf3
commit ae2073cac9
6 changed files with 11 additions and 25 deletions

View file

@ -77,7 +77,7 @@ endif
include $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET) include $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET)
### Setup directory search path for source files ### Setup directory search path for source and header files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \ CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)} $(CONTIKI_TARGET_DIRS)}
@ -90,6 +90,8 @@ SOURCEDIRS = $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
vpath %.c $(SOURCEDIRS) vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS) vpath %.S $(SOURCEDIRS)
CFLAGS += ${addprefix -I,$(SOURCEDIRS)}
### Automatic dependency generation ### Automatic dependency generation
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)

View file

@ -30,7 +30,7 @@
# #
# Author: Oliver Schmidt <ol.sc@web.de> # Author: Oliver Schmidt <ol.sc@web.de>
# #
# $Id: Makefile.6502,v 1.8 2007/05/13 08:41:32 oliverschmidt Exp $ # $Id: Makefile.6502,v 1.9 2007/05/19 07:55:35 oliverschmidt Exp $
# #
ifndef CONTIKI ifndef CONTIKI
@ -69,7 +69,7 @@ LD = ld65
AR = ar65 AR = ar65
AFLAGS = -t $(TARGET) AFLAGS = -t $(TARGET)
CFLAGS += -t $(TARGET) -Or ${addprefix -I,$(SOURCEDIRS)} CFLAGS += -t $(TARGET) -Or
LDFLAGS = -C $(CONTIKI)/platform/$(TARGET)/linker.cfg -m contiki-$(TARGET).map LDFLAGS = -C $(CONTIKI)/platform/$(TARGET)/linker.cfg -m contiki-$(TARGET).map
AROPTS = a AROPTS = a

View file

@ -1,4 +1,4 @@
# $Id: Makefile.msp430,v 1.17 2007/05/15 08:09:45 adamdunkels Exp $ # $Id: Makefile.msp430,v 1.18 2007/05/19 07:56:34 oliverschmidt Exp $
ifdef nodeid ifdef nodeid
CFLAGS += -DNODEID=$(nodeid) CFLAGS += -DNODEID=$(nodeid)
@ -39,11 +39,7 @@ NM = msp430-nm
OBJCOPY = msp430-objcopy OBJCOPY = msp430-objcopy
STRIP = msp430-strip STRIP = msp430-strip
BSL = msp430-bsl BSL = msp430-bsl
CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ CFLAGSNO = -Wall -mmcu=$(MCU) -g
-I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} \
-DWITH_ASCII \
-Wall -mmcu=$(MCU) -g
CFLAGS += $(CFLAGSNO) -Os CFLAGS += $(CFLAGSNO) -Os
LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map

View file

@ -8,10 +8,7 @@ LD = gcc
AS = as AS = as
OBJCOPY = objcopy OBJCOPY = objcopy
STRIP = strip STRIP = strip
CFLAGSNO = -I. -I$(CONTIKI) -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ CFLAGSNO = -Wall -g -I/usr/local/include
-I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} $(APP_INCLUDES) \
-Wall -g -I. -I/usr/local/include
CFLAGS += $(CFLAGSNO) -O CFLAGS += $(CFLAGSNO) -O
LDFLAGS = -Wl,-Map=contiki-native.map,-export-dynamic LDFLAGS = -Wl,-Map=contiki-native.map,-export-dynamic

View file

@ -8,11 +8,7 @@ LD = gcc
AS = as AS = as
OBJCOPY = objcopy OBJCOPY = objcopy
STRIP = strip STRIP = strip
CFLAGSNO = -I. -I$(CONTIKI) -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ CFLAGSNO = -Wall -g -I/usr/local/include
-I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} $(APP_INCLUDES) \
-DWITH_UIP -DWITH_ASCII \
-Wall -g -I. -I/usr/local/include
CFLAGS += $(CFLAGSNO) CFLAGS += $(CFLAGSNO)
LDFLAGS = -Wl,-Map=contiki.map,-export-dynamic LDFLAGS = -Wl,-Map=contiki.map,-export-dynamic

View file

@ -1,4 +1,4 @@
# $Id: Makefile.cooja,v 1.16 2007/05/18 13:51:04 fros4943 Exp $ # $Id: Makefile.cooja,v 1.17 2007/05/19 07:57:59 oliverschmidt Exp $
## The COOJA Simulator Contiki platform Makefile ## The COOJA Simulator Contiki platform Makefile
## ##
@ -75,12 +75,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
CONTIKI_CPU=$(CONTIKI)/cpu/x86 CONTIKI_CPU=$(CONTIKI)/cpu/x86
### Compiler arguments ### Compiler arguments
CFLAGSNO = -I. -I$(CONTIKI_CPU) \ CFLAGSNO = $(EXTRA_CC_ARGS) -Wall -g -I/usr/local/include
$(EXTRA_CC_ARGS) \
-I$(COOJA) \
-I$(CONTIKI)/core \
-DWITH_UIP -DWITH_ASCII \
-Wall -g -I. -I/usr/local/include
CFLAGS = $(CFLAGSNO) CFLAGS = $(CFLAGSNO)
### Define custom targets ### Define custom targets