Re: [RFC PATCH] Move SHA-1 implementation selection into a header file
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 12, 2017, 17:54 UTC
- Message-ID
- <xmqqfuiiv0s7.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170312130149.czir5hcbosqlmkhb@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
> 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.