From: Junio C Hamano Date: Sun, 12 Mar 2017 17:54:16 GMT Subject: Re: [RFC PATCH] Move SHA-1 implementation selection into a header file Message-ID: In-Reply-To: <20170312130149.czir5hcbosqlmkhb@sigill.intra.peff.net> Jeff King writes: > diff --git a/Makefile b/Makefile > index 9f0eae428..0d65d50e9 100644 > --- a/Makefile > +++ b/Makefile > @@ -690,6 +690,7 @@ XDIFF_LIB = xdiff/lib.a > VCSSVN_LIB = vcs-svn/lib.a > > GENERATED_H += common-cmds.h > +GENERATED_H += hash.h > ... > -BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \ > - $(COMPAT_CFLAGS) > +BASIC_CFLAGS += $(COMPAT_CFLAGS) > ... > +hash.h: > + $(QUIET_GEN)echo '#include $(SHA1_HEADER)' >$@+ && \ > + { cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } > + That looks sensible. We do not have to adjust the code to update GIT-BUILD-OPTIONS and friends in this patch because the current way to force rebuilding when SHA1_HEADER changes is by letting GIT-CFLAGS file notice the change, and the new "hash.h" itself will let the $(MAKE) notice if a different hash implementation is chosen for the build.