[Mesa-dev] [PATCH] src/glsl/Makefile.am: Fix for automake-1.12 C++ yacc header file naming change

Jon TURNEY jon.turney at dronecode.org.uk
Fri Jul 13 14:45:07 PDT 2012


Commit 68e04cc6 was tested using automake-1.11.  Unfortunately, automake-1.12
made a "slightly backward-incompatible change" in the use of yacc with C++, and
for a .yy file, the generated header file is now .hh, not .h

To work with both, write our own rule for running yacc, which generates a
header file named .h, rather than using automake's rule.

Also, remove things from BUILD_SOURCES which don't need to be there

mattst88 doen't like this approach and wants to do something cunning with
symlinks instead, so this is just a placeholder until that turns up :-)

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 src/glsl/Makefile.am |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 2b9ca2c..a3f0c7a 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -37,7 +37,6 @@ AM_CFLAGS = \
 
 AM_CXXFLAGS = $(AM_CFLAGS)
 
-AM_YFLAGS = -v -d -p "_mesa_glsl_"
 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
 
 GLSL_SRCDIR=$(top_srcdir)/src/glsl
@@ -49,10 +48,12 @@ noinst_PROGRAMS = glsl_compiler glsl_test builtin_compiler
 # common sources for builtin_compiler and libglsl
 libglslcommon_la_SOURCES = \
 	glsl_lexer.ll \
-	glsl_parser.yy \
 	$(LIBGLSL_FILES) \
 	$(LIBGLSL_CXX_FILES)
 
+nodist_libglslcommon_la_SOURCES = \
+	glsl_parser.cc
+
 libglslcommon_la_LIBADD = glcpp/libglcpp.la
 
 # common sources for builtin_compiler and glsl_compiler
@@ -87,8 +88,13 @@ builtin_compiler_SOURCES = \
 
 builtin_compiler_LDADD = libglslcommon.la
 
-BUILT_SOURCES = glsl_lexer.cc glsl_parser.cc glsl_parser.h builtin_function.cpp
-CLEANFILES = $(BUILT_SOURCES)
+# 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.
+glsl_parser.cc glsl_parser.h: glsl_parser.yy
+	$(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" --defines=glsl_parser.h $<
+
+BUILT_SOURCES = glsl_parser.h builtin_function.cpp
+CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES)
 
 builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/glsl/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT)
 	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
-- 
1.7.9



More information about the mesa-dev mailing list