Makefile: add flag to disable C++ components
This commit is contained in:
parent
1d77f3ec1f
commit
87ed838927
2 changed files with 9 additions and 3 deletions
10
common.mk
10
common.mk
|
@ -97,10 +97,14 @@ $(1)_DEFAULT_ROOT := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
$(1)_ROOT ?= $$($(1)_DEFAULT_ROOT)
|
$(1)_ROOT ?= $$($(1)_DEFAULT_ROOT)
|
||||||
$(1)_OBJ_DIR = $(call lc,$(BUILD_DIR)$(1)/)
|
$(1)_OBJ_DIR = $(call lc,$(BUILD_DIR)$(1)/)
|
||||||
### determine source files and object files ###
|
### determine source files and object files ###
|
||||||
$(1)_SRC_FILES ?= $$(foreach sdir,$$($(1)_SRC_DIR), \
|
$(1)_TMP_SRC_FILES = $$(foreach sdir,$$($(1)_SRC_DIR), \
|
||||||
$$(wildcard $$(sdir)/*.c) $$(wildcard $$(sdir)/*.S) \
|
$$(wildcard $$(sdir)/*.c) $$(wildcard $$(sdir)/*.S)) \
|
||||||
$$(wildcard $$(sdir)/*.cpp)) \
|
|
||||||
$$($(1)_EXTRA_SRC_FILES)
|
$$($(1)_EXTRA_SRC_FILES)
|
||||||
|
ifeq ($(ENABLE_CXX),1)
|
||||||
|
$(1)_TMP_SRC_FILES += $$(foreach sdir,$$($(1)_SRC_DIR), \
|
||||||
|
$$(wildcard $$(sdir)/*.cpp))
|
||||||
|
endif
|
||||||
|
$(1)_SRC_FILES ?= $$($(1)_TMP_SRC_FILES)
|
||||||
$(1)_REAL_SRC_FILES = $$(foreach sfile,$$($(1)_SRC_FILES),$$(realpath $$(sfile)))
|
$(1)_REAL_SRC_FILES = $$(foreach sfile,$$($(1)_SRC_FILES),$$(realpath $$(sfile)))
|
||||||
$(1)_REAL_ROOT = $$(realpath $$($(1)_ROOT))
|
$(1)_REAL_ROOT = $$(realpath $$($(1)_ROOT))
|
||||||
# patsubst here substitutes real component root path for the relative OBJ_DIR path, making things short again
|
# patsubst here substitutes real component root path for the relative OBJ_DIR path, making things short again
|
||||||
|
|
|
@ -85,6 +85,8 @@ SPLIT_SECTIONS ?= 1
|
||||||
# compile without warnings to be accepted.
|
# compile without warnings to be accepted.
|
||||||
WARNINGS_AS_ERRORS ?= 0
|
WARNINGS_AS_ERRORS ?= 0
|
||||||
|
|
||||||
|
ENABLE_CXX ?= 1
|
||||||
|
|
||||||
# Common flags for both C & C++_
|
# Common flags for both C & C++_
|
||||||
C_CXX_FLAGS ?= -Wall -Wl,-EL -nostdlib $(EXTRA_C_CXX_FLAGS)
|
C_CXX_FLAGS ?= -Wall -Wl,-EL -nostdlib $(EXTRA_C_CXX_FLAGS)
|
||||||
# Flags for C only
|
# Flags for C only
|
||||||
|
|
Loading…
Reference in a new issue