]> git.draconx.ca Git - dxcommon.git/commitdiff
Fix glconfig with --disable-dependency-tracking.
authorNick Bowler <nbowler@draconx.ca>
Thu, 24 Mar 2022 02:22:50 +0000 (22:22 -0400)
committerNick Bowler <nbowler@draconx.ca>
Thu, 24 Mar 2022 02:22:50 +0000 (22:22 -0400)
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.

snippet/glconfig.mk
tests/snippets.at

index b7ed4cc02e88f648306824cc7b95458344f31655..c35a8fb114f525a6fd21b46a24152766e234ad88 100644 (file)
@@ -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
index 32c1f701d7154f107c9302887444e863e8508afe..4352725f42a0ba85ae67a4deafa5dbe7444d7514 100644 (file)
@@ -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