From ae2073cac9ab6ff064f5bffd81458c4de8683266 Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Sat, 19 May 2007 07:54:53 +0000 Subject: [PATCH] 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. --- Makefile.include | 4 +++- cpu/6502/Makefile.6502 | 4 ++-- cpu/msp430/Makefile.msp430 | 8 ++------ cpu/native/Makefile.native | 5 +---- cpu/x86/Makefile.x86 | 6 +----- platform/cooja/Makefile.cooja | 9 ++------- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/Makefile.include b/Makefile.include index 66070fd91..8bad9e2e5 100644 --- a/Makefile.include +++ b/Makefile.include @@ -77,7 +77,7 @@ endif 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)} @@ -90,6 +90,8 @@ SOURCEDIRS = $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \ vpath %.c $(SOURCEDIRS) vpath %.S $(SOURCEDIRS) +CFLAGS += ${addprefix -I,$(SOURCEDIRS)} + ### Automatic dependency generation ifneq ($(MAKECMDGOALS),clean) diff --git a/cpu/6502/Makefile.6502 b/cpu/6502/Makefile.6502 index 8b276cf06..716db8d32 100644 --- a/cpu/6502/Makefile.6502 +++ b/cpu/6502/Makefile.6502 @@ -30,7 +30,7 @@ # # Author: Oliver Schmidt # -# $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 @@ -69,7 +69,7 @@ LD = ld65 AR = ar65 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 AROPTS = a diff --git a/cpu/msp430/Makefile.msp430 b/cpu/msp430/Makefile.msp430 index ba52bd832..6af349d86 100644 --- a/cpu/msp430/Makefile.msp430 +++ b/cpu/msp430/Makefile.msp430 @@ -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 CFLAGS += -DNODEID=$(nodeid) @@ -39,11 +39,7 @@ NM = msp430-nm OBJCOPY = msp430-objcopy STRIP = msp430-strip BSL = msp430-bsl -CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ - -I$(CONTIKI)/platform/$(TARGET) \ - ${addprefix -I,$(APPDIRS)} \ - -DWITH_ASCII \ - -Wall -mmcu=$(MCU) -g +CFLAGSNO = -Wall -mmcu=$(MCU) -g CFLAGS += $(CFLAGSNO) -Os LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map diff --git a/cpu/native/Makefile.native b/cpu/native/Makefile.native index 694ae2d46..c495e783c 100644 --- a/cpu/native/Makefile.native +++ b/cpu/native/Makefile.native @@ -8,10 +8,7 @@ LD = gcc AS = as OBJCOPY = objcopy STRIP = strip -CFLAGSNO = -I. -I$(CONTIKI) -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ - -I$(CONTIKI)/platform/$(TARGET) \ - ${addprefix -I,$(APPDIRS)} $(APP_INCLUDES) \ - -Wall -g -I. -I/usr/local/include +CFLAGSNO = -Wall -g -I/usr/local/include CFLAGS += $(CFLAGSNO) -O LDFLAGS = -Wl,-Map=contiki-native.map,-export-dynamic diff --git a/cpu/x86/Makefile.x86 b/cpu/x86/Makefile.x86 index 2ba6d9da9..4b8f0263f 100644 --- a/cpu/x86/Makefile.x86 +++ b/cpu/x86/Makefile.x86 @@ -8,11 +8,7 @@ LD = gcc AS = as OBJCOPY = objcopy STRIP = strip -CFLAGSNO = -I. -I$(CONTIKI) -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ - -I$(CONTIKI)/platform/$(TARGET) \ - ${addprefix -I,$(APPDIRS)} $(APP_INCLUDES) \ - -DWITH_UIP -DWITH_ASCII \ - -Wall -g -I. -I/usr/local/include +CFLAGSNO = -Wall -g -I/usr/local/include CFLAGS += $(CFLAGSNO) LDFLAGS = -Wl,-Map=contiki.map,-export-dynamic diff --git a/platform/cooja/Makefile.cooja b/platform/cooja/Makefile.cooja index 81d649cca..9d9721615 100644 --- a/platform/cooja/Makefile.cooja +++ b/platform/cooja/Makefile.cooja @@ -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 ## @@ -75,12 +75,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) CONTIKI_CPU=$(CONTIKI)/cpu/x86 ### Compiler arguments -CFLAGSNO = -I. -I$(CONTIKI_CPU) \ - $(EXTRA_CC_ARGS) \ - -I$(COOJA) \ - -I$(CONTIKI)/core \ - -DWITH_UIP -DWITH_ASCII \ - -Wall -g -I. -I/usr/local/include +CFLAGSNO = $(EXTRA_CC_ARGS) -Wall -g -I/usr/local/include CFLAGS = $(CFLAGSNO) ### Define custom targets