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)
This commit is contained in:
Eric Anholt
2012-11-07 16:33:39 -08:00
committed by Chad Versace
parent 0ef8535747
commit 9078441072
11 changed files with 167 additions and 39 deletions

View File

@@ -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])

View File

@@ -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"

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +1,4 @@
/Makefile
program_parse.output
lex.yy.c
program_parse.tab.c

View File

@@ -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)

View File

@@ -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)

View File

@@ -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