aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Makefile.am
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@google.com>2017-01-03 13:07:21 -0800
committerGravatar Adam Cozzette <acozzette@google.com>2017-01-03 13:14:39 -0800
commitb40d318650ccde8893400c32814df6f4cdd24fe5 (patch)
tree25858a46061ed5904adad12b0f4e92049b1ac0b1 /src/Makefile.am
parent4cb113a91b180559f0eedbca0244ef1181a7204c (diff)
Fixed cross compilations with the Autotools build
Pull request #2517 caused cross compilations to start failing, because the js_embed binary was being built to run on the target platform instead of on the build machine. This change updates the Autotools build to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for the build machine and always use that when building js_embed.
Diffstat (limited to 'src/Makefile.am')
-rw-r--r--src/Makefile.am9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 37204ea0..5130d0b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -484,13 +484,16 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_wrapper_field.cc \
google/protobuf/compiler/csharp/csharp_wrapper_field.h
-bin_PROGRAMS = protoc js_embed
+bin_PROGRAMS = protoc
protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la
protoc_SOURCES = google/protobuf/compiler/main.cc
# The special JS code for the well-known types is linked into the compiler via
-# well_known_types_embed.cc, which is generated from .js source files.
-js_embed_SOURCES = google/protobuf/compiler/js/embed.cc
+# well_known_types_embed.cc, which is generated from .js source files. We have
+# to build the js_embed binary using $(CXX_FOR_BUILD) so that it is executable
+# on the build machine in a cross-compilation setup.
+js_embed$(EXEEXT): google/protobuf/compiler/js/embed.cc
+ $(CXX_FOR_BUILD) -o $@ $<
js_well_known_types_sources = \
google/protobuf/compiler/js/well_known_types/any.js \
google/protobuf/compiler/js/well_known_types/struct.js \