glsl/build: Don't build builtin_compiler separately if not cross compiling
authorMatt Turner <mattst88@gmail.com>
Tue, 15 Jan 2013 00:16:00 +0000 (16:16 -0800)
committerMatt Turner <mattst88@gmail.com>
Tue, 22 Jan 2013 22:33:16 +0000 (14:33 -0800)
Reduces the number of times that src/glsl/ is compiled when not cross
compiling.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
configure.ac
src/glsl/.gitignore
src/glsl/Makefile.am

index e7c234016db5e0dfd2a443dc1df38596e94a2f77..264e9c7cbd1173bb8ade0bc875321f9506dddad4 100644 (file)
@@ -1967,6 +1967,8 @@ AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
 
+AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
+
 AC_SUBST([VDPAU_MAJOR], 1)
 AC_SUBST([VDPAU_MINOR], 0)
 
index 4eb4fef9bb8493eea66547440e8710f906b24d9b..a04df27f50b0df5c8dc61e2e83c24aa0bdd43ffd 100644 (file)
@@ -4,4 +4,5 @@ glsl_parser.cc
 glsl_parser.h
 glsl_parser.output
 builtin_function.cpp
+builtincompiler
 glsl_test
index fa09c5e508ffb706c235c95c51d252f3ca732ee3..07fcf96488366ddf535e71c9100fc78aa2b7c11a 100644 (file)
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
+if CROSS_COMPILING
 SUBDIRS = builtin_compiler glcpp
+else
+SUBDIRS = glcpp
+endif
 
 AM_CPPFLAGS = \
        -I$(top_srcdir)/include \
@@ -56,6 +60,27 @@ 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.ll                                   \
+       glsl_parser.cc                                  \
+       $(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 glcpp/libglcpp.la
+endif
+
 # automake <=1.11 and automake >=1.12 have different conventions for naming C++ header files
 # made by yacc.  To work with both, we write our own rule rather than using automake's.
 # When (if) we require automake >=1.12 in configure.ac, this can be removed, and we can use
@@ -66,5 +91,5 @@ glsl_parser.cc glsl_parser.h: glsl_parser.yy
 BUILT_SOURCES = glsl_parser.h
 CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) 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 builtin_compiler/builtin_compiler$(BUILD_EXEEXT)
-       $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py builtin_compiler/builtin_compiler$(BUILD_EXEEXT) > 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 $(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