[bug #51269] Reusing data from targets for prerequisites

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #51269] Reusing data from targets for prerequisites

Robert Morell
URL:
  <http://savannah.gnu.org/bugs/?51269>

                 Summary: Reusing data from targets for prerequisites
                 Project: make
            Submitted by: elfring
            Submitted on: Mon 19 Jun 2017 07:34:22 PM CEST
                Severity: 3 - Normal
              Item Group: Enhancement
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.2.1
        Operating System: Any
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

The make software supports pattern rules
<https://www.gnu.org/software/make/manual/html_node/Pattern-Match.html> for a
while. The percent character must be specified for prerequisites and targets
there which is mapped to a stem then.

Multiple targets
<https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html> can
also be used for a specific make rule. Automatic variables
<https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html>
provide corresponding data.

The documentation contains the following information:
“…
It’s very important that you recognize the limited scope in which automatic
variable values are available: they only have values within the recipe.
…”

How are the chances to adjust this software restriction?

I would appreciate if parts from target names can also be occasionally reused
for prerequisite specifications.
Would it make sense to allow that another special syntax will denote
additional placeholders (similar to the handling of the percent character)?




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51269>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [bug #51269] Reusing data from targets for prerequisites

Edward Welbourne-3
Markus Elfring (19 June 2017 19:34):

> The documentation contains the following information:
> “…
> It’s very important that you recognize the limited scope in which automatic
> variable values are available: they only have values within the recipe.
> …”
>
> How are the chances to adjust this software restriction?
>
> I would appreciate if parts from target names can also be occasionally reused
> for prerequisite specifications.
> Would it make sense to allow that another special syntax will denote
> additional placeholders (similar to the handling of the percent character)?

Take a look at
https://www.gnu.org/software/make/manual/html_node/Static-Usage.html

It may enable what you want already.  Otherwise, give a specific example
of what it is you can't do with the existing syntax.

        Eddy.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [bug #51269] Reusing data from targets for prerequisites

SF Markus Elfring
>> Would it make sense to allow that another special syntax will denote
>> additional placeholders (similar to the handling of the percent character)?
>
> Take a look at
> https://www.gnu.org/software/make/manual/html_node/Static-Usage.html

Thanks for your link.


> It may enable what you want already.

The provided example looks promising.

bigoutput littleoutput : %output : text.g
        generate text.g -$* > $@


I got another software development concern for such an use case.

* Can it eventually happen that dependencies will not be resolved if target names
  do not contain the percent character?

* Should the determination of prefixes and suffixes just work here?

* Can another link help in the section “How patterns match” of the documentation?


> Otherwise, give a specific example of what it is you can't do
> with the existing syntax.

I am also interested in data processing for several fields from targets
(and not only a single “%” as the usual placeholder).
Will it make sense to capture any more data into corresponding variables?

Regards,
Markus

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [bug #51269] Reusing data from targets for prerequisites

Edward Welbourne-3
Markus Elfring (20 June 2017 11:43)
> I got another software development concern for such an use case.
>
> * Can it eventually happen that dependencies will not be resolved if
>   target names do not contain the percent character?

I can't remember, but a simple experiment should answer that !

> * Should the determination of prefixes and suffixes just work here?

Not sure what you mean there, but all the usual automatic variables work
as ever.

> * Can another link help in the section “How patterns match” of the
>   documentation?

Be specific: to which page (give its URL) do you consider adding a link,
to where, using which part of the page's text as anchor.

>> Otherwise, give a specific example of what it is you can't do with
>> the existing syntax.

> I am also interested in data processing for several fields from
> targets (and not only a single “%” as the usual placeholder).  Will it
> make sense to capture any more data into corresponding variables?

There's little point going beyond basic substitution unless we go for
full regex-based matching and replacement,
OBJ = $(SRC:s!(.*)/srcroot/(.*)\.c!$1/buildroot/$2.o!)
or similar, and I doubt make shall aim for that any time soon.

        Eddy.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [bug #51269] Reusing data from targets for prerequisites

SF Markus Elfring
In reply to this post by Edward Welbourne-3
>> Would it make sense to allow that another special syntax will denote
>> additional placeholders (similar to the handling of the percent character)?
>
> Take a look at
> https://www.gnu.org/software/make/manual/html_node/Static-Usage.html
>
> It may enable what you want already.

This functionality fits to my advanced software build needs partly.


I find the section “Static pattern rules versus implicit rules” also interesting
in the documentation.
https://www.gnu.org/software/make/manual/html_node/Static-versus-Implicit.html

But it seems that another important detail is missing in this comparison.

* How do you choose the desired pre-requirements?

* Which file names would you specify for the parameter “prereq-patterns”?

Regards,
Markus

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [bug #51269] Reusing data from targets for prerequisites

SF Markus Elfring
In reply to this post by Edward Welbourne-3
>> * Can it eventually happen that dependencies will not be resolved if
>>   target names do not contain the percent character?
>
> I can't remember, but a simple experiment should answer that !

I guess that it will be noticed once more that implicit rules will work
in an other way than static pattern rules.
Does the support for placeholder syntax differ there just by the software
design which was intended?


>> * Can another link help in the section “How patterns match” of the
>>   documentation?
>
> Be specific: to which page (give its URL) do you consider adding a link,
> to where, using which part of the page's text as anchor.

https://www.gnu.org/software/make/manual/html_node/Pattern-Match.html

Are you interested in a better connection between manual sections?


>> I am also interested in data processing for several fields from
>> targets (and not only a single “%” as the usual placeholder).  Will it
>> make sense to capture any more data into corresponding variables?
>
> There's little point going beyond basic substitution unless we go for
> full regex-based matching and replacement,
> OBJ = $(SRC:s!(.*)/srcroot/(.*)\.c!$1/buildroot/$2.o!)
> or similar, and I doubt make shall aim for that any time soon.

How are the chances to support regular expressions by the make programming
language without invoking external shell commands?

Would you like to use named capturing groups?

Regards,
Markus

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [bug #51269] Reusing data from targets for prerequisites

Paul Smith-20
On Tue, 2017-06-20 at 17:18 +0200, SF Markus Elfring wrote:
> I guess that it will be noticed once more that implicit rules will work
> in an other way than static pattern rules.

It's important to realize that even though the unfortunate choice of
naming implies otherwise, static pattern rules are in all ways
_explicit_ rules.  They are not and should never be considered implicit
rules.

A static pattern rule is merely a shorthand for writing a bunch of
explicit rules.  So this:

  OBJS = foo.o bar.o biz.o baz.o

  $(OBJS): %.o : %.c
          $(CC) $(CFLAGS) -c -o $@ $<

is in every way equivalent (to make) to writing this:

  foo.o : foo.c
          $(CC) $(CFLAGS) -c -o $@ $<
  bar.o : bar.c
          $(CC) $(CFLAGS) -c -o $@ $<
  biz.o : biz.c
          $(CC) $(CFLAGS) -c -o $@ $<
  baz.o : baz.c
          $(CC) $(CFLAGS) -c -o $@ $<


In fact once make has finished parsing the static pattern rule, there is
no difference between them in its internal structures.  You can,
actually, run "make -p" and you will see all the rules broken out rather
than displayed as a static pattern rule.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [bug #51269] Reusing data from targets for prerequisites

SF Markus Elfring
> It's important to realize that even though the unfortunate choice of
> naming implies otherwise, static pattern rules are in all ways
> _explicit_ rules.  They are not and should never be considered
> implicit rules.

Thanks for your explanation.

This terminology can occasionally trigger corresponding understanding difficulties.


> A static pattern rule is merely a shorthand for writing a bunch of
> explicit rules.

I am struggling with advanced usage of placeholder indicators to extract
further data from such targets.


>   OBJS = foo.o bar.o biz.o baz.o
>
>   $(OBJS): %.o : %.c
>           $(CC) $(CFLAGS) -c -o $@ $<

Can the description for this construct be improved a bit more in the documentation?

I hope that I can avoid to introduce another make rule generator for some
use cases.

Regards,
Markus

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #51269] Reusing data from targets for prerequisites

Robert Morell
In reply to this post by Robert Morell
Update of bug #51269 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #1:

The secondary expansion feature already provides this capability.  That's what
it's for.

https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51269>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #51269] Reusing data from targets for prerequisites

Robert Morell
Follow-up Comment #2, bug #51269 (project make):

I would also like to restrict secondary expansion (or evaluation?) to specific
make rules which might not fit to the following information.

“…
In order for this second expansion to occur, the special target
.SECONDEXPANSION must be defined before the first prerequisite list that makes
use of this feature.
…”


Are there any further software development challenges to consider so that such
functionality will only be switched on for a specific scope in a make script?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51269>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Loading...