Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1496898

[tip:perf/urgent] tools build: Support compiling C++ source file

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From tip-bot for Wang Nan <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:perf/urgent] tools build: Support compiling C++ source file
Date Fri, 07 Oct 2016 00:50:01 +0200
Message-ID <sppEd-7qB-13@gated-at.bofh.it> (permalink)
References <slyG6-XP-15@gated-at.bofh.it>
X-Original-To linux-tip-commits@vger.kernel.org
Reply-To hpa@zytor.com, acme@redhat.com, wangnan0@huawei.com, mingo@kernel.org, hekuang@huawei.com, jolsa@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, ast@fb.com, lizefan@huawei.com
Git-Commit-ID f61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e
X-Mailer tip-git-log-daemon
Robot-ID <tip-bot.git.kernel.org>
Robot-Unsubscribe Contact <mailto:hpa@kernel.org> to get blacklisted from these emails
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Content-Type text/plain; charset=UTF-8
Content-Disposition inline
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 64
Organization linux.* mail to news gateway
X-Original-Cc jolsa@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, ast@fb.com, lizefan@huawei.com, wangnan0@huawei.com, mingo@kernel.org, hekuang@huawei.com, hpa@zytor.com, acme@redhat.com
X-Original-Date Thu, 6 Oct 2016 15:44:51 -0700
X-Original-Message-ID <tip-f61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e@git.kernel.org>
X-Original-References <1474874832-134786-2-git-send-email-wangnan0@huawei.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1496898

Show key headers only | View raw


Commit-ID:  f61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e
Gitweb:     http://git.kernel.org/tip/f61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e
Author:     Wang Nan <wangnan0@huawei.com>
AuthorDate: Mon, 26 Sep 2016 07:26:55 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 5 Oct 2016 19:58:51 -0300

tools build: Support compiling C++ source file

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: Alexei Starovoitov <ast@fb.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1474874832-134786-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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 0248938..1dcb95e 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -90,6 +90,7 @@ 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))
 
 ###
 ## HOSTCC C flags
diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index 190519a..99c0ccd 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -61,6 +61,9 @@ quiet_cmd_cc_o_c = CC       $@
 quiet_cmd_host_cc_o_c = HOSTCC   $@
       cmd_host_cc_o_c = $(HOSTCC) $(host_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 $@ $<
 
@@ -88,6 +91,10 @@ $(OUTPUT)%.o: %.c FORCE
 	$(call rule_mkdir)
 	$(call if_changed_dep,$(host)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,$(host)cc_o_c)

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


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