summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-11-07 16:33:39 -0800
committerChad Versace <chad.versace@linux.intel.com>2012-11-12 15:52:42 -0800
commit907844107252260c646aca361191ef7f121f3d23 (patch)
treecf9a5a54b804e852344541a096992943687e2a6a
parent0ef85357479a47c2bdd05df3b2183bc7bfa0ac6e (diff)
automake,android: Build program/ into a helper lib (v2)
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/. v2: [chadv] Add changes to Android makefiles. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1) Signed-off-by: Chad Versace <chad.versace@linux.intel.com> (v2)
-rw-r--r--configure.ac1
-rw-r--r--src/mesa/Android.gen.mk21
-rw-r--r--src/mesa/Android.libmesa_dricore.mk4
-rw-r--r--src/mesa/Android.libmesa_st_mesa.mk4
-rw-r--r--src/mesa/Android.mk2
-rw-r--r--src/mesa/Makefile.am26
-rw-r--r--src/mesa/libdricore/Makefile.am4
-rw-r--r--src/mesa/program/.gitignore1
-rw-r--r--src/mesa/program/Android.mk84
-rw-r--r--src/mesa/program/Makefile.am57
-rw-r--r--src/mesa/sources.mak2
11 files changed, 167 insertions, 39 deletions
diff --git a/configure.ac b/configure.ac
index 6a7521fa3e..558c4aa65b 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/Android.gen.mk b/src/mesa/Android.gen.mk
index ce6d65bbde..5f0d73cffd 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -32,9 +32,6 @@ intermediates := $(call local-intermediates-dir)
# This is the list of auto-generated files: sources and headers
sources := \
main/enums.c \
- main/api_exec.c \
- program/program_parse.tab.c \
- program/lex.yy.c \
main/dispatch.h \
main/remap_helper.h \
main/get_hash.h
@@ -62,30 +59,12 @@ dispatch_deps := \
$(wildcard $(glapi)/*.py) \
$(wildcard $(glapi)/*.xml)
-define local-l-to-c
- @mkdir -p $(dir $@)
- @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
- $(hide) $(LEX) -o$@ $<
-endef
-
-define mesa_local-y-to-c-and-h
- @mkdir -p $(dir $@)
- @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
- $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
-endef
-
define es-gen
@mkdir -p $(dir $@)
@echo "Gen ES: $(PRIVATE_MODULE) <= $(notdir $(@))"
$(hide) $(PRIVATE_SCRIPT) $(1) $(PRIVATE_XML) > $@
endef
-$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program/program_parse.y
- $(mesa_local-y-to-c-and-h)
-
-$(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program/program_lexer.l
- $(local-l-to-c)
-
$(intermediates)/main/git_sha1.h:
@mkdir -p $(dir $@)
@echo "GIT-SHA1: $(PRIVATE_MODULE) <= git"
diff --git a/src/mesa/Android.libmesa_dricore.mk b/src/mesa/Android.libmesa_dricore.mk
index 48a37a1973..093d7a1894 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -53,9 +53,13 @@ LOCAL_CFLAGS := \
$(patsubst %,-DFEATURE_%=1,$(MESA_ENABLED_APIS))
LOCAL_C_INCLUDES := \
+ $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/glsl
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+ libmesa_program
+
include $(LOCAL_PATH)/Android.gen.mk
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/src/mesa/Android.libmesa_st_mesa.mk b/src/mesa/Android.libmesa_st_mesa.mk
index a0621e3523..79914caf17 100644
--- a/src/mesa/Android.libmesa_st_mesa.mk
+++ b/src/mesa/Android.libmesa_st_mesa.mk
@@ -49,11 +49,15 @@ endif # x86
endif # MESA_ENABLE_ASM
LOCAL_C_INCLUDES := \
+ $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
$(MESA_TOP)/src/gallium/auxiliary \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/glsl \
$(MESA_TOP)/src/mapi
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+ libmesa_program
+
include $(LOCAL_PATH)/Android.gen.mk
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index 01055cc18e..20f781948b 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -24,3 +24,5 @@ include $(LOCAL_PATH)/Android.mesa_gen_matypes.mk
include $(LOCAL_PATH)/Android.libmesa_glsl_utils.mk
include $(LOCAL_PATH)/Android.libmesa_dricore.mk
include $(LOCAL_PATH)/Android.libmesa_st_mesa.mk
+
+include $(LOCAL_PATH)/program/Android.mk
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 34e8c82fdb..9809ee437c 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 6958e327a3..21454aad72 100644
--- a/src/mesa/libdricore/Makefile.am
+++ b/src/mesa/libdricore/Makefile.am
@@ -41,7 +41,9 @@ libdricore@VERSION@_la_SOURCES = \
$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
$(top_builddir)/src/glsl/builtin_function.cpp
libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
-libdricore@VERSION@_la_LIBADD = libdricore-asm.la
+libdricore@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 4c20872e14..bc48ef673e 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/Android.mk b/src/mesa/program/Android.mk
new file mode 100644
index 0000000000..5eb0439552
--- /dev/null
+++ b/src/mesa/program/Android.mk
@@ -0,0 +1,84 @@
+# 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 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.
+
+LOCAL_PATH := $(call my-dir)
+
+define local-l-to-c
+ @mkdir -p $(dir $@)
+ @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
+ $(hide) $(LEX) -o$@ $<
+endef
+
+define mesa_local-y-to-c-and-h
+ @mkdir -p $(dir $@)
+ @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
+ $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
+endef
+
+# ----------------------------------------------------------------------
+# libmesa_program.a
+# ----------------------------------------------------------------------
+
+# Import the following variables:
+# PROGRAM_FILES
+include $(MESA_TOP)/src/mesa/sources.mak
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_program
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+intermediates := $(call local-intermediates-dir)
+
+MESA_ENABLED_APIS := ES1 ES2
+
+# TODO(chadv): In sources.mak, move these vars to a different list so we can
+# remove this kludge.
+generated_sources_basenames := \
+ lex.yy.c \
+ program_parse.tab.c \
+ program_parse.tab.h
+
+LOCAL_SRC_FILES := \
+ $(filter-out $(generated_sources_basenames),$(subst program/,,$(PROGRAM_FILES)))
+
+LOCAL_GENERATED_SOURCES := \
+ $(addprefix $(intermediates)/program/,$(generated_sources_basenames))
+
+$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
+ $(mesa_local-y-to-c-and-h)
+
+$(intermediates)/program/program_parse.tab.h: $(LOCAL_PATH)/program_parse.y
+ $(mesa_local-y-to-c-and-h)
+
+$(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
+ $(local-l-to-c)
+
+LOCAL_CFLAGS := \
+ $(patsubst %,-DFEATURE_%=1,$(MESA_ENABLED_APIS))
+
+LOCAL_C_INCLUDES := \
+ $(intermediates) \
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/mesa \
+ $(MESA_TOP)/src/glsl
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/mesa/program/Makefile.am b/src/mesa/program/Makefile.am
new file mode 100644
index 0000000000..db6616c7e3
--- /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 07076c60a5..93d466b440 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