Re: [PATCH v3 2/9] Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to it
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Feb 25, 2022, 23:05 UTC
- Message-ID
- <220226.861qzq7d2r.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <xmqqwnhi8swx.fsf@gitster.g>
On Fri, Feb 25 2022, Junio C Hamano wrote:
Show 20 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > >> diff --git a/Makefile b/Makefile >> index 6f0b4b775fe..d378ec22545 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -1,3 +1,6 @@ >> +# Import tree-wide shared Makefile behavior and libraries >> +include shared.mak >> + >> # The default target of this Makefile is... >> all:: > > Continuing with the theme of [1/9], this change to Makefile gets my > firm NAK. The first two lines MUST stay to be the first lines. > > Otherwise, a mistaken patch that adds rules to shared.make will > make the first of these rules, not "all", as the default target. > > Just move it below to the third line or so and you'd be OK.
Understood, I can/will do that.
But wouldn't working this into this series be an even better option?
The ".DEFAULT_GOAL" variable is new in, 3.81 (01 Apr 2006), which I think is old enough to hard depend on. We use $(or ...) added in the same release in config.mak.dev.
We definitely have a hard dependency on "Version 3.80 (03 Oct 2002)" $(eval ...) etc.
I checked and RHEL5 (which is otherwise the oldest OS we've supported) has it, but RHEL4 doesn't (it has 3.80). So I think it's safe to have a hard dependency on it and other things in 3.81 at this point.
diff --git a/Makefile b/Makefile index 549ca6e7a5c..03321af7e3e 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,6 @@ # Import tree-wide shared Makefile behavior and libraries include shared.mak -# The default target of this Makefile is... -all:: - # Define V=1 to have a more verbose compile. # # Define SHELL_PATH to a POSIX shell if your /bin/sh is broken. diff --git a/shared.mak b/shared.mak index 7ba04049c8a..1034dc758f1 100644 --- a/shared.mak +++ b/shared.mak @@ -1,3 +1,8 @@ +### By setting the default goal to "all" we override any implicit +### setting once "make" sees our first target, which it'll ignore if +### .DEFAULT_GOAL was explicitly set. +.DEFAULT_GOAL = all + ### Remove GNU make implicit rules ## This speeds things up since we don't need to look for and stat() a