[Mesa-dev] [PATCH 1/6] build: fix location of generated files in src/mesa (v2)

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


Also fix include paths for the generated headers.

v2: Switch to using self-explanatory BUILDDIR/SRCDIR defined from
    top_builddir/top_srcdir rather than the ambiguous TOP.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
---
 src/glx/apple/Makefile          |    4 ++++
 src/mesa/Makefile.am            |    7 ++++---
 src/mesa/Makefile.old           |    5 ++++-
 src/mesa/libdricore/Makefile.am |    3 ---
 src/mesa/sources.mak            |   34 ++++++++++++++++++++--------------
 5 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile
index 35edb09..ef12eb0 100644
--- a/src/glx/apple/Makefile
+++ b/src/glx/apple/Makefile
@@ -1,4 +1,8 @@
 TOP = ../../..
+top_builddir = $(TOP)
+# This can be a filthy lie. But it doesn't currently build out-of-tree
+# anyway, so it's no worse than what we've got now.
+top_srcdir = $(TOP)
 
 include $(TOP)/configs/current
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 2b023d7..f70a5c1 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -42,8 +42,7 @@ main/git_sha1.h: main/git_sha1.h.tmp
 	fi
 
 # include glapi_gen.mk for generating glapi headers for GLES
-TOP = $(top_srcdir)
-GLAPI = $(TOP)/src/mapi/glapi/gen
+GLAPI = $(top_srcdir)/src/mapi/glapi/gen
 include $(GLAPI)/glapi_gen.mk
 
 BUILT_SOURCES = \
@@ -95,7 +94,6 @@ program/lex.yy.c: program/program_lexer.l
 
 noinst_LTLIBRARIES = libmesa.la libmesagallium.la
 
-SRCDIR = $(top_srcdir)/src/mesa
 include sources.mak
 
 AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
@@ -107,12 +105,15 @@ MESA_ASM_FILES_FOR_ARCH =
 
 if HAVE_X86_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
+AM_CPPFLAGS += -I$(top_builddir)/src/mesa/x86
 endif
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
+AM_CPPFLAGS += -I$(top_builddir)/src/mesa/x86-64
 endif
 if HAVE_SPARC_ASM
 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
+AM_CPPFLAGS += -I$(top_builddir)/src/mesa/sparc
 endif
 
 libmesa_la_SOURCES = \
diff --git a/src/mesa/Makefile.old b/src/mesa/Makefile.old
index 3266a5d..5b5c745 100644
--- a/src/mesa/Makefile.old
+++ b/src/mesa/Makefile.old
@@ -1,9 +1,12 @@
 # src/mesa/Makefile
 
 TOP = ../..
+top_builddir = $(TOP)
+# This is a filthy lie in the case of out-of-tree builds. But it doesn't
+# currently build out-of-tree anyway, so it's no worse than what we've got now.
+top_srcdir = $(TOP)
 include $(TOP)/configs/current
 
-SRCDIR = .
 include sources.mak
 
 default:
diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 26d8a88..7e1c22a 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -19,10 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-TOP=$(top_srcdir)
-SRCDIR = $(srcdir)/..
 include ../sources.mak
-GLSL_SRCDIR = $(srcdir)/../../glsl
 include ../../glsl/Makefile.sources
 
 noinst_PROGRAMS =
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index d22f059..9f83069 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -1,11 +1,12 @@
 ### Lists of source files, included by Makefiles
 
-SRCDIR ?= .
+SRCDIR=$(top_srcdir)/src/mesa
+BUILDDIR=$(top_builddir)/src/mesa
 
 # this is part of MAIN_FILES
 MAIN_ES_FILES = \
-	$(SRCDIR)/main/api_exec_es1.c \
-	$(SRCDIR)/main/api_exec_es2.c
+	$(BUILDDIR)/main/api_exec_es1.c \
+	$(BUILDDIR)/main/api_exec_es2.c
 
 MAIN_FILES = \
 	$(SRCDIR)/main/api_arrayelt.c \
@@ -34,7 +35,6 @@ MAIN_FILES = \
 	$(SRCDIR)/main/drawpix.c \
 	$(SRCDIR)/main/drawtex.c \
 	$(SRCDIR)/main/enable.c \
-	$(SRCDIR)/main/enums.c \
 	$(SRCDIR)/main/errors.c \
 	$(SRCDIR)/main/eval.c \
 	$(SRCDIR)/main/execmem.c \
@@ -105,6 +105,7 @@ MAIN_FILES = \
 	$(SRCDIR)/main/version.c \
 	$(SRCDIR)/main/viewport.c \
 	$(SRCDIR)/main/vtxfmt.c \
+	$(BUILDDIR)/main/enums.c \
 	$(MAIN_ES_FILES)
 
 MAIN_CXX_FILES = \
@@ -249,11 +250,9 @@ STATETRACKER_FILES = \
 PROGRAM_FILES = \
 	$(SRCDIR)/program/arbprogparse.c \
 	$(SRCDIR)/program/hash_table.c \
-	$(SRCDIR)/program/lex.yy.c \
 	$(SRCDIR)/program/nvfragparse.c \
 	$(SRCDIR)/program/nvvertparse.c \
 	$(SRCDIR)/program/program.c \
-	$(SRCDIR)/program/program_parse.tab.c \
 	$(SRCDIR)/program/program_parse_extra.c \
 	$(SRCDIR)/program/prog_cache.c \
 	$(SRCDIR)/program/prog_execute.c \
@@ -267,7 +266,9 @@ PROGRAM_FILES = \
 	$(SRCDIR)/program/prog_statevars.c \
 	$(SRCDIR)/program/programopt.c \
 	$(SRCDIR)/program/register_allocate.c \
-	$(SRCDIR)/program/symbol_table.c
+	$(SRCDIR)/program/symbol_table.c \
+	$(BUILDDIR)/program/lex.yy.c \
+	$(BUILDDIR)/program/program_parse.tab.c
 
 
 SHADER_CXX_FILES = \
@@ -373,15 +374,20 @@ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_FILES:.c=.o)
 ### Other archives/libraries
 
 GLSL_LIBS = \
-	$(TOP)/src/glsl/libglsl.a
+	$(top_builddir)/src/glsl/libglsl.a
 
 
 ### Include directories
 
 INCLUDE_DIRS = \
-	-I$(TOP)/include \
-	-I$(TOP)/src/glsl \
-	-I$(TOP)/src/mesa \
-	-I$(TOP)/src/mapi \
-	-I$(TOP)/src/gallium/include \
-	-I$(TOP)/src/gallium/auxiliary
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/src/glsl \
+        -I$(top_builddir)/src/glsl \
+	-I$(top_srcdir)/src/mesa \
+        -I$(top_builddir)/src/mesa \
+	-I$(top_srcdir)/src/mesa/main \
+	-I$(top_builddir)/src/mesa/main \
+	-I$(top_srcdir)/src/mapi \
+	-I$(top_builddir)/src/mapi \
+	-I$(top_srcdir)/src/gallium/include \
+	-I$(top_srcdir)/src/gallium/auxiliary
-- 
1.7.10.4



More information about the mesa-dev mailing list