summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/Makefile.once.head')
-rw-r--r--build-aux/Makefile.once.head/00-var.mk7
-rw-r--r--build-aux/Makefile.once.head/10-dist.mk10
-rw-r--r--build-aux/Makefile.once.head/10-files.mk37
-rw-r--r--build-aux/Makefile.once.head/10-gitfiles.mk (renamed from build-aux/Makefile.once.head/00-gitfiles.mk)15
-rw-r--r--build-aux/Makefile.once.head/10-gnuconf.mk7
-rw-r--r--build-aux/Makefile.once.head/10-nested.mk3
-rw-r--r--build-aux/Makefile.once.head/10-texinfo.mk47
7 files changed, 101 insertions, 25 deletions
diff --git a/build-aux/Makefile.once.head/00-var.mk b/build-aux/Makefile.once.head/00-var.mk
index 1f50f21f1a..7c9e6ffe55 100644
--- a/build-aux/Makefile.once.head/00-var.mk
+++ b/build-aux/Makefile.once.head/00-var.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 Luke Shumaker
+# Copyright (C) 2016-2017 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
@@ -20,14 +20,17 @@ define mod.var.doc
# Outputs:
# Target : `$(outdir)/.var.%`
# Directory variable: `at.targets`
+# Directory variable: `var.`
#
# It's a well-known secret that many files generated by a Makefile vary with
# the values of particular variables, but that GNU Make can't track these
# dependencies. Well, with some cleverness, it actually can!
#
# With this module, to depend on the value of a variable, depend on
-# `$(outdir)/.var.VARNAME`.
+# `$(outdir)/.var.VARNAME`, or `$(var.)VARNAME` for short.
endef
mod.var.doc := $(value mod.var.doc)
+var. = $(patsubst ./%,%,$(outdir)/.var.)
+
.PHONY: _var.FORCE
diff --git a/build-aux/Makefile.once.head/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk
index 831ca125f8..3621195c0d 100644
--- a/build-aux/Makefile.once.head/10-dist.mk
+++ b/build-aux/Makefile.once.head/10-dist.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Luke Shumaker
+# Copyright (C) 2015-2017 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
@@ -13,7 +13,7 @@
# 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/>.
-mod.dist.description = `dist` target for distribution tarballs
+mod.dist.description = `dist` target to create distribution tarballs
define mod.dist.doc
# User variables:
# - `CP ?= cp`
@@ -50,6 +50,12 @@ define mod.dist.doc
endef
mod.dist.doc := $(value mod.dist.doc)
+PACKAGE_TARNAME ?=
+PACKAGE ?=
+PACKAGE_NAME ?=
+PACKAGE_VERSION ?=
+VERSION ?=
+
# Developer configuration
dist.exts ?= .tar.gz
diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk
index f6fcf30c3a..564f9d634f 100644
--- a/build-aux/Makefile.once.head/10-files.mk
+++ b/build-aux/Makefile.once.head/10-files.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Luke Shumaker
+# Copyright (C) 2015-2017 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
@@ -26,15 +26,15 @@ define mod.files.doc
# - Global variable : `files.default ?= all`
# - Global variable : `files.vcsclean ?= files.vcsclean`
# - Global variable : `files.generate ?= files.generate`
-# - Directory variable : `files.src.src`
-# - Directory variable : `files.src.int`
-# - Directory variable : `files.src.cfg`
-# - Directory variable : `files.src.gen`
-# - Directory variable : `files.out.slow`
-# - Directory variable : `files.out.int`
-# - Directory variable : `files.out.cfg`
-# - Directory variable : `files.out.$(files.groups)` (well, $(addprefix...))
-# - Directory variable : `files.sys.$(files.groups)` (well, $(addprefix...))
+# - Directory variable : `files.src.src` # Sources
+# - Directory variable : `files.src.int` # Intermediates; deletable
+# - Directory variable : `files.src.cfg` # Outputs needed to run ./configure
+# - Directory variable : `files.src.gen` # Other outputs
+# - Directory variable : `files.out.slow` # Things to exclude from `make mostlyclean`
+# - Directory variable : `files.out.int` # Intermediates
+# - Directory variable : `files.out.cfg` # Outputs created by ./configure
+# - Directory variable : `files.out.$(group)` for `group` in `$(files.groups)`
+# - Directory variable : `files.sys.$(group)` for `group` in `$(files.groups)`
# Outputs:
# - Global variable : `nested.targets`
# - Global variable : `at.targets`
@@ -43,7 +43,7 @@ define mod.files.doc
# - Directory variable : `files.out`
# - Directory variable : `files.sys`
# - Creative .PHONY targets:
-# - `$(outdir)/$(files.generate))`
+# - `$(outdir)/$(files.generate)`
# - `$(outdir)/$(group)` for `group` in `$(files.groups)`
# - `$(outdir)/install`
# - `$(outdir)/install-$(group)` for `group` in `$(filter-out $(files.default),$(files.groups))`
@@ -59,6 +59,10 @@ define mod.files.doc
# Basic `*` wildcards are supported. Use `*`, not `%`; it will automatically
# substitute `*`->`%` where appropriate.
#
+# Each of the destructive targets depends on `$(target)-hook`, which
+# is defined to be a "double-colon rule" allowing you to add your own
+# code.
+#
# TODO: prose documentation
endef
mod.files.doc := $(value mod.files.doc)
@@ -76,7 +80,7 @@ nested.targets += install installdirs
nested.targets += $(foreach g,$(files.groups),$g)
nested.targets += $(foreach g,$(filter-out $(files.default),$(files.groups)),install-$g install-$gdirs)
# Standard destructive PHONY targets
-nested.targets += uninstall mostlyclean clean distclean maintainer-clean
+nested.targets += uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean)
# User configuration
@@ -85,3 +89,12 @@ DESTDIR ?=
RM ?= rm -f
RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty
TRUE ?= true
+
+# Utility functions
+
+_files.XARGS = $(if $(strip $2),$1 $(strip $2))
+
+_files.maintainer-clean-warning:
+ @echo 'This command is intended for maintainers to use; it'
+ @echo 'deletes files that may need special tools to rebuild.'
+.PHONY: _files.maintainer-clean-warning
diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/10-gitfiles.mk
index 1214e508c4..8566a7f5e9 100644
--- a/build-aux/Makefile.once.head/00-gitfiles.mk
+++ b/build-aux/Makefile.once.head/10-gitfiles.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 Luke Shumaker
+# Copyright (C) 2016-2017 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
@@ -51,10 +51,10 @@ define mod.gitfiles.doc
# subdirectory. To do this, it uses an expression involving
# `$(nested.subdirs)`.
#
-# While gitfiles sets `files.src.src` very early
-# in `each.head`, because `nested.subdirs` might not be set yet, it may
-# or may not be safe to use the value of `$(files.src.src)` in your
-# Makefile, depending on how you set `nested.subdirs`.
+# While gitfiles sets `files.src.src` very early in `each.head`, because
+# `nested.subdirs` might not be set yet, it may or may not be safe to
+# use the value of `$(files.src.src)` in your Makefile, depending on how
+# you set `nested.subdirs`.
endef
mod.gitfiles.doc := $(value mod.gitfiles.doc)
@@ -65,10 +65,11 @@ _gitfiles.all =
ifneq ($(wildcard $(topsrcdir)/.git),)
$(topsrcdir)/$(gitfiles.file): _gitfiles.FORCE
- @(cd $(@D) && git ls-files -z) | sed -z -e 's/\$$/\$$$$/g' -e 's/\n/$$(at.nl)/g' | xargs -r0 printf '_gitfiles.all+=%s\n' | $(WRITE_IFCHANGED) $@
+ @(cd $(@D) && git ls-files --recurse-submodules -z) | sed -z -e 's/\$$/\$$$$/g' -e 's/\n/$$(at.nl)/g' | xargs -r0 printf '_gitfiles.all+=%s\n' | $(WRITE_IFCHANGED) $@
.PHONY: _gitfiles.FORCE
endif
_gitfiles.dir = $(call at.relto,$(topsrcdir),$(srcdir))
-_gitfiles.dir.all = $(patsubst $(_gitfiles.dir)/%,%,$(filter $(_gitfiles.dir)/%,$(_gitfiles.all)))
+_gitfiles.pat = $(patsubst ./%,%,$(_gitfiles.dir)/%)
+_gitfiles.dir.all = $(patsubst $(_gitfiles.pat),%,$(filter $(_gitfiles.pat),$(_gitfiles.all)))
_gitfiles.dir.src = $(filter-out $(addsuffix /%,$(nested.subdirs)),$(_gitfiles.dir.all))
diff --git a/build-aux/Makefile.once.head/10-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk
index a4b76964f4..87baa14a69 100644
--- a/build-aux/Makefile.once.head/10-gnuconf.mk
+++ b/build-aux/Makefile.once.head/10-gnuconf.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 Luke Shumaker
+# Copyright (C) 2016-2017 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
@@ -30,6 +30,9 @@ define mod.gnuconf.doc
endef
mod.gnuconf.doc := $(value mod.gnuconf.doc)
+PACKAGE_TARNAME ?=
+PACKAGE ?=
+PACKAGE_NAME ?=
gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))
ifeq ($(gnuconf.pkgname),)
$(error Autothing module: gnuconf: gnuconf.pkgname must be set)
@@ -101,6 +104,8 @@ TEXI2DVIFLAGS ?=
YACC ?= yacc
YFLAGS ?= # YFLAGS instead of YACCFLAGS
+CPPFLAGS ?=
+
LN_S ?= ln -s # TODO[2]
CHGRP ?= chgrp
diff --git a/build-aux/Makefile.once.head/10-nested.mk b/build-aux/Makefile.once.head/10-nested.mk
index 4f181a9290..d903d53cd4 100644
--- a/build-aux/Makefile.once.head/10-nested.mk
+++ b/build-aux/Makefile.once.head/10-nested.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 Luke Shumaker
+# Copyright (C) 2016-2017 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
@@ -21,6 +21,7 @@ define mod.nested.doc
# Outputs:
# - .PHONY Targets : `$(addprefix $(outdir)/,$(nested.targets))`
# - Variable : `at.subdirs`
+# - Variable : `at.targets`
#
# The Autothing `at.subdirs` slates a subdirectory's Makefile for inclusion,
# but doesn't help with recursive targets like `all`, `install`, or `clean`,
diff --git a/build-aux/Makefile.once.head/10-texinfo.mk b/build-aux/Makefile.once.head/10-texinfo.mk
new file mode 100644
index 0000000000..d24852d8eb
--- /dev/null
+++ b/build-aux/Makefile.once.head/10-texinfo.mk
@@ -0,0 +1,47 @@
+# Copyright (C) 2016-2017 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/>.
+
+mod.texinfo.description = The GNU documentation system
+mod.texinfo.depends += files nested gnuconf
+define mod.texinfo.doc
+# User variables (in addition to gnuconf):
+# - `TEXI2HTML ?= makeinfo --html`
+# - `TEXI2PDF ?= texi2pdf`
+# - `TEXI2PS ?= texi2dvi --ps`
+# Inputs:
+# - Directory variable : `texinfo.docs ?=`
+# Outputs:
+# - Global variable : `files.groups += html dvi pdf ps`
+# - Global variable : `nested.targets += info`
+# - Directory variable : `files.src.gen`
+# - Directory variable : `files.out.{dvi,html,pdf,ps}`
+# - Directory variable : `files.sys.{dvi,html,pdf,ps,all}`
+# - .PHONY target : `$(outdir)/info`
+# - Target : `$(outdir)/%.info`
+# - Target : `$(outdir)/%.dvi`
+# - target : `$(outdir)/%.html`
+# - target : `$(outdir)/%.pdf`
+# - Target : `$(outdir)/%.ps`
+#
+# TODO: prose documentation
+endef
+mod.texinfo.doc := $(value mod.texinfo.doc)
+
+TEXI2HTML ?= makeinfo --html
+TEXI2PDF ?= texi2pdf
+TEXI2PS ?= texi2dvi --ps
+
+files.groups += html dvi pdf ps
+nested.targets += info