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

- Search target specific directories before CPU specific directories.
- Search CPU specific directories before generic directories.

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-13 08:41:11 +00:00
parent 4832e803e8
commit 237b1617b5
11 changed files with 24 additions and 87 deletions

View file

@ -70,8 +70,22 @@ ifdef APPS
endif
### Include target makefile (TODO Unsafe?)
include $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET)
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \
$(CONTIKI_CPU_DIRS)}
SOURCEDIRS = $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDIRS)
vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS)
### Automatic dependency generation
ifneq ($(MAKECMDGOALS),clean)
@ -79,7 +93,6 @@ ifneq ($(MAKECMDGOALS),clean)
$(PROJECT_SOURCEFILES:.c=.d)}
endif
clean:
rm -f *~ *core core *.srec \
*.lst *.map \

View file

@ -30,7 +30,7 @@
#
# Author: Oliver Schmidt <ol.sc@web.de>
#
# $Id: Makefile.6502,v 1.7 2007/04/21 22:15:45 oliverschmidt Exp $
# $Id: Makefile.6502,v 1.8 2007/05/13 08:41:32 oliverschmidt Exp $
#
ifndef CONTIKI
@ -96,16 +96,3 @@ CUSTOM_RULE_C_TO_CO = 1
$(OBJECTDIR)/%.o: %.S
$(AS) $(AFLAGS) $< -o $@
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI)/cpu/6502/, \
$(CONTIKI_CPU_DIRS)}
SOURCEDIRS = $(PROJECTDIRS) \
$(CONTIKI_TARGET_DIRS_CONCAT) $(CONTIKI_CPU_DIRS_CONCAT) \
$(CONTIKIDIRS) $(APPDIRS) $(APP_DIRS)
vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS)

View file

@ -1,4 +1,4 @@
# $Id: Makefile.msp430,v 1.15 2007/04/03 19:05:13 adamdunkels Exp $
# $Id: Makefile.msp430,v 1.16 2007/05/13 08:41:49 oliverschmidt Exp $
ifdef nodeid
CFLAGS += -DNODEID=$(nodeid)
@ -11,6 +11,8 @@ CONTIKI_CPU=$(CONTIKI)/cpu/msp430
### Define the source files we have in the MSP430 port
CONTIKI_CPU_DIRS = . dev
MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \
watchdog.c lpm.c mtarch.c uart1.c rtimer-arch.c
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
@ -47,18 +49,8 @@ LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map
PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU) $(CONTIKI_CPU)/dev
### Compilation rules
%-stripped.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIP) --strip-unneeded -g -x $@

View file

@ -1,3 +1,5 @@
CONTIKI_CPU_DIRS = . net
CONTIKI_SOURCEFILES += mtarch.c rtimer-arch.c elfloader-stub.c
### Compiler definitions
@ -27,5 +29,3 @@ else
symbols.c symbols.h:
@${CONTIKI}/tools/make-empty-symbols
endif
CONTIKI_TARGET_DIRS += $(CONTIKI_CPU)/net

View file

@ -1,3 +1,5 @@
CONTIKI_CPU_DIRS = .
CONTIKI_SOURCEFILES += mtarch.c elfloader-x86.c
### Compiler definitions

View file

@ -1,4 +1,4 @@
# $Id: Makefile.cooja,v 1.14 2007/04/02 10:28:52 fros4943 Exp $
# $Id: Makefile.cooja,v 1.15 2007/05/13 08:42:54 oliverschmidt Exp $
## The COOJA Simulator Contiki platform Makefile
##
@ -83,14 +83,6 @@ CFLAGSNO = -I. -I$(CONTIKI_CPU) \
-Wall -g -I. -I/usr/local/include
CFLAGS = $(CFLAGSNO)
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(COOJA)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU)
### Define custom targets
$(LIBFILE): $(MAINFILE) $(PROJECT_OBJECTFILES) $(DEPFILE)
ifdef SYMBOLS
@ -114,4 +106,3 @@ endif
symbols.c:
# Create initial symbol files if not existing
${CONTIKI}/tools/make-empty-symbols

View file

@ -26,12 +26,3 @@ include $(CONTIKI_CPU)/Makefile.native
CFLAGS += -DCTK_GTKSIM_SERVICE_PNGDIR=\"$(CONTIKI)/platform/gtk\" \
`pkg-config --cflags gtk+-2.0`
TARGET_LIBFILES = -Wl,-Map=contiki.map,-export-dynamic `pkg-config --libs gtk+-2.0`
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU) $(APP_DIRS)

View file

@ -2,8 +2,6 @@ ifndef CONTIKI
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
endif
#contiki: contiki-$(TARGET).a
CONTIKI_TARGET_DIRS = .
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
@ -27,11 +25,3 @@ endif
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/cpu/native
include $(CONTIKI)/cpu/native/Makefile.native
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU) $(APP_DIRS)

View file

@ -2,8 +2,6 @@ ifndef CONTIKI
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
endif
#contiki: contiki-$(TARGET).a
CONTIKI_TARGET_DIRS = . dev
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
@ -18,11 +16,3 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/cpu/native
include $(CONTIKI)/cpu/native/Makefile.native
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU) $(APP_DIRS)

View file

@ -2,8 +2,6 @@ ifndef CONTIKI
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
endif
#contiki: contiki-$(TARGET).a
CONTIKI_TARGET_DIRS = . dev apps net
SENSORS = sensors.c beep.c button-sensor.c pir-sensor.c vib-sensor.c \
@ -35,13 +33,3 @@ TARGET_LIBFILES = `gtk-config --libs`
ifeq ($(OS),Windows_NT)
TARGET_LIBFILES += /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
endif
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU)
### Compilation rules

View file

@ -30,7 +30,7 @@
#
# Author: Oliver Schmidt <ol.sc@web.de>
#
# $Id: Makefile.win32,v 1.7 2007/04/21 22:17:22 oliverschmidt Exp $
# $Id: Makefile.win32,v 1.8 2007/05/13 08:46:18 oliverschmidt Exp $
#
ifndef CONTIKI
@ -77,10 +77,3 @@ $(PRGS:=.prg):
$(LD) -shared $^ contiki-main.$(TARGET).a -o $@
$(DSCS:=.dsc):
$(LD) -shared $^ contiki-main.$(TARGET).a -o $@
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU) $(APP_DIRS)