* On 2025 25 Sep 13:41 -0500, Jan Engelhardt wrote:
> 
> * diff produces a "line-by-line comparison" (terminology from the manpage).
>   This is highly wasteful, because in the context of Makefile, we are only
>   interested in a byte-by-byte comparison and stopping at the first mismatch.
>   Use cmp.
> 
> * It is odd to see that they properly used --format=%cd for the first part,
>   but then completely forget that there is --format=%h for the second part and
>   instead did... barbershop nonsense with | head | cut .

I won't speculate.  I do thank you for your assistance, Jan.

> Anyway. Altogether, something like
> 
> hamlibdatetime.h: hamlibdatetime.h.in FORCE
>       ${AM_V_at}if test -d $(top_srcdir)/.git; then \
>               echo "/* This date time is from the last non-merge commit to 
> Hamlib. */" >$@.tmp; \
>               echo "#define HAMLIBDATETIME "\"$$(TZ=UTC git 
> --git-dir=$(top_srcdir)/.git log --no-merges 
> --date='format-local:%Y-%m-%dT%H:%M:%SZ SHA=' --format='%cd' -n 1)$$(git 
> --git-dir=$(top_srcdir)/.git log --no-merges -n 1 --format='%h'\" >$@.tmp; \
>       else \
>               cp ${srcdir}/hamlibdatetime.h.in $@.tmp; \
>       fi
>       ${AM_V_at}if ! cmp $@ $@.tmp >/dev/null 2>/dev/null; then mv $@.tmp $@; 
> fi; rm -f $@.tmp
> 
> might just fix it for good.

Except I did have to close a parentheses at the end of the second 'echo'
line and then add a '>' to append to the .tmp file instead of
overwriting the line from the first 'echo'.

I really appreciate the refactor and so far it seems to be working.
With your permission I will credit you as the author when I commit the
changes.

- Nate

-- 
"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."
Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819

Attachment: signature.asc
Description: PGP signature

Reply via email to