Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2015-09-24 13:56:26 +0000
committerJuergen Haug2015-09-24 13:56:26 +0000
commit62d1b7a76ed7d5f656efa7982a31a6d9f3558c2a (patch)
tree80cb79c2ba093b91ce9ccdd7d04a124f26166011 /runtime/org.eclipse.etrice.runtime.c
parent4669701f21123d26671c7715e938a2e473a9ddf6 (diff)
downloadorg.eclipse.etrice-62d1b7a76ed7d5f656efa7982a31a6d9f3558c2a.tar.gz
org.eclipse.etrice-62d1b7a76ed7d5f656efa7982a31a6d9f3558c2a.tar.xz
org.eclipse.etrice-62d1b7a76ed7d5f656efa7982a31a6d9f3558c2a.zip
[runtime.c] new makefile version
[gnuplot] generate only if annotation present Change-Id: I04a6bff73a54d9dc4e6b4ad147babe19261c6b0d
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk27
1 files changed, 14 insertions, 13 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk b/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk
index 1809ac49b..fa93315de 100644
--- a/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk
+++ b/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk
@@ -15,11 +15,10 @@
# IN_LDLIBS
# IN_PREREQS
-# Do NOT set IN_XX as make paramater or environment variable,
-# instead set variables from outside explicit:
-# IN_TARGET := ${APP_TARGET}
-# IN_INCDIRS += ${APP_INCDIRS}
+# Note: Variables set from environment or make parameter are unmodifiable.
+# E.g. use additional variables:
# IN_SRCDIRS_REC += ${APP_SRCDIRS_REC}
+# IN_SRCDIRS_REC += ...
#-----------------------------------------------------------------------------------------------
@@ -28,6 +27,12 @@ define CANONICAL_PATH
$(patsubst ${CURDIR}/%,%,$(abspath ${1}))
endef
+# $1 = path, should end with '/' to avoid wildcard matching of directories
+# $2 = file (extension)
+define REC_FILE_SEARCH
+$(wildcard $(addsuffix $2, $1)) $(foreach d,$(wildcard $(addsuffix *, $1)),$(call REC_FILE_SEARCH,$d/,$2))
+endef
+
# USE WITH EVAL
define TARGET_RULE
ifeq "$$(suffix $${M_TARGET})" ".a"
@@ -52,7 +57,7 @@ ifeq ($(strip ${IN_TARGET_DIR}),)
IN_TARGET_DIR := ${IN_BUILD_DIR}
endif
-# Locals, no override
+# Locals, no override from 'outside'
M_TARGET := ${IN_TARGET}
M_TARGET_DIR := ${IN_TARGET_DIR}
M_BUILD_DIR := ${IN_BUILD_DIR}
@@ -66,18 +71,14 @@ M_LDLIBS := ${IN_LDLIBS}
M_PREREQS := ${IN_PREREQS}
M_OBJS :=
-
-# add sources from M_SRCDIRS_REC
-_TRAVERSECHILDREN = ${1} $(foreach CHILD,$(filter-out ${1}/,$(sort $(dir $(wildcard ${1}/*/)))),$(call ${0},$(patsubst %/,%,${CHILD})))
-_RECDIRS := $(foreach BASEDIR, ${M_SRCDIRS_REC}, $(call _TRAVERSECHILDREN, $(patsubst %/,%,${BASEDIR})))
-M_SOURCES += $(foreach DIR, ${_RECDIRS}, $(wildcard ${DIR}/*.c))
+M_SOURCES := $(call CANONICAL_PATH, ${M_SOURCES})
+M_SOURCES += $(call CANONICAL_PATH,$(foreach DIR,${IN_SRCDIRS_REC},$(call REC_FILE_SEARCH,${DIR}/,*.c)))
+M_OBJS += $(addprefix ${M_BUILD_DIR}/,$(addsuffix .o,$(basename ${M_SOURCES})))
M_DEFS := $(addprefix -D,${M_DEFS})
M_INCDIRS := $(addprefix -I,$(call CANONICAL_PATH,${M_INCDIRS}))
-M_SOURCES := $(call CANONICAL_PATH,${M_SOURCES})
-# Convert the source file names to their corresponding object file names.
-M_OBJS := $(addprefix ${M_BUILD_DIR}/,$(addsuffix .o,$(basename ${M_SOURCES})))
+#-----------------------------------------------------------------------------------------------
${M_BUILD_DIR}/%.o: %.c
@mkdir -p $(dir $@)

Back to the top