* On 2025 24 Sep 13:47 -0500, Jan Engelhardt wrote:
> 
> On Wednesday 2025-09-24 19:05, Nate Bargmann wrote:
> 
> >make[1]: don't know how to make ./hamlibdatetime.h. Stop
> 
> Something wanted to make "./hamlibdatetime.h", but you only provide
> a rule for "hamlibdatetime.h":
> 
> >hamlibdatetime.h: FORCE
> >     @if test -x $(top_srcdir)/.git ; then \
> >             echo "/* This date time is from the last non-merge commit to 
> > Hamlib. */" > $(builddir)/$(@F).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 | head -n 1 | cut 
> > -c8-13)\"  >> $(builddir)/$(@F).tmp ;\
> 
> The distinction is important.
> 
> >BUILT_SOURCES = $(builddir)/hamlibdatetime.h
> 
> All targets are already relative to ${builddir},
> so explicitly mentioning ${builddir} is wrong for
> targets, and redundant in the recipe.

Removing the $(builddir)/ string from BUILT_SOURCES allows FreeBSD make
to proceed into the target now.  Thanks.

> 
> I'm unsure if $(@F) is even supported outside of GNU make.
> 
> 
> >hamlibdatetime.h: FORCE
> >     @if test -x $(top_srcdir)/.git ; then \
> >             echo "/* This date time is from the last non-merge commit to 
> > Hamlib. */" > $(builddir)/$(@F).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 | head -n 1 | cut 
> > -c8-13)\"  >> $(builddir)/$(@F).tmp ;\
> >             diff -qN $(builddir)/$(@F).tmp $(builddir)/$(@F) ; test $$? -eq 
> > 0 || { echo "Generating SCS header \"$(builddir)/$(@F)\"" ; mv -f 
> > $(builddir)/$(@F).tmp $(builddir)/$(@F) ; } ;\
> >             rm -f $(builddir)/$(@F).tmp ;\
> >             touch -c $(top_srcdir)/src/version_dll.rc ;\
> >     else \
> >             test -f $(srcdir)/$(@F) || cp $(srcdir)/$(@F).in 
> > $(srcdir)/$(@F) ;\
> >     fi
> 
> Just write
> 
> BUILT_SOURCES = hamlibdatetime.h
> 
>       @if test -x $(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 | head -n 1 | cut -c8-13)\" 
>  >>$@.tmp ;\
>               diff -qN $@.tmp $@; test $$? -eq 0 || { echo "Generating SCS 
> header \"$@\"" ; mv -f $@.tmp $@; } ;\
>               rm -f $@.tmp ;\
> #don't!#      touch -c $(top_srcdir)/src/version_dll.rc ;\
>       else \
> #?!#          test -f $(srcdir)/$(@F) || cp $(srcdir)/$(@F).in 
> $(srcdir)/$(@F) ;\
>       fi
> 
> You should never modify content in ${srcdir} (it could be readonly after all),
> so revise those two lines as well.

I'll check that out.  This isn't my code.  The prior maintainer that
added it passed away earlier this year so I'm just working on resolving
the issue related to FreeBSD.

At least the recipe is now partly processed as I get to this point:

Making all in src
Files ./hamlibdatetime.h.tmp and ./hamlibdatetime.h differ
*** Error code 1

Stop.
make[1]: stopped in /home/nate/git/hlb/src
*** Error code 1

Stop.
make: stopped in /home/nate/git/hlb


The reporter of the issue did remark about the differences of return
values between GNU diff and FreeBSD diff in the issue, but GNU make
completes this rule without complaint, ostensibly with FreeBSD diff, so
there is probably a need to hide the return value from FreeBSD make.

Thanks,

- 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