[bug #51306] Checking programming possibilities around “MAKECMDGOALS”

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

[bug #51306] Checking programming possibilities around “MAKECMDGOALS”

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

                 Summary: Checking programming possibilities around
“MAKECMDGOALS”
                 Project: make
            Submitted by: elfring
            Submitted on: Sat 24 Jun 2017 10:22:36 PM CEST
                Severity: 3 - Normal
              Item Group: Bug
                  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 documentation contains the following information
<https://www.gnu.org/software/make/manual/html_node/Goals.html#index-MAKECMDGOALS>:
“…
Make will set the special variable MAKECMDGOALS to the list of goals you
specified on the command line.
…”


I imagine that such a list can occasionally provide several elements. I would
find the presented example insufficient in this case because only a simple
string comparison is performed there.

* How should the specified goals be really checked in a safe way?
* Is another software extension needed for the make function library?




    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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 #51306] Checking programming possibilities around “MAKECMDGOALS”

Robert Morell
Update of bug #51306 (project make):

              Item Group:                     Bug => Documentation          

    _______________________________________________________

Follow-up Comment #1:

The same way you'd check for a word in any other list of words, in GNU make:


sources = foo.c bar.c

ifeq (,$(filter clean,$(MAKECMDGOALS)))
include $(sources:.c=.d)
endif


will only include the files if "clean" doesn't appear anywhere in
MAKECMDGOALS.

However, I'm not sure that this is the correct behavior.  Suppose someone used
"make clean all"; now none of the dependency files will be included for the
"all" target.

I'll leave this open as a Doc bug to determine whether the example needs to be
reworked.

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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 #51306] Checking programming possibilities around “MAKECMDGOALS”

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

I imagine that there is a need to express higher level requirements.

If you know for example that parameter like “distclean” was passed
somewhere in the list of make goals, I guess that it can make sense to omit
the execution of previous targets while subsequent targets could be updated
again.

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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 #51306] Checking programming possibilities around “MAKECMDGOALS”

Robert Morell
Follow-up Comment #3, bug #51306 (project make):

You can't change the set of goals that make will build by modifying the
MAKECMDGOALS variable.  All you can do is query which goals it will build.

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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 #51306] Checking programming possibilities around “MAKECMDGOALS”

Robert Morell
Follow-up Comment #4, bug #51306 (project make):

But the make rule set can be adjusted in some ways according to the query
result.

    _______________________________________________________

Reply to this item at:

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

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


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