[Mesa-dev] [PATCH 6/9] automake: Build program/ into a helper lib.

Eric Anholt eric at anholt.net
Tue Nov 6 23:18:39 PST 2012


While simplifying mesa/Makefile.am, the more important feature of this commit
is allowing a file with the same name to appear in both main/ and program/.
---

This only does one of the subdirectories, one of the two I had to
change to make main/hash_table.c possible.  If people are OK with this
general plan, it won't be hard to translate to the other subdirs, and
I think may make for a more intelligible build system long term.  (big
Makefiles can be hard to read)


 configure.ac                    |    1 +
 src/mesa/Makefile.am            |   26 ++++++++----------
 src/mesa/libdricore/Makefile.am |    4 ++-
 src/mesa/program/.gitignore     |    1 +
 src/mesa/program/Makefile.am    |   57 +++++++++++++++++++++++++++++++++++++++
 src/mesa/sources.mak            |    2 --
 6 files changed, 73 insertions(+), 18 deletions(-)
 create mode 100644 src/mesa/program/Makefile.am

diff --git a/configure.ac b/configure.ac
index 9a3fde1..1a8faad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2013,6 +2013,7 @@ AC_CONFIG_FILES([configs/current
 		src/mesa/drivers/x11/Makefile
 		src/mesa/libdricore/Makefile
 		src/mesa/main/tests/Makefile
+		src/mesa/program/Makefile
 		src/mesa/x86-64/Makefile
 		src/mesa/x86/Makefile])
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 34e8c82..9809ee4 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -23,7 +23,7 @@ if NEED_LIBDRICORE
 DRICORE_SUBDIR = libdricore
 endif
 
-SUBDIRS = x86 x86-64 . $(DRICORE_SUBDIR) drivers
+SUBDIRS = program x86 x86-64 . $(DRICORE_SUBDIR) drivers
 
 gldir = $(includedir)/GL
 gl_HEADERS = $(top_srcdir)/include/GL/*.h
@@ -53,22 +53,11 @@ include $(GLAPI)/glapi_gen.mk
 
 BUILT_SOURCES = \
 	main/git_sha1.h \
-	main/get_hash.h \
-	program/program_parse.tab.c \
-	program/program_parse.tab.h \
-	program/lex.yy.c
+	main/get_hash.h
 CLEANFILES = \
 	$(BUILT_SOURCES) \
 	git_sha1.h.tmp
 
-program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
-	$(MKDIR_P) program
-	$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $<
-
-program/lex.yy.c: program/program_lexer.l
-	$(MKDIR_P) program
-	$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
-
 GET_HASH_GEN = main/get_hash_generator.py
 GET_HASH_GEN_FLAGS := $(patsubst -DFEATURE_%=1,-a %, \
 			$(patsubst -DFEATURE_%=0,,$(API_DEFINES)))
@@ -124,14 +113,21 @@ libmesa_la_SOURCES = \
 	$(MESA_FILES) \
         $(MESA_ASM_FILES_FOR_ARCH)
 
-libmesa_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
+libmesa_la_LIBADD = \
+        $(top_builddir)/src/glsl/libglsl.la \
+        $(top_builddir)/src/mesa/program/libprogram.la \
+        $()
 libmesa_la_LDFLAGS =
 
 libmesagallium_la_SOURCES = \
 	$(MESA_GALLIUM_FILES) \
         $(MESA_ASM_FILES_FOR_ARCH)
 
-libmesagallium_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
+libmesagallium_la_LIBADD = \
+        $(top_builddir)/src/glsl/libglsl.la \
+        $(top_builddir)/src/mesa/program/libprogram.la \
+        $()
+
 libmesagallium_la_LDFLAGS =
 
 if HAVE_GALLIUM
diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
index 6958e32..21454aa 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -41,7 +41,9 @@ libdricore at VERSION@_la_SOURCES = \
 	$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
 	$(top_builddir)/src/glsl/builtin_function.cpp
 libdricore at VERSION@_la_LDFLAGS = -version-number 1:0
-libdricore at VERSION@_la_LIBADD = libdricore-asm.la
+libdricore at VERSION@_la_LIBADD = \
+        ../program/libdricore_program.la \
+        libdricore-asm.la
 
 # This is separated from libdricore to avoid conflics in object
 # outputs between main/clip.c and sparc/clip.c.  The documented way to
diff --git a/src/mesa/program/.gitignore b/src/mesa/program/.gitignore
index 4c20872..bc48ef6 100644
--- a/src/mesa/program/.gitignore
+++ b/src/mesa/program/.gitignore
@@ -1,3 +1,4 @@
+/Makefile
 program_parse.output
 lex.yy.c
 program_parse.tab.c
diff --git a/src/mesa/program/Makefile.am b/src/mesa/program/Makefile.am
new file mode 100644
index 0000000..db6616c
--- /dev/null
+++ b/src/mesa/program/Makefile.am
@@ -0,0 +1,57 @@
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+include ../sources.mak
+
+AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
+AM_CFLAGS = $(VISIBILITY_CFLAGS)
+AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+libdricore_program_la_CFLAGS = $(NOVISIBILITY_CFLAGS)
+libdricore_program_la_CXXFLAGS = $(NOVISIBILITY_CXXFLAGS)
+
+SRCDIR = $(top_srcdir)/src/mesa/
+BUILDDIR = $(top_builddir)/src/mesa/
+
+if NEED_LIBDRICORE
+DRICORE_LIB = libdricore_program.la
+endif
+
+noinst_LTLIBRARIES = $(DRICORE_LIB)
+if NEED_LIBMESA
+noinst_LTLIBRARIES += libprogram.la
+else
+check_LTLIBRARIES = libprogram.la
+endif
+
+libprogram_la_SOURCES = $(PROGRAM_FILES)
+libdricore_program_la_SOURCES = $(PROGRAM_FILES)
+
+lex.yy.c: program_lexer.l
+	$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
+
+program_parse.tab.c program_parse.tab.h: program_parse.y
+	$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program_parse.tab.c $<
+
+BUILT_SOURCES = \
+	program_parse.tab.c \
+	program_parse.tab.h \
+	lex.yy.c
+CLEANFILES = $(BUILT_SOURCES)
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index f6976a9..ffd9db2 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -316,7 +316,6 @@ MESA_FILES = \
 	$(MATH_XFORM_FILES)	\
 	$(VBO_FILES)		\
 	$(TNL_FILES)		\
-	$(PROGRAM_FILES)	\
 	$(SWRAST_FILES)	\
 	$(SWRAST_SETUP_FILES)	\
 	$(COMMON_DRIVER_FILES)\
@@ -328,7 +327,6 @@ MESA_GALLIUM_FILES = \
 	$(MATH_FILES)		\
 	$(VBO_FILES)		\
 	$(STATETRACKER_FILES)	\
-	$(PROGRAM_FILES)	\
 	$(SRCDIR)x86/common_x86.c
 
 # All the core C sources, for dependency checking
-- 
1.7.10.4



More information about the mesa-dev mailing list