[Mesa-dev] [PATCH] genxml: avoid using a GNU make pattern rule

2016-10-15 Thread Jonathan Gray
% pattern rules are a GNU extension.  Convert the use of one to a
inference rule to allow this to build on OpenBSD.

This is a related change to the one made in
e3d43dc5eae5271e2c87bab702aa7409d3dd0b23

Signed-off-by: Jonathan Gray 
---
 src/intel/Makefile.genxml.am | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/intel/Makefile.genxml.am b/src/intel/Makefile.genxml.am
index 519f30e..39f579c 100644
--- a/src/intel/Makefile.genxml.am
+++ b/src/intel/Makefile.genxml.am
@@ -34,7 +34,10 @@ $(GENXML_GENERATED_FILES): genxml/gen_pack_header.py
 # xxd generates variable names based on the path of the input file. We
 # prefer to generate our own name here, so it doesn't vary from
 # in/out-of-tree builds.
-%_xml.h:  %.xml Makefile
+
+$(GENXML_GENERATED_FILES): Makefile
+
+.xml_xml.h:
$(MKDIR_GEN)
$(AM_V_GEN) echo -n "static const uint8_t " > $@; \
echo "$(@F)_xml[] = {" | sed -e 's,_xml.h,,' >> $@; \
-- 
2.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] genxml: avoid using a GNU make pattern rule

2016-05-10 Thread Jason Ekstrand
On Mon, May 2, 2016 at 5:25 PM, Jonathan Gray  wrote:

> On Mon, May 02, 2016 at 11:44:35AM -0700, Jason Ekstrand wrote:
> > On Mon, May 2, 2016 at 2:27 AM, Jonathan Gray  wrote:
> >
> > > On Mon, May 02, 2016 at 02:23:46AM -0700, Jason Ekstrand wrote:
> > > > On May 1, 2016 11:24 PM, "Jonathan Gray"  wrote:
> > > > >
> > > > > % pattern rules are a GNU extension.  Convert the use of one to a
> > > > > suffix rule to allow this to build on OpenBSD.
> > > > >
> > > > > Signed-off-by: Jonathan Gray 
> > > > > ---
> > > > >  src/intel/genxml/Makefile.am | 4 +++-
> > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/src/intel/genxml/Makefile.am
> > > b/src/intel/genxml/Makefile.am
> > > > > index f493d48..ea68fb9 100644
> > > > > --- a/src/intel/genxml/Makefile.am
> > > > > +++ b/src/intel/genxml/Makefile.am
> > > > > @@ -28,7 +28,9 @@ BUILT_SOURCES =
> > > >  \
> > > > >
> > > > >  PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
> > > > >
> > > > > -%_pack.h : %.xml gen_pack_header.py
> > > > > +SUFFIXES = _pack.h .xml
> > > > > +
> > > > > +.xml_pack.h : gen_pack_header.py
> > > > > $(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@
> > > >
> > > > We'd better also fix up all the places we include these files. :-)
> > >
> > > The generated filenames don't change, there is no need to:
> > >
> >
> > I just read up on Suffix rules (didn't even know they existed).  I think
> > what you're doing there *mostly* works.  The problem is that, according
> to
> > the GNU make docs (
> > https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html),
> > suffix rules aren't allowed to have any additional prerequisites
> declared.
> > If they do, they get treated as normal non-suffix rules.  How do we do
> this
> > as a suffix rule *and* have it depend on both genN.xml and
> > gen_pack_header.py?
> > --jason
>
> The docs on OpenBSD suggest adding another target rule for this case
> which seems to work as intended here.
>
> see "INFERENCE RULES" in
> http://man.openbsd.org/OpenBSD-current/man1/make.1
>
> commit 715e29f2a1db62f69a92e742cd33fc75889367ff
> Author: Jonathan Gray 
> Date:   Mon May 2 16:14:56 2016 +1000
>
> genxml: avoid using a GNU make pattern rule
>
> % pattern rules are a GNU extension.  Convert the use of one to a
> inference rule to allow this to build on OpenBSD.
>
> v2: inference rules can't have additional prerequisites
> so add a target rule to still depend on gen_pack_header.py
>
> Signed-off-by: Jonathan Gray 
>

Sorry it's taken so long but I just applied this, verified that it still
works with GNU make, added my R-B and pushed it to master.  Thanks!


>
> diff --git a/src/intel/genxml/Makefile.am b/src/intel/genxml/Makefile.am
> index f493d48..0b5b3a6 100644
> --- a/src/intel/genxml/Makefile.am
> +++ b/src/intel/genxml/Makefile.am
> @@ -28,7 +28,11 @@ BUILT_SOURCES =
>  \
>
>  PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
>
> -%_pack.h : %.xml gen_pack_header.py
> +SUFFIXES = _pack.h .xml
> +
> +$(BUILT_SOURCES): gen_pack_header.py
> +
> +.xml_pack.h:
> $(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@
>
>  CLEANFILES = $(BUILT_SOURCES)
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] genxml: avoid using a GNU make pattern rule

2016-05-02 Thread Jonathan Gray
On Mon, May 02, 2016 at 11:44:35AM -0700, Jason Ekstrand wrote:
> On Mon, May 2, 2016 at 2:27 AM, Jonathan Gray  wrote:
> 
> > On Mon, May 02, 2016 at 02:23:46AM -0700, Jason Ekstrand wrote:
> > > On May 1, 2016 11:24 PM, "Jonathan Gray"  wrote:
> > > >
> > > > % pattern rules are a GNU extension.  Convert the use of one to a
> > > > suffix rule to allow this to build on OpenBSD.
> > > >
> > > > Signed-off-by: Jonathan Gray 
> > > > ---
> > > >  src/intel/genxml/Makefile.am | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/src/intel/genxml/Makefile.am
> > b/src/intel/genxml/Makefile.am
> > > > index f493d48..ea68fb9 100644
> > > > --- a/src/intel/genxml/Makefile.am
> > > > +++ b/src/intel/genxml/Makefile.am
> > > > @@ -28,7 +28,9 @@ BUILT_SOURCES =
> > >  \
> > > >
> > > >  PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
> > > >
> > > > -%_pack.h : %.xml gen_pack_header.py
> > > > +SUFFIXES = _pack.h .xml
> > > > +
> > > > +.xml_pack.h : gen_pack_header.py
> > > > $(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@
> > >
> > > We'd better also fix up all the places we include these files. :-)
> >
> > The generated filenames don't change, there is no need to:
> >
> 
> I just read up on Suffix rules (didn't even know they existed).  I think
> what you're doing there *mostly* works.  The problem is that, according to
> the GNU make docs (
> https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html),
> suffix rules aren't allowed to have any additional prerequisites declared.
> If they do, they get treated as normal non-suffix rules.  How do we do this
> as a suffix rule *and* have it depend on both genN.xml and
> gen_pack_header.py?
> --jason

The docs on OpenBSD suggest adding another target rule for this case
which seems to work as intended here.

see "INFERENCE RULES" in
http://man.openbsd.org/OpenBSD-current/man1/make.1

commit 715e29f2a1db62f69a92e742cd33fc75889367ff
Author: Jonathan Gray 
Date:   Mon May 2 16:14:56 2016 +1000

genxml: avoid using a GNU make pattern rule

% pattern rules are a GNU extension.  Convert the use of one to a
inference rule to allow this to build on OpenBSD.

v2: inference rules can't have additional prerequisites
so add a target rule to still depend on gen_pack_header.py

Signed-off-by: Jonathan Gray 

diff --git a/src/intel/genxml/Makefile.am b/src/intel/genxml/Makefile.am
index f493d48..0b5b3a6 100644
--- a/src/intel/genxml/Makefile.am
+++ b/src/intel/genxml/Makefile.am
@@ -28,7 +28,11 @@ BUILT_SOURCES = \
 
 PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
 
-%_pack.h : %.xml gen_pack_header.py
+SUFFIXES = _pack.h .xml
+
+$(BUILT_SOURCES): gen_pack_header.py
+
+.xml_pack.h:
$(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@
 
 CLEANFILES = $(BUILT_SOURCES)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] genxml: avoid using a GNU make pattern rule

2016-05-02 Thread Jason Ekstrand
On Mon, May 2, 2016 at 2:27 AM, Jonathan Gray  wrote:

> On Mon, May 02, 2016 at 02:23:46AM -0700, Jason Ekstrand wrote:
> > On May 1, 2016 11:24 PM, "Jonathan Gray"  wrote:
> > >
> > > % pattern rules are a GNU extension.  Convert the use of one to a
> > > suffix rule to allow this to build on OpenBSD.
> > >
> > > Signed-off-by: Jonathan Gray 
> > > ---
> > >  src/intel/genxml/Makefile.am | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/src/intel/genxml/Makefile.am
> b/src/intel/genxml/Makefile.am
> > > index f493d48..ea68fb9 100644
> > > --- a/src/intel/genxml/Makefile.am
> > > +++ b/src/intel/genxml/Makefile.am
> > > @@ -28,7 +28,9 @@ BUILT_SOURCES =
> >  \
> > >
> > >  PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
> > >
> > > -%_pack.h : %.xml gen_pack_header.py
> > > +SUFFIXES = _pack.h .xml
> > > +
> > > +.xml_pack.h : gen_pack_header.py
> > > $(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@
> >
> > We'd better also fix up all the places we include these files. :-)
>
> The generated filenames don't change, there is no need to:
>

I just read up on Suffix rules (didn't even know they existed).  I think
what you're doing there *mostly* works.  The problem is that, according to
the GNU make docs (
https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html),
suffix rules aren't allowed to have any additional prerequisites declared.
If they do, they get treated as normal non-suffix rules.  How do we do this
as a suffix rule *and* have it depend on both genN.xml and
gen_pack_header.py?
--jason
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] genxml: avoid using a GNU make pattern rule

2016-05-02 Thread Jonathan Gray
On Mon, May 02, 2016 at 02:23:46AM -0700, Jason Ekstrand wrote:
> On May 1, 2016 11:24 PM, "Jonathan Gray"  wrote:
> >
> > % pattern rules are a GNU extension.  Convert the use of one to a
> > suffix rule to allow this to build on OpenBSD.
> >
> > Signed-off-by: Jonathan Gray 
> > ---
> >  src/intel/genxml/Makefile.am | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/intel/genxml/Makefile.am b/src/intel/genxml/Makefile.am
> > index f493d48..ea68fb9 100644
> > --- a/src/intel/genxml/Makefile.am
> > +++ b/src/intel/genxml/Makefile.am
> > @@ -28,7 +28,9 @@ BUILT_SOURCES =
>  \
> >
> >  PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
> >
> > -%_pack.h : %.xml gen_pack_header.py
> > +SUFFIXES = _pack.h .xml
> > +
> > +.xml_pack.h : gen_pack_header.py
> > $(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@
> 
> We'd better also fix up all the places we include these files. :-)

The generated filenames don't change, there is no need to:

Making all in genxml
python3.4  ./gen_pack_header.py gen6.xml > gen6_pack.h
python3.4  ./gen_pack_header.py gen7.xml > gen7_pack.h
python3.4  ./gen_pack_header.py gen75.xml > gen75_pack.h
python3.4  ./gen_pack_header.py gen8.xml > gen8_pack.h
python3.4  ./gen_pack_header.py gen9.xml > gen9_pack.h
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] genxml: avoid using a GNU make pattern rule

2016-05-02 Thread Jason Ekstrand
On May 1, 2016 11:24 PM, "Jonathan Gray"  wrote:
>
> % pattern rules are a GNU extension.  Convert the use of one to a
> suffix rule to allow this to build on OpenBSD.
>
> Signed-off-by: Jonathan Gray 
> ---
>  src/intel/genxml/Makefile.am | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/genxml/Makefile.am b/src/intel/genxml/Makefile.am
> index f493d48..ea68fb9 100644
> --- a/src/intel/genxml/Makefile.am
> +++ b/src/intel/genxml/Makefile.am
> @@ -28,7 +28,9 @@ BUILT_SOURCES =
 \
>
>  PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
>
> -%_pack.h : %.xml gen_pack_header.py
> +SUFFIXES = _pack.h .xml
> +
> +.xml_pack.h : gen_pack_header.py
> $(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@

We'd better also fix up all the places we include these files. :-)

>
>  CLEANFILES = $(BUILT_SOURCES)
> --
> 2.8.1
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] genxml: avoid using a GNU make pattern rule

2016-05-01 Thread Jonathan Gray
% pattern rules are a GNU extension.  Convert the use of one to a
suffix rule to allow this to build on OpenBSD.

Signed-off-by: Jonathan Gray 
---
 src/intel/genxml/Makefile.am | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intel/genxml/Makefile.am b/src/intel/genxml/Makefile.am
index f493d48..ea68fb9 100644
--- a/src/intel/genxml/Makefile.am
+++ b/src/intel/genxml/Makefile.am
@@ -28,7 +28,9 @@ BUILT_SOURCES = \
 
 PYTHON3_GEN = $(AM_V_GEN)$(PYTHON3) $(PYTHON_FLAGS)
 
-%_pack.h : %.xml gen_pack_header.py
+SUFFIXES = _pack.h .xml
+
+.xml_pack.h : gen_pack_header.py
$(PYTHON3_GEN) $(srcdir)/gen_pack_header.py $< > $@
 
 CLEANFILES = $(BUILT_SOURCES)
-- 
2.8.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev