summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-30 14:46:36 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-30 18:54:01 -0500
commitdc9339b5699ee3b0d48145a1389f93e9e09d02a6 (patch)
treeed71bd691ea6e0d05d47e2bfd891c333bf5709ab /build-aux/Makefile.once.head
parent4f9203808ef9607ae27eba3cf77079bbe661fd95 (diff)
Update and tidy the build system for autothing v3.
Diffstat (limited to 'build-aux/Makefile.once.head')
-rw-r--r--build-aux/Makefile.once.head/00-libretools.mk142
-rw-r--r--build-aux/Makefile.once.head/20-libretools.mk83
2 files changed, 142 insertions, 83 deletions
diff --git a/build-aux/Makefile.once.head/00-libretools.mk b/build-aux/Makefile.once.head/00-libretools.mk
new file mode 100644
index 0000000..8497d68
--- /dev/null
+++ b/build-aux/Makefile.once.head/00-libretools.mk
@@ -0,0 +1,142 @@
+# 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
+# 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.libretools.description = (libretools) build rules
+define mod.libretools.doc
+# Inputs:
+# - Install paths (Directory variables):
+# - `pkgconfdir = $(sysconfdir)/libretools.d`
+# - `pkgdocdir = $(docdir)/libretools`
+# - `pkglibexecdir = $(libexecdir)/libretools`
+# - Outputs (Directory variables):
+# - `libretools.out.mans`
+# - `libretools.out.bins`
+# - `libretools.out.libexecs`
+# - `libretools.out.libs`
+# - `libretools.out.docs`
+# - `libretools.out.confs`
+# - `libretools.out`
+# - Misc (Directory variables):
+# - `libretools.src.devtools`
+# - `libretools.pots`
+# Outputs:
+# - Autothing module configuration (Global variables):
+# - `gitfiles.file`
+# - `var`
+# - Shell commands (Global variables)
+# - `libretools.edit`
+# - `libretools.indent`
+# - `libretools.pofmt`
+# - Source information
+# - Directory variable : `libretools.src`
+# - Directory variable : `libretools.src.exec`
+# - Directory variable : `libretools.src.conf`
+# - Directory variable : `libretools.src.ronn`
+# - Directory variable : `libretools.src.md`
+# - Directory variable : `libretools.src.sh`
+# - File : `$(topsrcdir)/.srcversion-libretools.mk`
+# - Global variable : `LIBRETOOLS_VERSION`
+# - Global variable : `LIBRETOOLS_COMMIT`
+# - File : `$(topsrcdir)/.srcversion-devtools.mk`
+# - Global variable : `DEVTOOLS_VERSION`
+# - Global variable : `DEVTOOLS_COMMIT`
+# - Primary outputs:
+# - Directory variable : `files.src.gen`
+# - Directory variable : `files.out.all`
+# - Directory variable : `files.sys.all`
+# - Directory variable : `files.out.int`
+# - Target : `$(srcdir)/%.in: $(devtoolsdir)/%.in`
+# - Target : `$(outdir)/%: $(srcdir)/%.in`
+# - Target : `$(outdir)/% : $(srcdir)/%.ronn`
+# - Target : `$(outdir)/%.html: $(srcdir)/%.ronn`
+# - Target : `$(outdir)/%.pot: $(outdir)/%`
+# - Target : `$(outdir)/%.pot: $(srcdir)/%`
+# - Target : `$(outdir)/everything.pot`
+# - Target : `$(outdir)/%.ugly: $(srcdir)/%.in $(srcdir)/%.patch`
+# - Target : `$(outdir)/%: $(outdir)/%.ugly
+# - Target : `$(DESTDIR)...:`
+# Misc:
+# - Variable: `LIBREXGETTEXT_FLAGS`
+endef
+mod.quote.doc := $(value mod.quote.doc)
+
+# Configure how Make works ###########################################
+.SECONDARY:
+.DELETE_ON_ERROR:
+
+# Configure how Autothing modules work ###############################
+gitfiles.file = .srcfiles.mk
+
+# Boilerplate ########################################################
+.PHONY: FORCE
+
+# Commands ###########################################################
+
+# Usage: <INPUT $(libretools.edit) >OUTPUT
+# Expand m4_include macros to use librelib
+# This is used when using sources grabbed from devtools
+# Magic for doing @variable@ replacement in files
+libretools.edit = sed \
+ -e 's|^\#!\s*/bin/bash|\#!/usr/bin/env bash|' \
+ -e 's|m4_include(lib/\(.*\))|. "$$(librelib \1)"|' \
+ $(foreach v,$(patsubst $(var.)%,%,$(filter $(var.)%,$^)), -e 's|@$(v)@|$($(v))|g' )
+
+# Usage: $(call libretools.indent,FILENAME)
+# Command to auto-indent a file.
+libretools.indent = emacs --batch $1 \
+ --eval '(setq make-backup-files nil)' \
+ --eval '(setq sh-basic-offset 8)' \
+ --eval '(defun sh-smie-sh-rules--fix (args) "fix bug in Emacs 24 sh-script.el" (if (equal args (list :after "then")) (list :after "if") args))' \
+ --eval "(advice-add 'sh-smie-sh-rules :filter-args \#'sh-smie-sh-rules--fix)" \
+ --eval '(indent-region (point-min) (point-max) nil)' \
+ -f save-buffer &>/dev/null
+
+# Usage <INPUT $(libretools.pofmt) >OUTPUT
+# Normalize a .po(t) file
+libretools.pofmt = msguniq -Fi --to-code=UTF-8
+
+# Auto-detect ########################################################
+
+# It's easy to think of these as "each" variables, but because they
+# will be evaluated on demand, only files.src.src needs to be "each".
+libretools.src.git = $(files.src.src)
+libretools.src.exec = $(patsubst $(srcdir)/%,%,$(shell find $(addprefix $(srcdir)/,$(libretools.src.git)) -executable 2>/dev/null))
+libretools.src.conf = $(filter %.conf,$(libretools.src.git))
+libretools.src.sh = $(filter %.sh ,$(libretools.src.git))
+libretools.src.ronn = $(filter %.ronn,$(libretools.src.git))
+libretools.src.md = $(filter-out HACKING.md,$(filter %.ronn %.md,$(libretools.src.git)))
+
+LIBREXGETTEXT_FLAGS ?=
+
+# Git Version ########################################################
+
+-include $(topsrcdir)/.srcversion-libretools.mk
+-include $(topsrcdir)/.srcversion-devtools.mk
+
+ifneq ($(wildcard $(topsrcdir)/.git),)
+$(topsrcdir)/.srcversion-libretools.mk: FORCE
+ @{ \
+ echo LIBRETOOLS_VERSION = $(patsubst v%,%,$(shell cd $(topsrcdir) && git describe --tags)); \
+ echo LIBRETOOLS_COMMIT = $(shell cd $(topsrcdir) && git rev-parse HEAD); \
+ :; } | $(WRITE_IFCHANGED) $@
+endif
+
+ifneq ($(wildcard $(devtoolsdir)/.git),)
+$(topsrcdir)/.srcversion-devtools.mk: FORCE
+ @{ \
+ echo DEVTOOLS_VERSION = $(patsubst libretools-%,%,$(shell cd $(devtoolsdir) && git describe --tags)); \
+ echo DEVTOOLS_COMMIT = $(shell cd $(devtoolsdir) && git rev-parse HEAD); \
+ :; } | $(WRITE_IFCHANGED) $@
+endif
diff --git a/build-aux/Makefile.once.head/20-libretools.mk b/build-aux/Makefile.once.head/20-libretools.mk
deleted file mode 100644
index d7c3b0e..0000000
--- a/build-aux/Makefile.once.head/20-libretools.mk
+++ /dev/null
@@ -1,83 +0,0 @@
-# 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/>.
-
-# Configure how Make works
-MAKEFLAGS += --no-builtin-rules --no-builtin-variables
-.SECONDARY:
-.DELETE_ON_ERROR:
-
-.PHONY: FORCE
-
-# Magic for tracking variables that affect files. If a file changes
-# based on a variable, just stick $(var)VARNAME as a dependency.
-var = $(call at.path,$(topoutdir)/.var.)
-$(var)%: FORCE
- @printf '%s' '$($*)' | $(WRITE_IFCHANGED) $@
-
-# Usage: <INPUT $(edit) >OUTPUT
-# Expand m4_include macros to use librelib
-# This is used when using sources grabbed from devtools
-# Magic for doing @variable@ replacement in files
-edit = sed \
- -e 's|^\#!\s*/bin/bash|\#!/usr/bin/env bash|' \
- -e 's|m4_include(lib/\(.*\))|. "$$(librelib \1)"|' \
- $(foreach v,$(patsubst $(var)%,%,$(filter $(var)%,$^)), -e 's|@$(v)@|$($(v))|g' )
-
-# Usage: $(call indent,FILENAME)
-# Command to auto-indent a file.
-indent = emacs --batch $1 \
- --eval '(setq make-backup-files nil)' \
- --eval '(setq sh-basic-offset 8)' \
- --eval '(defun sh-smie-sh-rules--fix (args) "fix bug in Emacs 24 sh-script.el" (if (equal args (list :after "then")) (list :after "if") args))' \
- --eval "(advice-add 'sh-smie-sh-rules :filter-args \#'sh-smie-sh-rules--fix)" \
- --eval '(indent-region (point-min) (point-max) nil)' \
- -f save-buffer &>/dev/null
-
-# Usage <INPUT $(pofmt) >OUTPUT
-# Normalize a .po(t) file
-pofmt = msguniq -Fi --to-code=UTF-8
-
-# It's easy to think of these as "each" variables, but because they
-# will be evaluated on demand, only std.src_files needs to be "each".
-detect-all = $(filter-out $(detect-ignore) ,$(srcfiles))
-detect-exec = $(filter-out $(detect-ignore-exec),$(patsubst $(srcdir)/%,%,$(shell find $(addprefix $(srcdir)/,$(detect-all)) -executable)))
-detect-conf = $(filter-out $(detect-ignore-conf),$(filter %.conf ,$(detect-all)))
-detect-ronn = $(filter-out $(detect-ignore-ronn),$(filter %.ronn ,$(detect-all)))
-detect-md = $(filter-out $(detect-ignore-md) ,$(filter %.ronn %.md,$(detect-all)))
-detect-sh = $(filter-out $(detect-ignore-sh) ,$(filter %.sh ,$(detect-all)))
-
-LIBREXGETTEXT_FLAGS ?=
-
-ifeq ($(wildcard $(topsrcdir)/.git),)
-include $(topsrcdir)/.srcversion-libretools.mk
-else
-$(topsrcdir)/.srcversion-libretools.mk: FORCE
- @{ \
- echo LIBRETOOLS_VERSION = $(patsubst v%,%,$(shell cd $(topsrcdir) && git describe --tags)); \
- echo LIBRETOOLS_COMMIT = $(shell cd $(topsrcdir) && git rev-parse HEAD); \
- :; } | $(WRITE_IFCHANGED) $@
--include $(topsrcdir)/.srcversion-libretools.mk
-endif
-
-ifeq ($(wildcard $(devtoolsdir)/.git),)
-include $(topsrcdir)/.srcversion-devtools.mk
-else
-$(topsrcdir)/.srcversion-devtools.mk: FORCE
- @{ \
- echo DEVTOOLS_VERSION = $(patsubst libretools-%,%,$(shell cd $(devtoolsdir) && git describe --tags)); \
- echo DEVTOOLS_COMMIT = $(shell cd $(devtoolsdir) && git rev-parse HEAD); \
- :; } | $(WRITE_IFCHANGED) $@
--include $(topsrcdir)/.srcversion-devtools.mk
-endif