[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #52028] Preventing infinite recursions when make is invoked from re
[bug #52028] Preventing infinite recursions when make is invoked from recipes
Fri, 15 Sep 2017 01:47:31 -0400 (EDT)
Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Summary: Preventing infinite recursions when make is invoked
Submitted by: None
Submitted on: Fri 15 Sep 2017 05:47:30 AM UTC
Severity: 3 - Normal
Item Group: Enhancement
Assigned to: None
Discussion Lock: Any
Component Version: 4.1
Operating System: POSIX-Based
Fixed Release: None
Triage Status: None
Consider this Makefile:
Building either a or b will cause infinite recursion.
It is possible to work around this with a template, similar to the following:
SHELL := bash
exportable = $(shell echo $(1) | sed 's%[^[:alnum:]_]%_%g')
$(eval d := $(strip $(call exportable,$(1))))
$(eval f := $(if $(strip $(2)), -f $(realpath $(strip $2))))
if [ "$$_making_$(d)" != "$@" ]; then \
export _making_$(d)="$@"; \
$(MAKE) $(f) "$(strip $(1))"; \
Running with -s produces:
Making b instead:
This is an enhancement/optional feature request:
Add a command $(make ...) or modify interpretation of $(MAKE) in recipes,
which functions in a way similar to the work around template provided.
The template is highly non-portable, uses regular expressions and invokes a
shell, pollutes environment variables without cleaning up, and it is very hard
to understand (it took several hours of experimenting to come up with).
Reasons to deny the request that I can think of:
It may be considered "bad design" to specify dependencies within a recipe. The
above example is basically a circular dependency.
GNU Make allows recursion which therefore exposes an infinite recursion bug. A
circular dependency specified normally will not cause an infinite recursion.
GNU Make should treat these the same way.
The dependency specified by a recursive make is different to a normal
dependency in that it allows for control over ordering of recipe instructions.
This may open up more patterns for make to be used more heuristically
(dependencies do not need to be rigidly pre-determined).
I'd quite like to try implementing this feature because I have specific use
cases for it.
Reply to this item at:
Message sent via/by Savannah
- [bug #52028] Preventing infinite recursions when make is invoked from recipes,