summaryrefslogtreecommitdiffstats
path: root/tools/build/Makefile.build
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-09-26 09:26:55 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-06 00:58:51 +0200
commitf61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e (patch)
tree039e05791992e7c49ceadfbf52535f4d7ecef481 /tools/build/Makefile.build
parentperf top/report: Add tips about a list option (diff)
downloadlinux-f61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e.tar.xz
linux-f61bdc3304281e9ff9eec4f1ed9fb15bcf4d8a5e.zip
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>
Diffstat (limited to 'tools/build/Makefile.build')
-rw-r--r--tools/build/Makefile.build7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index 190519a94ce5..99c0ccd2f176 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)