From 0d108116bd80b757fb01a84a9f1946ef870b57b8 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 17 Jan 2013 23:51:04 -0800 Subject: [PATCH] glsl/build: Build libglcpp and libglslcore in builtin_compiler And reuse them if not cross compiling. Tested-by: Andreas Boll --- src/glsl/Makefile.am | 52 +++++++++++++---------------------- src/glsl/builtin_compiler/Makefile.am | 27 ++++++++++-------- 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am index f97dc21..058d8ae 100644 --- a/src/glsl/Makefile.am +++ b/src/glsl/Makefile.am @@ -19,9 +19,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -if CROSS_COMPILING SUBDIRS = builtin_compiler -endif AM_CPPFLAGS = \ -I$(top_srcdir)/include \ @@ -45,7 +43,7 @@ TESTS_ENVIRONMENT= \ export PYTHON2=$(PYTHON2); \ export PYTHON_FLAGS=$(PYTHON_FLAGS); -noinst_LTLIBRARIES = libglcpp.la libglsl.la +noinst_LTLIBRARIES = libglsl.la libglcpp.la check_PROGRAMS = \ glcpp/glcpp \ glsl_test \ @@ -74,22 +72,31 @@ tests_ralloc_test_LDADD = \ $(top_builddir)/src/gtest/libgtest.la \ $(PTHREAD_LIBS) +if CROSS_COMPILING libglcpp_la_SOURCES = \ glcpp/glcpp-lex.c \ glcpp/glcpp-parse.c \ $(LIBGLCPP_FILES) +else +libglcpp_la_LIBADD = builtin_compiler/libglcpp.la +endif glcpp_glcpp_SOURCES = \ glcpp/glcpp.c \ $(top_srcdir)/src/mesa/program/prog_hash_table.c glcpp_glcpp_LDADD = libglcpp.la -libglsl_la_SOURCES = \ +libglsl_la_SOURCES = builtin_function.cpp +libglsl_la_LIBADD = libglcpp.la +if CROSS_COMPILING +libglsl_la_SOURCES += \ glsl_lexer.cpp \ glsl_parser.cpp \ - $(LIBGLSL_FILES) \ - builtin_function.cpp -libglsl_la_LIBADD = libglcpp.la + $(LIBGLSL_FILES) +else +libglsl_la_LIBADD += \ + builtin_compiler/libglslcore.la +endif glsl_test_SOURCES = \ $(top_srcdir)/src/mesa/main/hash_table.c \ @@ -101,27 +108,6 @@ glsl_test_SOURCES = \ glsl_test_LDADD = libglsl.la -if CROSS_COMPILING -BUILTIN_COMPILER = builtin_compiler/builtin_compiler$(BUILD_EXEEXT) -else -BUILTIN_COMPILER = builtincompiler$(BUILD_EXEEXT) - -noinst_PROGRAMS = builtincompiler -noinst_LTLIBRARIES += libglslcore.la - -libglslcore_la_SOURCES = \ - glsl_lexer.cpp \ - glsl_parser.cpp \ - $(LIBGLSL_FILES) -builtincompiler_SOURCES = \ - $(top_srcdir)/src/mesa/main/hash_table.c \ - $(top_srcdir)/src/mesa/program/prog_hash_table.c\ - $(top_srcdir)/src/mesa/program/symbol_table.c \ - $(top_srcdir)/src/glsl/builtin_compiler/builtin_stubs.cpp \ - $(GLSL_COMPILER_CXX_FILES) -builtincompiler_LDADD = libglslcore.la libglcpp.la -endif - # We write our own rules for yacc and lex below. We'd rather use automake, # but automake makes it especially difficult for a number of reasons: # @@ -174,13 +160,13 @@ glcpp/glcpp-lex.c: glcpp/glcpp-lex.l # dependency rules. BUILT_SOURCES = \ glsl_parser.cpp \ - glcpp/glcpp-parse.c + glsl_lexer.cpp \ + glcpp/glcpp-parse.c \ + glcpp/glcpp-lex.c CLEANFILES = \ glcpp/glcpp-parse.h \ - glcpp/glcpp-lex.c \ glsl_parser.h \ - glsl_lexer.cpp \ $(BUILT_SOURCES) -builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py $(BUILTIN_COMPILER) - $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py $(builddir)/$(BUILTIN_COMPILER) > builtin_function.cpp || rm -f builtin_function.cpp +builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py $(builddir)/builtin_compiler/builtin_compiler$(BUILD_EXEEXT) + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py $(builddir)/builtin_compiler/builtin_compiler$(BUILD_EXEEXT) > builtin_function.cpp || rm -f builtin_function.cpp diff --git a/src/glsl/builtin_compiler/Makefile.am b/src/glsl/builtin_compiler/Makefile.am index a025556..1a863b2 100644 --- a/src/glsl/builtin_compiler/Makefile.am +++ b/src/glsl/builtin_compiler/Makefile.am @@ -43,17 +43,20 @@ AM_CXXFLAGS = $(AM_CFLAGS) include ../Makefile.sources noinst_PROGRAMS = builtin_compiler +noinst_LTLIBRARIES = libglslcore.la libglcpp.la + +libglcpp_la_SOURCES = \ + $(LIBGLCPP_GENERATED_FILES) \ + $(LIBGLCPP_FILES) + +libglslcore_la_SOURCES = \ + $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \ + $(LIBGLSL_FILES) builtin_compiler_SOURCES = \ - $(GLSL_BUILDDIR)/glcpp/glcpp-lex.c \ - $(GLSL_BUILDDIR)/glcpp/glcpp-parse.c \ - $(LIBGLCPP_FILES) \ - $(GLSL_BUILDDIR)/glsl_lexer.cpp \ - $(GLSL_BUILDDIR)/glsl_parser.cpp \ - $(LIBGLSL_FILES) \ - $(LIBGLSL_CXX_FILES) \ - $(top_srcdir)/src/mesa/main/hash_table.c \ - $(top_srcdir)/src/mesa/program/prog_hash_table.c \ - $(top_srcdir)/src/mesa/program/symbol_table.c \ - $(GLSL_COMPILER_CXX_FILES) \ - builtin_stubs.cpp + $(top_srcdir)/src/mesa/main/hash_table.c \ + $(top_srcdir)/src/mesa/program/prog_hash_table.c\ + $(top_srcdir)/src/mesa/program/symbol_table.c \ + $(BUILTIN_COMPILER_CXX_FILES) \ + $(GLSL_COMPILER_CXX_FILES) +builtin_compiler_LDADD = libglslcore.la libglcpp.la -- 2.7.4