[Mesa-dev] [PATCH v2 13/23] mesa: Autogenerate most of format_pack.c

Emil Velikov emil.l.velikov at gmail.com
Wed Dec 3 03:30:12 PST 2014


Hi Iago,

On 01/12/14 11:04, Iago Toral Quiroga wrote:
> From: Jason Ekstrand <jason.ekstrand at intel.com>
> 
> We were auto-generating it before.  The problem was that the autogeneration
> tool we were using was called "copy, paste, and edit".  Let's use a more
> sensible solution.
> 
> Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> 
> v2 by Samuel Iglesias <siglesias at igalia.com>
> - Remove format_pack.c as it is now autogenerated
> - Add usage of INDENT_FLAGS in Makefile.am
> - Remove trailing blank line
> 
> v3 by Samuel Iglesias <siglesias at igalia.com>
> - Merge format_convert.py into format_parser.py
>    - Adapt pack_*_* function generations
> - Fix out-of-tree build
> 
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
>  src/mesa/Makefile.am             |   14 +
>  src/mesa/Makefile.sources        |    2 +-
>  src/mesa/main/format_pack.c      | 2982 --------------------------------------
>  src/mesa/main/format_pack.c.mako |  897 ++++++++++++
>  src/mesa/main/format_parser.py   |   71 +
>  src/mesa/main/run_mako.py        |    7 +
>  6 files changed, 990 insertions(+), 2983 deletions(-)
>  delete mode 100644 src/mesa/main/format_pack.c
>  create mode 100644 src/mesa/main/format_pack.c.mako
>  create mode 100644 src/mesa/main/run_mako.py
> 
> diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
> index 932db4f..849c9da 100644
> --- a/src/mesa/Makefile.am
> +++ b/src/mesa/Makefile.am
> @@ -19,6 +19,8 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>  # IN THE SOFTWARE.
>  
> +BUILDDIR_ABSOLUTE_PATH = $(PWD)
> +
You should not need this new variable. Additionally I'm suspecting this
is the reason between the build hickups you/Jason are seeing.

>  SUBDIRS = . main/tests
>  
>  if HAVE_X11_DRIVER
> @@ -66,6 +68,7 @@ BUILT_SOURCES = \
>  	main/get_hash.h \
>          main/format_info.c \
>  	$(BUILDDIR)main/git_sha1.h \
> +	$(BUILDDIR)main/format_pack.c \
>  	$(BUILDDIR)program/program_parse.tab.c \
>  	$(BUILDDIR)program/lex.yy.c
>  CLEANFILES = \
> @@ -89,6 +92,17 @@ main/format_info.c: main/formats.csv                                    \
>                     $< > $@.tmp;                                         \
>  	mv $@.tmp $@;
>  
> +$(BUILDDIR)main/format_pack.c: main/format_pack.c.mako main/formats.csv \
> +                               main/run_mako.py main/format_parser.py
> +	$(AM_V_GEN)set -e;						\
> +	cd $(srcdir);							\
> +	$(PYTHON2) $(PYTHON_FLAGS) main/run_mako.py			\
> +                   main/format_pack.c.mako main/formats.csv >		\
> +			$(BUILDDIR_ABSOLUTE_PATH)/$@.tmp;		\
> +	cd $(BUILDDIR_ABSOLUTE_PATH);					\
> +	cat $@.tmp | $(INDENT) $(INDENT_FLAGS) > $@;                    \
> +        rm $@.tmp;
> +
Can you prefix the files in the srcdir, and drop the tmp file (pipe
directly into indent). It will make the above ~1/2 the size and a bit
easier to follow :)

>  main/formats.c: main/format_info.c
>  
>  noinst_LTLIBRARIES = $(ARCH_LIBS)
[...]
> diff --git a/src/mesa/main/run_mako.py b/src/mesa/main/run_mako.py
> new file mode 100644
> index 0000000..8d1e945
> --- /dev/null
> +++ b/src/mesa/main/run_mako.py
Do we need this file, or we can fold it in format_parser.py ?

> @@ -0,0 +1,7 @@
> +#! /usr/bin/env python
Gracious space space between ! and /

Thanks
-Emil



More information about the mesa-dev mailing list