[Mesa-dev] [PATCH 5/6] build/glsl: fix location of generated files.

Christopher James Halse Rogers christopher.halse.rogers at canonical.com
Tue Jul 17 22:08:30 PDT 2012


Like in src/mesa, use GLSL_BUILDDIR/GLSL_SRCDIR to unambiguously
distinguish between in-tree and generated files.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
---
 src/glsl/Makefile.am            |    4 ----
 src/glsl/Makefile.sources       |   15 ++++++++-------
 src/glsl/glcpp/Makefile.am      |    4 ----
 src/mapi/es1api/Makefile        |    4 ++++
 src/mapi/glapi/gen/glapi_gen.mk |   14 +++++++-------
 5 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index d86153c..0ab6672 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -23,9 +23,6 @@
 # builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl.
 # For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used.
 
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/mapi \
@@ -39,7 +36,6 @@ AM_CXXFLAGS = $(AM_CFLAGS)
 
 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
 
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
 include Makefile.sources
 
 noinst_LTLIBRARIES = libglslcommon.la libglsl.la
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index f2743f7..15c717a 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -1,6 +1,7 @@
 # shared source lists for Makefile, SConscript, and Android.mk
 
-GLSL_SRCDIR ?= .
+GLSL_SRCDIR = $(top_srcdir)/src/glsl
+GLSL_BUILDDIR = $(top_builddir)/src/glsl
 
 # libglcpp
 
@@ -8,8 +9,8 @@ LIBGLCPP_FILES = \
 	$(GLSL_SRCDIR)/glcpp/pp.c
 
 LIBGLCPP_GENERATED_FILES = \
-	$(GLSL_SRCDIR)/glcpp/glcpp-lex.c \
-	$(GLSL_SRCDIR)/glcpp/glcpp-parse.c
+	$(GLSL_BUILDDIR)/glcpp/glcpp-lex.c \
+	$(GLSL_BUILDDIR)/glcpp/glcpp-parse.c
 
 # libglsl
 
@@ -101,10 +102,10 @@ BUILTIN_COMPILER_CXX_FILES = \
 	$(GLSL_SRCDIR)/builtin_stubs.cpp
 
 BUILTIN_COMPILER_GENERATED_CXX_FILES = \
-	$(GLSL_SRCDIR)/glsl_lexer.cc \
-	$(GLSL_SRCDIR)/glsl_parser.cc
+	$(GLSL_BUILDDIR)/glsl_lexer.cc \
+	$(GLSL_BUILDDIR)/glsl_parser.cc
 
 # libglsl generated sources
 LIBGLSL_GENERATED_CXX_FILES = \
-	$(GLSL_SRCDIR)/$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
-	$(GLSL_SRCDIR)/builtin_function.cpp
+	$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
+	$(GLSL_BUILDDIR)/builtin_function.cpp
diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
index e7d5d2c..7a95b68 100644
--- a/src/glsl/glcpp/Makefile.am
+++ b/src/glsl/glcpp/Makefile.am
@@ -20,10 +20,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
 include ../Makefile.sources
 
 AM_CFLAGS = \
diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
index a9c9123..6f4c35a 100644
--- a/src/mapi/es1api/Makefile
+++ b/src/mapi/es1api/Makefile
@@ -40,6 +40,10 @@ esapi_CPPFLAGS := \
 	-I$(TOP)/src/mapi \
 	-DMAPI_ABI_HEADER=\"$(ESAPI)/glapi_mapi_tmp.h\"
 
+
+# This is a lie when doing out-of-tree builds, but it's no worse than the
+# current situation, and can be dropped should this get automakified
+top_srcdir = $(TOP)
 include $(MAPI)/sources.mak
 esapi_SOURCES := $(MAPI_BRIDGE_FILES)
 esapi_OBJECTS := $(notdir $(MAPI_BRIDGE_FILES:.c=.o))
diff --git a/src/mapi/glapi/gen/glapi_gen.mk b/src/mapi/glapi/gen/glapi_gen.mk
index 1b05a40..eab8eb4 100644
--- a/src/mapi/glapi/gen/glapi_gen.mk
+++ b/src/mapi/glapi/gen/glapi_gen.mk
@@ -1,14 +1,14 @@
 # Helpers for glapi header generation
 
-ifndef TOP
-$(error TOP must be defined.)
+ifndef top_srcdir
+$(error top_srcdir must be defined.)
 endif
 
 glapi_gen_common_deps := \
-	$(wildcard $(TOP)/src/mapi/glapi/gen/*.xml) \
-	$(wildcard $(TOP)/src/mapi/glapi/gen/*.py)
+	$(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \
+	$(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py)
 
-glapi_gen_mapi_script := $(TOP)/src/mapi/mapi/mapi_abi.py
+glapi_gen_mapi_script := $(top_srcdir)/src/mapi/mapi/mapi_abi.py
 glapi_gen_mapi_deps := \
 	$(glapi_gen_mapi_script) \
 	$(glapi_gen_common_deps)
@@ -21,7 +21,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) \
 	--mode lib --printer $(2) $(1) > $@
 endef
 
-glapi_gen_dispatch_script := $(TOP)/src/mapi/glapi/gen/gl_table.py
+glapi_gen_dispatch_script := $(top_srcdir)/src/mapi/glapi/gen/gl_table.py
 glapi_gen_dispatch_deps := $(glapi_gen_common_deps)
 
 # $(1): path to an XML file
@@ -32,7 +32,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_dispatch_script) \
 	-f $(1) -m remap_table $(if $(2),-c $(2),) > $@
 endef
 
-glapi_gen_remap_script := $(TOP)/src/mapi/glapi/gen/remap_helper.py
+glapi_gen_remap_script := $(top_srcdir)/src/mapi/glapi/gen/remap_helper.py
 glapi_gen_remap_deps := $(glapi_gen_common_deps)
 
 # $(1): path to an XML file
-- 
1.7.10.4



More information about the mesa-dev mailing list