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.
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. */" >[email protected] ;\
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)\"
>>[email protected] ;\
diff -qN [email protected] $@; test $$? -eq 0 || { echo "Generating SCS
header \"$@\"" ; mv -f [email protected] $@; } ;\
rm -f [email protected] ;\
#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.