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.
This commit is contained in:
parent
a844636218
commit
b21b874801
1 changed files with 6 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue