From b21b8748015747e3fe6d7d2043e8971d0b1e59a8 Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Fri, 14 Nov 2008 21:37:45 +0000 Subject: [PATCH] Having the C preprocessor macro CONTIKI_TARGET set to $(TARGET) turned out to be not that useful for conditionals. Therefore I switched to having the macro CONTIKI_TARGET_$(TARGET) set (to the default value of 1). In order to allow for clean C code with the usual all-uppercase macro names $(TARGET) had to be converted to uppercase. Gnumake doesn't have a builtin string function for doing so, therefore sed is called. The Gnumake doc section 14.2 lists sed as one of the utilities a makefile can always presume to be available. However it states that only generally supported utility options should be used. So the GNU sed extension \U was intentionally avoided. --- Makefile.include | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile.include b/Makefile.include index 719f0c3da..aac107abd 100644 --- a/Makefile.include +++ b/Makefile.include @@ -2,9 +2,6 @@ ifndef CONTIKI ${error CONTIKI not defined! You must specify where CONTIKI resides} endif -OBJECTDIR = obj_$(TARGET) -CFLAGS += -DCONTIKI_TARGET=$(TARGET) - ifeq ($(TARGET),) -include Makefile.target ifeq ($(TARGET),) @@ -38,10 +35,16 @@ savedefines: @echo "saving Makefile.$(TARGET).defines" @echo >Makefile.$(TARGET).defines "DEFINES = $(DEFINES)" +OBJECTDIR = obj_$(TARGET) ifeq (${wildcard $(OBJECTDIR)},) DUMMY := ${shell mkdir $(OBJECTDIR)} endif +LOWERCASE = abcdefghijklmnopqrstuvwxyz +UPPERCASE = ABCDEFGHIJKLMNOPQRSTUVWXYZ +TARGET_UPPERCASE := ${shell echo $(TARGET) | sed 'y!$(LOWERCASE)!$(UPPERCASE)!'} +CFLAGS += -DCONTIKI_TARGET_$(TARGET_UPPERCASE) + include $(CONTIKI)/core/net/rime/Makefile.rime include $(CONTIKI)/core/net/mac/Makefile.mac SYSTEM = process.c procinit.c autostart.c elfloader.c profile.c timetable.c timetable-aggregate.c