Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1491117
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 01/18] tools build: Support compiling C++ source file |
| Date | 2016-09-26 09:40 +0200 |
| Message-ID | <slyG6-XP-15@gated-at.bofh.it> (permalink) |
| References | <slywp-UK-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Add new rule to compile .cpp file to .o use g++. C++ support is
required for built-in clang and LLVM support.
Linker side support will be introduced by following commits.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
---
tools/build/Build.include | 1 +
tools/build/Makefile.build | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/tools/build/Build.include b/tools/build/Build.include
index 4d000bc..b9f014d 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -90,3 +90,4 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
# - per object C flags
# - BUILD_STR macro to allow '-D"$(variable)"' constructs
c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
+cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index 27f3583..b84be2e 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -58,6 +58,9 @@ quiet_cmd_mkdir = MKDIR $(dir $@)
quiet_cmd_cc_o_c = CC $@
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
+quiet_cmd_cxx_o_c = CXX $@
+ cmd_cxx_o_c = $(CXX) $(cxx_flags) -c -o $@ $<
+
quiet_cmd_cpp_i_c = CPP $@
cmd_cpp_i_c = $(CC) $(c_flags) -E -o $@ $<
@@ -77,6 +80,10 @@ $(OUTPUT)%.o: %.c FORCE
$(call rule_mkdir)
$(call if_changed_dep,cc_o_c)
+$(OUTPUT)%.o: %.cpp FORCE
+ $(call rule_mkdir)
+ $(call if_changed_dep,cxx_o_c)
+
$(OUTPUT)%.o: %.S FORCE
$(call rule_mkdir)
$(call if_changed_dep,cc_o_c)
--
1.8.3.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2 01/18] tools build: Support compiling C++ source file Wang Nan <wangnan0@huawei.com> - 2016-09-26 09:40 +0200 [tip:perf/urgent] tools build: Support compiling C++ source file tip-bot for Wang Nan <tipbot@zytor.com> - 2016-10-07 00:50 +0200
csiph-web