[Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

Matt Turner mattst88 at gmail.com
Tue Nov 5 10:28:03 PST 2013


On Sat, Nov 2, 2013 at 12:00 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Rip out the source file list from mesa/Makefile.sources, to a
> more sensible location/file.
> * Split PROGRAM_FILES and GENERATED_FILES.
> * Update the automake and Android build systems.
>
> Android
> * Slightly reshuffle the Android.mk for readability sake.
> * Use GENERATED_FILES, drop the TODO item.
> * Use explicit 'call' when executing local macros.
>
> Cc: Chad Versace <chad.versace at linux.intel.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>
> Andoid changes are _not_ tested (yet).
>
> ---
>  src/mesa/Makefile.sources         | 24 ---------------
>  src/mesa/program/Android.mk       | 65 ++++++++++++++++-----------------------
>  src/mesa/program/Makefile.am      | 25 +++++++++------
>  src/mesa/program/Makefile.sources | 27 ++++++++++++++++
>  4 files changed, 69 insertions(+), 72 deletions(-)
>  create mode 100644 src/mesa/program/Makefile.sources
>
> diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
> index a84f8a7..e4146ae 100644
> --- a/src/mesa/Makefile.sources
> +++ b/src/mesa/Makefile.sources
> @@ -252,30 +252,6 @@ STATETRACKER_FILES = \
>         $(SRCDIR)state_tracker/st_texture.c \
>         $(SRCDIR)state_tracker/st_vdpau.c
>
> -PROGRAM_FILES = \
> -       $(SRCDIR)program/arbprogparse.c \
> -       $(SRCDIR)program/prog_hash_table.c \
> -       $(SRCDIR)program/ir_to_mesa.cpp \
> -       $(SRCDIR)program/program.c \
> -       $(SRCDIR)program/program_parse_extra.c \
> -       $(SRCDIR)program/prog_cache.c \
> -       $(SRCDIR)program/prog_execute.c \
> -       $(SRCDIR)program/prog_instruction.c \
> -       $(SRCDIR)program/prog_noise.c \
> -       $(SRCDIR)program/prog_optimize.c \
> -       $(SRCDIR)program/prog_opt_constant_fold.c \
> -       $(SRCDIR)program/prog_parameter.c \
> -       $(SRCDIR)program/prog_parameter_layout.c \
> -       $(SRCDIR)program/prog_print.c \
> -       $(SRCDIR)program/prog_statevars.c \
> -       $(SRCDIR)program/programopt.c \
> -       $(SRCDIR)program/register_allocate.c \
> -       $(SRCDIR)program/sampler.cpp \
> -       $(SRCDIR)program/string_to_uint_map.cpp \
> -       $(SRCDIR)program/symbol_table.c \
> -       $(BUILDDIR)program/lex.yy.c \
> -       $(BUILDDIR)program/program_parse.tab.c
> -
>  ASM_C_FILES =  \
>         $(SRCDIR)x86/common_x86.c \
>         $(SRCDIR)x86/x86_xform.c \
> diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
> index e85afe6..e340ed4 100644
> --- a/src/mesa/program/Android.mk
> +++ b/src/mesa/program/Android.mk
> @@ -18,8 +18,30 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>  # DEALINGS IN THE SOFTWARE.
>
> +# ----------------------------------------------------------------------
> +# libmesa_program.a
> +# ----------------------------------------------------------------------
>  LOCAL_PATH := $(call my-dir)
>
> +# get PROGRAM_FILES and GENERATED_FILES
> +include $(LOCAL_PATH)/Makefile.sources
> +include $(CLEAR_VARS)
> +
> +LOCAL_MODULE := libmesa_program
> +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
> +
> +intermediates := $(call local-intermediates-dir)
> +
> +LOCAL_C_INCLUDES := \
> +       $(intermediates) \
> +       $(MESA_TOP)/src/mapi \
> +       $(MESA_TOP)/src/mesa \
> +       $(MESA_TOP)/src/glsl
> +
> +
> +LOCAL_SRC_FILES := $(PROGRAM_FILES)
> +LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(GENERATED_FILES))
> +
>  define local-l-to-c
>         @mkdir -p $(dir $@)
>         @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
> @@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
>         $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
>  endef
>
> -# ----------------------------------------------------------------------
> -# libmesa_program.a
> -# ----------------------------------------------------------------------
> -
> -# Import the following variables:
> -#     PROGRAM_FILES
> -include $(MESA_TOP)/src/mesa/Makefile.sources
> -
> -include $(CLEAR_VARS)
> -
> -LOCAL_MODULE := libmesa_program
> -LOCAL_MODULE_CLASS := STATIC_LIBRARIES
> -
> -intermediates := $(call local-intermediates-dir)
> +$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
> +       $(call local-l-to-c)
>
> -# TODO(chadv): In Makefile.sources, 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
> +$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
> +       $(call mesa_local-y-to-c-and-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: $(intermediates)/program/program_parse.tab.c
> +$(intermediates)/program_parse.tab.h: $(intermediates)/program_parse.tab.c
>         @
>
> -$(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
> -       $(local-l-to-c)
> -
> -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
> index 5e05782..3b560bd 100644
> --- a/src/mesa/program/Makefile.am
> +++ b/src/mesa/program/Makefile.am
> @@ -19,18 +19,26 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>  # IN THE SOFTWARE.
>
> -include ../Makefile.sources
> +include Makefile.sources
> +
> +AM_CPPFLAGS = \
> +       -I$(top_srcdir)/include \
> +       -I$(top_builddir)/src/mapi \
> +       -I$(top_srcdir)/src/mapi \
> +       -I$(top_builddir)/src/mesa \
> +       -I$(top_srcdir)/src/mesa \
> +       -I$(top_builddir)/src/glsl \
> +       -I$(top_srcdir)/src/glsl \
> +       $(DEFINES)
>
> -AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
>  AM_CFLAGS = $(VISIBILITY_CFLAGS)
>  AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
>
> -SRCDIR = $(top_srcdir)/src/mesa/
> -BUILDDIR = $(top_builddir)/src/mesa/
> -
>  noinst_LTLIBRARIES = libprogram.la
>
> -libprogram_la_SOURCES = $(PROGRAM_FILES)
> +libprogram_la_SOURCES = \
> +       $(PROGRAM_FILES) \
> +       $(GENERATED_FILES)
>
>  lex.yy.c: program_lexer.l
>         $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
> @@ -38,8 +46,5 @@ lex.yy.c: program_lexer.l
>  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
> +BUILT_SOURCES = $(GENERATED_FILES)
>  CLEANFILES = $(BUILT_SOURCES)
> diff --git a/src/mesa/program/Makefile.sources b/src/mesa/program/Makefile.sources
> new file mode 100644
> index 0000000..8b2dee5
> --- /dev/null
> +++ b/src/mesa/program/Makefile.sources
> @@ -0,0 +1,27 @@
> +PROGRAM_FILES := \
> +       arbprogparse.c \
> +       ir_to_mesa.cpp \
> +       prog_cache.c \
> +       prog_execute.c \
> +       prog_hash_table.c \
> +       prog_instruction.c \
> +       prog_noise.c \
> +       prog_opt_constant_fold.c \
> +       prog_optimize.c \
> +       prog_parameter.c \
> +       prog_parameter_layout.c \
> +       prog_print.c \
> +       program.c \
> +       program_parse_extra.c \
> +       programopt.c \
> +       prog_statevars.c \
> +       register_allocate.c \
> +       sampler.cpp \
> +       string_to_uint_map.cpp \
> +       symbol_table.c
> +
> +
> +GENERATED_FILES := \
> +       lex.yy.c \
> +       program_parse.tab.c \
> +       program_parse.tab.h
> --
> 1.8.4.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

I don't think there's any need for this.

I've actually sent a patch that just builds the sources in program/
into libmesa directly, avoiding the extra recursion and intermediate
link.

I'd drop this patch.


More information about the mesa-dev mailing list