summaryrefslogtreecommitdiff
path: root/compiler/cpp/Makefile.am
diff options
context:
space:
mode:
authorNobuaki Sukegawa <nsuke@apache.org>2016-09-10 14:02:19 +0900
committerNobuaki Sukegawa <nsuke@apache.org>2016-09-26 01:42:01 +0900
commit11da87e6f30c237869a09e28ab44fe4a59db270e (patch)
tree4c81e09a6c5647cf8b4216379c30ec8ec2cb5517 /compiler/cpp/Makefile.am
parent1e3cf9b9fdcf9a7b7ffc18a2e6148465b154e66b (diff)
downloadthrift-11da87e6f30c237869a09e28ab44fe4a59db270e.tar.gz
THRIFT-2835 Add possibility to distribute generators separately from thrift core, and load them dynamically
Client: Compiler Patch: Nobuaki Sukegawa, rebased by dtmuller Also fixed by dtmuller: * Add plugin namespace for erlang language binding * Fix unit test test_const_value * Don't clear type cache with every t_program conversion * Type "wb" may not be supported by popen on non-Windows platforms * Fix constness of AST type signatures
Diffstat (limited to 'compiler/cpp/Makefile.am')
-rw-r--r--compiler/cpp/Makefile.am65
1 files changed, 49 insertions, 16 deletions
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 49ec26e3b..f7a717165 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -21,25 +21,34 @@
# Please see doc/old-thrift-license.txt in the Thrift distribution for
# details.
-AM_YFLAGS = -d
-LIBS =
-BUILT_SOURCES = src/thrifty.cc
+AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = thrift
+# Note on why we have src and src/plugin directories:
+# Since Automake supports only one set of BUILT_SOURCES per file and does not allow
+# SUBDIRS built before BUILT_SOURCES, we end up separate Makefile.am for each source
+# code generation, i.e. lex-yacc and Thrift, to achieve stable parallel make.
+
+SUBDIRS = src src/plugin .
+if WITH_TESTS
+SUBDIRS += test
+endif
-noinst_LIBRARIES = libparse.a
+bin_PROGRAMS = thrift
thrift_OBJDIR = obj
-thrift_SOURCES = src/main.cc \
+plugin_gen = src/plugin/plugin_types.h \
+ src/plugin/plugin_types.cpp \
+ src/plugin/plugin_constants.h \
+ src/plugin/plugin_constants.cpp
+
+compiler_core = src/common.h \
+ src/common.cc \
src/generate/t_generator.cc \
src/generate/t_generator_registry.h \
src/globals.h \
- src/main.h \
src/platform.h \
src/logging.h \
- src/audit/t_audit.cpp \
- src/audit/t_audit.h \
src/parse/t_doc.h \
src/parse/t_type.h \
src/parse/t_base_type.h \
@@ -66,6 +75,11 @@ thrift_SOURCES = src/main.cc \
src/windows/config.h \
src/windows/version.h
+thrift_SOURCES = src/main.h \
+ src/main.cc \
+ src/audit/t_audit.cpp \
+ src/audit/t_audit.h
+
# Specific client generator source
thrift_SOURCES += src/generate/t_c_glib_generator.cc \
src/generate/t_cpp_generator.cc \
@@ -98,13 +112,32 @@ thrift_SOURCES += src/generate/t_c_glib_generator.cc \
thrift_CPPFLAGS = -I$(srcdir)/src
thrift_CXXFLAGS = -Wall -Wextra -pedantic
-thrift_LDADD = @LEXLIB@ libparse.a
+thrift_LDADD = @LEXLIB@ src/libparse.a
+
+if !WITH_PLUGIN
+thrift_SOURCES += $(compiler_core)
+else
+
+lib_LTLIBRARIES = libthriftc.la
+
+thrift_CPPFLAGS += -DTHRIFT_ENABLE_PLUGIN=1
+thrift_LDADD += libthriftc.la
+
+nodist_libthriftc_la_SOURCES = $(plugin_gen)
+libthriftc_la_SOURCES = $(compiler_core) \
+ src/plugin/type_util.h \
+ src/plugin/plugin.h \
+ src/plugin/plugin.cc \
+ src/plugin/plugin_output.h \
+ src/plugin/plugin_output.cc \
+ src/plugin/plugin.thrift \
+ src/logging.cc
-libparse_a_CPPFLAGS = -I$(srcdir)/src
-libparse_a_CXXFLAGS = -Wall -Wno-sign-compare -Wno-unused
-libparse_a_SOURCES = src/thrifty.yy \
- src/thriftl.ll
+libthriftc_la_CPPFLAGS = -I$(srcdir)/src -Isrc -I$(top_builddir)/lib/cpp/src -DTHRIFT_ENABLE_PLUGIN=1
+libthriftc_la_CXXFLAGS = -Wall -Wextra -pedantic
+libthriftc_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la
+endif
WINDOWS_DIST = \
compiler.sln \
@@ -118,9 +151,9 @@ EXTRA_DIST = \
$(WINDOWS_DIST)
clean-local:
- $(RM) thriftl.cc thrifty.cc thrifty.h thrifty.hh version.h windows/version.h
+ $(RM) version.h windows/version.h $(plugin_gen)
-src/main.cc: version.h
+src/main.cc: src/version.h
style-local:
$(CPPSTYLE_CMD)