Thread (1 message) 1 message, 1 author, 2021-03-08

Re: [PATCH] Makefile: generate 'git' as 'cc [...] -o git+ && mv git+ git'

From: Junio C Hamano <hidden>
Date: 2021-03-08 17:21:45

Possibly related (same subject, not in this thread)

Ævar Arnfjörð Bjarmason [off-list ref] writes:
We have a lot of existing rules in the Makefile that are of the form:

    make thing >thing+ &&
    mv thing+ thing

Where we're not doing the rename dance to avoid clobbering the file
we're reading.
I am afraid that you are totally misreading the intent of that age
old convention, which is spelled:

	thing:
		rm -f thing thing+
		prepare contents for thing >thing+
		mv thing+ thing

It protects us from a failure mode where "prepare contents for
thing" step is broken and leaves a "thing" that does not work, but
confuses make that make does not need to rebuild it, if you wrote it
as such:

	thing:
		prepare contents for thing >thing

I think more recent make actually has some knob you can tweak to
tell "if the rule failed, remove it", but the convention predates
it.

In any case, it is not "we are trying to make thing available while
it is being rewritten" at all.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help