summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-29 16:05:16 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-29 16:05:16 -0400
commitc6f86ae29276c84ccd5ba4dd55f83b911a1afd54 (patch)
tree242abb6f74a7bd00e380c9f17a68790da2a7566f /build-aux
parent0ec5e5d0bcc0026ae09f21d5deb7256a38916076 (diff)
work on things
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/Makefile.each.tail/00-dist.mk2
-rw-r--r--build-aux/Makefile.each.tail/10-std.mk39
-rw-r--r--build-aux/Makefile.head.mk39
-rw-r--r--build-aux/Makefile.once.head/00-dist.mk17
-rw-r--r--build-aux/Makefile.once.head/00-write-ifchanged.mk1
-rw-r--r--build-aux/Makefile.once.head/10-std.mk20
-rw-r--r--build-aux/Makefile.once.head/11-gnustandards.mk181
-rw-r--r--build-aux/Makefile.once.tail/00-dist.mk30
-rw-r--r--build-aux/Makefile.tail.mk25
-rwxr-xr-xbuild-aux/write-ifchanged25
10 files changed, 287 insertions, 92 deletions
diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk
index 042af23cb4..1ab75680bc 100644
--- a/build-aux/Makefile.each.tail/00-dist.mk
+++ b/build-aux/Makefile.each.tail/00-dist.mk
@@ -14,5 +14,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
ifeq ($(outdir),$(topoutdir))
-$(_am)clean_files += $(addprefix $(PACKAGE)-*,$($(_am)distexts) /)
+std.clean_files += $(addprefix $(PACKAGE)-*,$(dist.exts) /)
endif
diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk
index ca8497c946..4d36cc596b 100644
--- a/build-aux/Makefile.each.tail/10-std.mk
+++ b/build-aux/Makefile.each.tail/10-std.mk
@@ -12,31 +12,30 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
# Add some more defaults to the *_files variables
-$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files)
+std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files)
# Make each of the standard variables relative to the correct directory
-$(_am)src_files := $(addprefix $(srcdir)/,$($(_am)src_files))
-$(_am)gen_files := $(addprefix $(srcdir)/,$($(_am)gen_files))
-$(_am)cfg_files := $(addprefix $(outdir)/,$($(_am)cfg_files))
-$(_am)out_files := $(addprefix $(outdir)/,$($(_am)out_files))
-$(_am)sys_files := $(addprefix $(DESTDIR),$($(_am)sys_files))
-$(_am)clean_files := $(addprefix $(outdir)/,$($(_am)clean_files))
-$(_am)slow_files := $(addprefix $(outdir)/,$($(_am)slow_files))
-$(_am)subdirs := $(addprefix $(outdir)/,$($(_am)subdirs))
+std.src_files := $(addprefix $(srcdir)/,$(std.src_files))
+std.gen_files := $(addprefix $(srcdir)/,$(std.gen_files))
+std.cfg_files := $(addprefix $(outdir)/,$(std.cfg_files))
+std.out_files := $(addprefix $(outdir)/,$(std.out_files))
+std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files))
+std.clean_files := $(addprefix $(outdir)/,$(std.clean_files))
+std.slow_files := $(addprefix $(outdir)/,$(std.slow_files))
+std.subdirs := $(addprefix $(outdir)/,$(std.subdirs))
# Creative targets
-$(outdir)/build : $($(_am)out_files/$(outdir))
-$(outdir)/install : $($(_am)sys_files/$(outdir))
-$(outdir)/installdirs: $(dir $($(_am)sys_files/$(outdir)))
+$(outdir)/build : $(std.out_files)
+$(outdir)/install : $(std.sys_files)
+$(outdir)/installdirs: $(dir $(std.sys_files))
# Destructive targets
-_am_uninstall/$(outdir) = $(_am_sys_files/$(outdir))
-_am_mostlyclean/$(outdir) = $(filter-out $(_am_slow_files/$(outdir)) $(_am_cfg_files/$(outdir)) $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir)))
-_am_clean/$(outdir) = $(filter-out $(_am_cfg_files/$(outdir)) $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir)))
-_am_distclean/$(outdir) = $(filter-out $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir)))
-_am_maintainer-clean/$(outdir) = $(filter-out $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir)))
+_std.uninstall/$(outdir) := $(_std.sys_files)
+_std.mostlyclean/$(outdir) := $(filter-out $(_std.slow_files) $(_std.cfg_files) $(_std.gen_files) $(_std.src_files),$(_std.clean_files))
+_std.clean/$(outdir) := $(filter-out $(_std.cfg_files) $(_std.gen_files) $(_std.src_files),$(_std.clean_files))
+_std.distclean/$(outdir) := $(filter-out $(_std.gen_files) $(_std.src_files),$(_std.clean_files))
+_std.maintainer-clean/$(outdir) := $(filter-out $(_std.src_files),$(_std.clean_files))
$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):
- $(RM) -- $(sort $(_am_$(@F)/$(@D)))
- $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE)
+ $(RM) -- $(sort $(_std.$(@F)/$(@D)))
+ $(RMDIRS) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE)
diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk
index e4ae329a8f..e5ef379a09 100644
--- a/build-aux/Makefile.head.mk
+++ b/build-aux/Makefile.head.mk
@@ -14,36 +14,39 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This bit only gets evaluated once, at the very beginning
-ifeq ($(_am_NO_ONCE),)
+ifeq ($(_at.NO_ONCE),)
+
+_at.noslash = $(patsubst %/.,%,$(patsubst %/,%,$1))
+# These are all $(call _at.func,parent,child)
+#_at.relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2))
+_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.)
+_at.relto_helper = $(if $(call _at.is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _at.relto_helper,$(patsubst %/,%,$(dir $1)),$2)))
+_at.relto = $(call _at.noslash,$(call _at.relto_helper,$(call _at.noslash,$(abspath $1)),$(call _at.noslash,$(abspath $2))))
+# Note that _at.is_subdir says that a directory is a subdirectory of
+# itself.
+at.path = $(foreach p,$1,$(call _at.relto,.,$p))
-_am = am_
+define at.nl
-_am_noslash = $(patsubst %/.,%,$(patsubst %/,%,$1))
-# These are all $(call _am_func,parent,child)
-#_am_relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2))
-_am_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.)
-_am_relto_helper = $(if $(call _am_is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _am_relto_helper,$(patsubst %/,%,$(dir $1)),$2)))
-_am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(abspath $1)),$(call _am_noslash,$(abspath $2))))
-# Note that _am_is_subdir says that a directory is a subdirectory of
-# itself.
-am_path = $(foreach p,$1,$(call _am_relto,.,$p))
-$(_am)dirlocal += $(_am)subdirs
-$(_am)dirlocal += $(_am)depdirs
+endef
+
+at.dirlocal += at.subdirs
+at.dirlocal += at.depdirs
include $(topsrcdir)/common.once.head.mk
-endif # _am_NO_ONCE
+endif # _at.NO_ONCE
# This bit gets evaluated for each Makefile
## Set outdir and srcdir (assumes that topoutdir and topsrcdir are
## already set)
-outdir := $(call am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST)))))
-srcdir := $(call am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir)))
+outdir := $(call at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST)))))
+srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir)))
-_am_included_makefiles := $(_am_included_makefiles) $(call am_path,$(outdir)/Makefile)
+_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/Makefile)
-$(foreach v,$($(_am)dirlocal),$(eval $v=))
+$(foreach v,$(at.dirlocal),$(eval $v=))
include $(topsrcdir)/common.each.head.mk
diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk
index 5be9c72552..314f7f8f44 100644
--- a/build-aux/Makefile.once.head/00-dist.mk
+++ b/build-aux/Makefile.once.head/00-dist.mk
@@ -1,16 +1 @@
-# Copyright (C) 2016 Luke Shumaker
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-$(_am)distexts ?= .tar.gz
+dist.exts ?= .tar.gz
diff --git a/build-aux/Makefile.once.head/00-write-ifchanged.mk b/build-aux/Makefile.once.head/00-write-ifchanged.mk
new file mode 100644
index 0000000000..79ef1c419c
--- /dev/null
+++ b/build-aux/Makefile.once.head/00-write-ifchanged.mk
@@ -0,0 +1 @@
+WRITE_IFCHANGED = $(topsrcdir)/build-aux/write-ifchanged
diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk
index dec850c240..b3d7c4aba7 100644
--- a/build-aux/Makefile.once.head/10-std.mk
+++ b/build-aux/Makefile.once.head/10-std.mk
@@ -17,15 +17,17 @@
all: build
.PHONY: all
+DESTDIR ?=
+
# Standard creative PHONY targets
-$(_am)phony += build install installdirs
+at.phony += build install installdirs
# Standard destructive PHONY targets
-$(_am)phony += uninstall mostlyclean clean distclean maintainer-clean
+at.phony += uninstall mostlyclean clean distclean maintainer-clean
-$(_am)dirlocal += $(_am)src_files
-$(_am)dirlocal += $(_am)gen_files
-$(_am)dirlocal += $(_am)cfg_files
-$(_am)dirlocal += $(_am)out_files
-$(_am)dirlocal += $(_am)sys_files
-$(_am)dirlocal += $(_am)clean_files
-$(_am)dirlocal += $(_am)slow_files
+at.dirlocal += std.src_files
+at.dirlocal += std.gen_files
+at.dirlocal += std.cfg_files
+at.dirlocal += std.out_files
+at.dirlocal += std.sys_files
+at.dirlocal += std.clean_files
+at.dirlocal += std.slow_files
diff --git a/build-aux/Makefile.once.head/11-gnustandards.mk b/build-aux/Makefile.once.head/11-gnustandards.mk
new file mode 100644
index 0000000000..5520b9bcaf
--- /dev/null
+++ b/build-aux/Makefile.once.head/11-gnustandards.mk
@@ -0,0 +1,181 @@
+# This file is based on ยง7.2 "Makefile Conventions" of the release of
+# the GNU Coding Standards dated April 13, 2016.
+
+# 7.2.1: General Conventions for Makefiles
+# ----------------------------------------
+
+# The standards claim that every Makefile should contain
+#
+# SHELL = /bin/sh`
+#
+# but note that this is unnescesary with GNU Make.
+
+# 7.2.2: Utilities in Makefiles
+# -----------------------------
+
+# It's ok to hard-code these commands in rules, but who wants to
+# memorize the list of what's ok?
+AWK ?= awk
+CAT ?= cat
+CMP ?= cmp
+CP ?= cp
+DIFF ?= diff
+ECHO ?= echo
+EGREP ?= egrep
+EXPR ?= expr
+FALSE ?= false
+GREP ?= grep
+INSTALL_INFO ?= install-info
+LN ?= ln
+LS ?= ls
+MKDIR ?= mkdir
+MV ?= mv
+PRINTF ?= printf
+PWD ?= pwd
+RM ?= rm
+RMDIR ?= rmdir
+SED ?= sed
+SLEEP ?= sleep
+SORT ?= sort
+TAR ?= tar
+TEST ?= test
+TOUCH ?= touch
+TR ?= tr
+TRUE ?= true
+
+# Beyond those, define them yourself.
+
+# 7.2.3 Variables for Specifying Commands
+# ---------------------------------------
+
+INSTALL ?= install
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= ${INSTALL} -m 644
+
+# 7.2.4 DESTDIR: Support for Staged Installs
+# ------------------------------------------
+
+# This is done for us by the std module.
+
+# 7.2.5 Variables for Installation Directories
+# --------------------------------------------
+
+# Root for the installation
+prefix ?= /usr/local
+exec_prefix ?= $(prefix)
+# Executable programs
+bindir ?= $(exec_prefix)/bin
+sbindir ?= $(exec_prefix)/sbin
+libexecdir ?= $(exec_prefix)/libexec
+gnu.program_dirs += $(bindir) $(sbindir) $(libexecdir)
+# Data files
+datarootdir ?= $(prefix)/share
+datadir ?= $(datarootdir)
+sysconfdir ?= $(prefix)/etc
+sharedstatedir ?= $(prefix)/com
+localstatedir ?= $(prefix)/var
+runstatedir ?= $(localstatedir)/run
+gnu.data_dirs += $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir)
+# Specific types of files
+includedir ?= $(prefix)/include
+oldincludedir ?= /usr/include
+docdir ?= $(datarootdir)/doc/$(PACKAGE)
+infodir ?= $(datarootdir)/info
+htmldir ?= $(docdir)
+dvidir ?= $(docdir)
+pdfdir ?= $(docdir)
+psdir ?= $(docdir)
+libdir ?= $(exec_prefix)/lib
+lispdir ?= $(datarootdir)/emacs/site-lisp
+localedir ?= $(datarootdir)/locale
+gnu.data_dirs += $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir)
+
+mandir ?= $(datarootdir)/man
+man1dir ?= $(mandir)/man1
+man2dir ?= $(mandir)/man2
+man3dir ?= $(mandir)/man3
+man4dir ?= $(mandir)/man4
+man5dir ?= $(mandir)/man5
+man6dir ?= $(mandir)/man6
+man7dir ?= $(mandir)/man7
+man8dir ?= $(mandir)/man8
+gnu.data_dirs += $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir)
+
+manext ?= .1
+man1ext ?= .1
+man2ext ?= .2
+man3ext ?= .3
+man4ext ?= .4
+man5ext ?= .5
+man6ext ?= .6
+man7ext ?= .7
+man8ext ?= .8
+
+# srcdir is handled for us by the core
+
+define _gnu.install_program
+$$($1)/%: $$(outdir)/$$($1)
+ $$(NORMAL_INSTALL)
+ $$(INSTALL_PROGRAM)
+$$($1)/%: $$(srcdir)/$$($1)
+ $$(NORMAL_INSTALL)
+ $$(INSTALL_PROGRAM)
+endef
+$(foreach d,$(gnu.program_dirs),$(eval $(call _gnu.install_program,$d)))
+
+define _gnu.install_data
+$$($1)/%: $$(outdir)/$$($1)
+ $$(NORMAL_INSTALL)
+ $$(INSTALL_DATA)
+$$($1)/%: $$(srcdir)/$$($1)
+ $$(NORMAL_INSTALL)
+ $$(INSTALL_DATA)
+endef
+$(foreach d,$(gnu.data_dirs),$(eval $(call _gnu.install_data,$d)))
+
+gnu.dirs += $(gnu.program_dirs) $(gnu.data_dirs)
+$(gnu.dirs):
+ $(MKDIR_P) $@
+
+# 7.2.6: Standard Targets for Users
+# ---------------------------------
+
+gnu.info_docs ?=
+std.sys_files += $(foreach f,$(gnu.info_docs), $(infodir)/$f.info )
+
+#all: std
+#install: std
+$(outdir)/install-html: $(foreach f,$(gnu.info_docs), $(DESTDIR)$(htmldir)/$f.html )
+$(outdir)/install-dvi : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(dvidir)/$f.dvi )
+$(outdir)/install-pdf : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf )
+$(outdir)/install-ps : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(psdir)/$f.ps )
+#uninstall: std
+$(outdir)/install-strip: install
+ $(STRIP $(filter $(bindir)/% $(sbindir)/% $(libexecdir)/%,$(std.sys_files/$(@D)))
+#clean: std
+#distclean: std
+#mostlyclean: std
+#maintainer-clean: std
+TAGS: TODO
+$(outdir)/info: $(addsuffix .info,$(gnu.info_docs))
+$(outdir)/dvi : $(addsuffix .dvi ,$(gnu.info_docs))
+$(outdir)/html: $(addsuffix .html,$(gnu.info_docs))
+$(outdir)/pdf : $(addsuffix .pdf ,$(gnu.info_docs))
+$(outdir)/ps : $(addsuffix .ps ,$(gnu.info_docs))
+#dist:dist
+check: TODO
+installcheck: TODO
+#installdirs: std
+
+$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $<
+$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $<
+$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $<
+$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $<
+$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $<
+
+
+
+#installdirs: std
+
+# 7.2.7: Standard Targets for Users
+# ---------------------------------
diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk
index 2527404e6b..d8fa226eb9 100644
--- a/build-aux/Makefile.once.tail/00-dist.mk
+++ b/build-aux/Makefile.once.tail/00-dist.mk
@@ -17,10 +17,7 @@
.PHONY: dist
dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$($(_am)distexts)
-$(topoutdir)/$(PACKAGE)-$(VERSION).tar: $(topoutdir)/$(PACKAGE)-$(VERSION)
- $(TAR) cf $@ -C $(<D) $(<F)
-
-_am_copyfile = $(MKDIRS) $(dir $2) && $(CP) -T $1 $2
+_am_copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2
_am_addfile = $(call _am_copyfile,$3,$2/$(call _am_relto,$1,$3))
$(topoutdir)/$(PACKAGE)-$(VERSION): $(_am_src_files/$(topoutdir)) $(_am_gen_files/$(topoutdir))
$(RM) -r $@
@@ -29,12 +26,19 @@ $(topoutdir)/$(PACKAGE)-$(VERSION): $(_am_src_files/$(topoutdir)) $(_am_gen_file
$(foreach f,$^,$(call _am_addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \
$(MV) $(@D)/tmp.$(@F).$$$$ $@ || $(RM) -r $(@D)/tmp.$(@F).$$$$
-# For some reason I can't explain, RM doesn't really get set with ?=
-CP ?= cp
-MKDIR ?= mkdir
-MKDIRS ?= mkdir -p
-MV ?= mv
-RM = rm -f
-RMDIRS ?= rmdir -p
-TAR ?= tar
-TRUE ?= true
+$(topoutdir)/$(PACKAGE)-$(VERSION).tar: $(topoutdir)/$(PACKAGE)-$(VERSION)
+ $(TAR) cf $@ -C $(<D) $(<F)
+$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION).tar
+ $(GZIP) $(GZIP_ENV) < $< > $@
+
+CP ?= cp
+GZIP ?= gzip
+MKDIR ?= mkdir
+MKDIR_P ?= mkdir -p
+MV ?= mv
+RM ?= rm -f
+RMDIR_P ?= rmdir -p
+TAR ?= tar
+TRUE ?= true
+
+GZIP_ENV ?= --best
diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk
index 472d2dba0a..bb197dcfd9 100644
--- a/build-aux/Makefile.tail.mk
+++ b/build-aux/Makefile.tail.mk
@@ -18,35 +18,30 @@
include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk)
# Make the namespaced versions of all of the dirlocal variables
-$(foreach v,$($(_am)dirlocal),$(eval $v/$(outdir) = $($v)))
+$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) = $($v)))
# Remember that this is a directory that we've visited
-_am_outdirs := $(_am_outdirs) $(outdir)
+_at.outdirs := $(_at.outdirs) $(outdir)
# Generic phony target declarations:
# mark them phony
-.PHONY: $(addprefix $(outdir)/,$($(_am)phony))
+.PHONY: $(addprefix $(outdir)/,$(at.phony))
# have them depend on subdirs
-$(foreach t,$($(_am)phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs))))
+$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs))))
# Include Makefiles from other directories
-
-define _am_nl
-
-
-endef
-$(foreach _am_NO_ONCE,y,\
- $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$($(_am)subdirs) $($(_am)depdirs))),\
- $(eval include $(filter-out $(_am_included_makefiles),$(makefile)))))
+$(foreach _at.NO_ONCE,y,\
+ $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$(at.subdirs) $(at.depdirs))),\
+ $(eval include $(filter-out $(_at.included_makefiles),$(makefile)))))
# This bit only gets evaluated once, after all of the other Makefiles are read
-ifeq ($(_am_NO_ONCE),)
+ifeq ($(_at.NO_ONCE),)
outdir = /bogus
srcdir = /bogus
-$(foreach v,$($(_am)dirlocal),$(eval $v=))
+$(foreach v,$(at.dirlocal),$(eval $v=))
include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk)
-endif # _am_NO_ONCE
+endif # _at.NO_ONCE
diff --git a/build-aux/write-ifchanged b/build-aux/write-ifchanged
new file mode 100755
index 0000000000..185ceb0039
--- /dev/null
+++ b/build-aux/write-ifchanged
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Copyright (C) 2015 Luke Shumaker
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+outfile=$1
+tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}"
+
+cat > "$tmpfile" || exit $?
+if cmp -s "$tmpfile" "$outfile"; then
+ rm -f "$tmpfile" || :
+else
+ mv -f "$tmpfile" "$outfile"
+fi