From: Nick Bowler Date: Thu, 24 Mar 2022 02:22:50 +0000 (-0400) Subject: Fix glconfig with --disable-dependency-tracking. X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/commitdiff_plain/5f7a5274914472e4e599fc3fd39764408ce25b14 Fix glconfig with --disable-dependency-tracking. When configuring with --disable-dependency-tracking, the .deps directories are not created by config.status so unconditionally creating files in there will not work. Making the dependency file generation conditional will avoid this problem. Add a new test case to cover this issue. --- diff --git a/snippet/glconfig.mk b/snippet/glconfig.mk index b7ed4cc..c35a8fb 100644 --- a/snippet/glconfig.mk +++ b/snippet/glconfig.mk @@ -72,21 +72,28 @@ CLEANFILES += $(GLCONFIG) # The glconfig-gen target is intended only for use in recursive make # invocations. glconfig-gen: $(gnulib_symfiles) + $(AM_V_at) $(MKDIR_P) @GLSRC@ $(AM_V_at) depfiles=; symfiles=; \ for sym in $(gnulib_symfiles); do \ - symdir=`expr "$$sym" : '\(.*/\)'`; \ - symfile=`expr "$$sym" : '.*/\(.*\)' || printf '%s\n' "$$sym"`; \ - symbase=$$symdir.syms/`expr "$$symfile" : '\(.*\)\..*'`; \ - test -f "$$symbase.deps" && \ - depfiles="$$depfiles $$symbase.deps"; \ - symfiles="$$symfiles $$symbase.sym"; \ + symdir=`expr "$$sym" : '\(.*/\)'`; \ + symfile=`expr "$$sym" : '.*/\(.*\)' || printf '%s\n' "$$sym"`; \ + symbase=$$symdir.syms/`expr "$$symfile" : '\(.*\)\..*'`; \ + test -f "$$symbase.deps" && \ + depfiles="$$depfiles $$symbase.deps"; \ + symfiles="$$symfiles $$symbase.sym"; \ done; \ - $(GLCAT) $$depfiles > @GLSRC@/$(DEPDIR)/glconfig.Ph && \ - $(GLCAT) $$symfiles | sed 's/.*/#define & $(GLSYM_PREFIX)&/' \ - > $(GLCONFIG).tmp + $(glconfig_nodeps) \ + || $(GLCAT) $$depfiles > @GLSRC@/$(DEPDIR)/glconfig.Ph || exit; \ + $(GLCAT) $$symfiles | sed 's/.*/#define & $(GLSYM_PREFIX)&/' \ + >$(GLCONFIG).tmp .PHONY: glconfig-gen -@AMDEP_TRUE@@am__include@ @am__quote@@GLSRC@/$(DEPDIR)/glconfig.Ph@am__quote@@dx_include_marker@ +if AMDEP +glconfig_nodeps = false +@am__include@ @am__quote@@GLSRC@/$(DEPDIR)/glconfig.Ph@am__quote@@dx_include_marker@ +else +glconfig_nodeps = true +endif # Automake 1.16 and newer use make rules to generate the dependency stubs. # we must hook those which is kind of annoying to do. This should be harmless diff --git a/tests/snippets.at b/tests/snippets.at index 32c1f70..4352725 100644 --- a/tests/snippets.at +++ b/tests/snippets.at @@ -1,4 +1,4 @@ -dnl Copyright © 2021 Nick Bowler +dnl Copyright © 2021-2022 Nick Bowler dnl dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2. dnl This is free software: you are free to do what the fuck you want to. @@ -58,3 +58,34 @@ AT_CHECK([{ echo 'rule:; @echo works' | dmake -f - >out 2>/dev/null && AT_CHECK([./configure MAKE=dmake && test -f .deps/testsuite.P], [0], [ignore]) AT_CLEANUP + +AT_SETUP([glconfig.mk no depfiles]) + +TEST_CONFIGURE_AC( +[[AM_INIT_AUTOMAKE([foreign]) + +AM_SET_DEPDIR +AM_OUTPUT_DEPENDENCY_COMMANDS +AM_MAKE_INCLUDE +AM_DEP_TRACK + +DX_AUTOMAKE_COMPAT +AC_SUBST([GLSRC], [lib]) + +AC_CONFIG_FILES([Makefile]) +]]) + +cp "$srcdir/snippet/glconfig.mk" . +AT_DATA([Makefile.am], +[[CLEANFILES = +DISTCLEANFILES = +gnulib_headers = +include $(top_srcdir)/glconfig.mk +]]) +TEST_AUTORECONF + +TEST_CONFIGURE([--disable-dependency-tracking]) +AT_CHECK([make -s lib/glconfig.h]) +AT_CHECK([test ! -d lib/.deps && test ! -d lib/_deps && cat lib/glconfig.h]) + +AT_CLEANUP