bugmake - Bugs: bug #51306, Checking programming possibilities...


bug #51306: Checking programming possibilities around “MAKECMDGOALS”

Submitted by:  Markus Elfring <elfring>
Submitted on:  Sat 24 Jun 2017 08:22:36 PM UTC  
Severity:  3 - Normal Item Group:  Documentation
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.2.1 Operating System:  Any
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 02 Jul 2017 07:08:55 PM UTC, comment #4: 

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

Markus Elfring <elfring>
Sun 02 Jul 2017 07:03:56 PM UTC, comment #3: 

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.

Paul D. Smith <psmith>
Project Administrator
Sun 02 Jul 2017 05:38:32 PM UTC, comment #2: 

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.

Markus Elfring <elfring>
Sun 02 Jul 2017 05:18:17 PM UTC, 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)

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.

Paul D. Smith <psmith>
Project Administrator
Sat 24 Jun 2017 08:22:36 PM UTC, original submission:  

The documentation contains the following information:
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?
Markus Elfring <elfring>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by elfring (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-07-02 psmith Item GroupBug => Documentation

    Back to the top

    Powered by Savane 3.7