From b314e07b6d7bf0f69929409ebeae8fd45eecef59 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 31 Jan 2020 17:39:30 -0500 Subject: [PATCH] Improve incremental builds with unmodified GOB headers. It's nice to not touch header files which are unchanged during an incremental build, because that will trigger pointless rebuilds of other files. Pass --no-touch-headers to gob2 which enables this behaviour. Add a dist-hook to update the header timestamps when distributing so that everything is fully up-to-date in the tarball. --- Makefile.am | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index e5140a4..f454e35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,6 +11,9 @@ MOSTLYCLEANFILES = DISTCLEANFILES = CLEANFILES = +# Distribution should be buildable without working gob. +AM_DISTCHECK_CONFIGURE_FLAGS = GOB2=false + EXTRA_DIST = $(MAINTAINERCLEANFILES) m4/gnulib-cache.m4 AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \ @@ -60,6 +63,7 @@ moduleflags = -module -avoid-version -export-symbols-regex _LTX_ engine_GOBS = src/engine/palette.gob src/engine/texture.gob \ src/engine/music.gob src/engine/sound.gob src/engine/mesh.gob +EXTRA_DIST += $(engine_GOBS) MAINTAINERCLEANFILES += $(engine_GOBS:.gob=.gobstamp) \ $(engine_GOBS:.gob=.c) $(engine_GOBS:.gob=.h) @@ -113,7 +117,8 @@ if HAVE_GOB2_DYN $(GOB_V) od='$(@D)'; case $$od in \ src/*) od=src ;; \ */src/*) od=$${od%/src/*}/src ;; \ - esac; $(GOB2) -o "$$od" --file-sep=/ --no-private-header $< + esac; $(GOB2) -o "$$od" --file-sep=/ \ + --no-private-header --no-touch-headers $< $(AM_V_at) mv -f $@.tmp $@ else if HAVE_GOB2 @@ -136,5 +141,24 @@ STAMP_RECOVER = \ .gobstamp.c: ; $(STAMP_RECOVER) .gobstamp.h: ; $(STAMP_RECOVER) +# The gob rules refrain from updating unchanged headers for the convenience of +# developers, but the headers should be distributed with up-to-date timestamps. +dist-hook: update-headers +update-headers: unfuck-distdir + for f in $(engine_GOBS:.gob=.h); do \ + touch -c '$(distdir)'/"$$f" || exit; \ + done +.PHONY: update-headers + +# When running "make dist" in a VPATH build with a read-only srcdir, Automake +# will produce a distribution with all files read-only. Moreover, the files +# are read-only in distdir when the dist hooks are run. This hook will +# manually fix up the permissions. All dist hooks that modify files in +# distdir should list unfuck-distdir as a prerequisite. +dist-hook: unfuck-distdir +unfuck-distdir: + find '$(distdir)' -type f -exec chmod u+w {} + +.PHONY: unfuck-distdir + include $(top_srcdir)/lib/gnulib.mk include $(top_srcdir)/libltdl/ltdl.mk -- 2.43.0