bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #64571] Add option to print targets


From: Tim
Subject: [bug #64571] Add option to print targets
Date: Sat, 19 Aug 2023 13:49:21 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?64571>

                 Summary: Add option to print targets
                   Group: make
               Submitter: timmmm
               Submitted: Sat 19 Aug 2023 05:49:19 PM UTC
                Severity: 3 - Normal
              Item Group: Enhancement
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.4.1
        Operating System: None
           Fixed Release: None
           Triage Status: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 19 Aug 2023 05:49:19 PM UTC By: Tim <timmmm>
A *lot* of people would like to be able to print all the targets contained in
a Makefile. Here's the most popular StackOverflow question about it:

https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile

It has 316 upvotes and 30 bad answers at the moment. The only good option is
if you are using CMake, then it provides `make help` which lists the main
targets. But this doesn't help in the general case.

The rest of the answers are some variant of "use a regex" which is a terrible
idea (now you have two problems) and doesn't work for targets with computed
names.

I figured that rather than writing terrible regexes 30 times it can't be that
hard to actually add this feature to Make.

I have attached a patch that seems to do the job. I'm not sure I put the call
to `print_all_targets()` at the right point in `main()` - to be honest I
couldn't really follow the code. Maybe you can tell me if it's correct and
merge it if so?

Thanks!






    _______________________________________________________
File Attachments:


-------------------------------------------------------
Date: Sat 19 Aug 2023 05:49:19 PM UTC  Name:
Add-flag-to-print-all-targets.patch  Size: 3KiB   By: timmmm

<http://savannah.gnu.org/bugs/download.php?file_id=55063>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64571>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]