[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #63241] implement "exit" in makefile parsing
From: |
anonymous |
Subject: |
[bug #63241] implement "exit" in makefile parsing |
Date: |
Wed, 19 Oct 2022 12:43:54 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?63241>
Summary: implement "exit" in makefile parsing
Project: make
Submitter: None
Submitted: Wed 19 Oct 2022 04:43:52 PM UTC
Severity: 3 - Normal
Item Group: Enhancement
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: SCM
Operating System: None
Fixed Release: None
Triage Status: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Wed 19 Oct 2022 04:43:52 PM UTC By: Anonymous
I’ll start this by making an analogy with scripting languages. A Python
script might have logic like:
while <condition1>:
if <condition2>:
# do thing A
else:
# do thing B
Indenting can go to unlimited depths so most languages offer a short-circuit
which makes things more readable:
while <condition1>:
if <condition2>:
# do thing A
continue
# do thing B
Coming back to GNU make, I have quite a few complex (many hundreds of lines)
makefiles which require logic like this (greatly simplified):
ifneq ($(filter %clean clobber,$(MAKECMDGOALS)),)
<clean targets>
else
<real targets>
endif
This makes it harder to read, because all the “real” logic is a subclause
(or 2, or 3) deep. Tracking if-else-endif across large files is difficult.
I’m wondering if the make parser would be capable of something like this:
ifneq ($(filter %clean clobber,$(MAKECMDGOALS)),)
<clean targets>
exit
endif
<real targets>
Where the “exit” keyword simply says to stop parsing. Perhaps there’s a
better name, but the basic idea is to implement short-circuit parsing
analogously to the shell example. Doable?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63241>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #63241] implement "exit" in makefile parsing,
anonymous <=