From bb49e46b89b65923ea8e2d26c85a116d8be8e35e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 25 May 2016 23:32:14 -0400 Subject: (systemd) stuff --- automake.head.mk | 2 +- automake.txt | 164 ------------------------------------------------------- 2 files changed, 1 insertion(+), 165 deletions(-) delete mode 100644 automake.txt diff --git a/automake.head.mk b/automake.head.mk index 37d3b07..431f14d 100644 --- a/automake.head.mk +++ b/automake.head.mk @@ -24,7 +24,7 @@ _am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(absp # Note that _am_is_subdir says that a directory is a subdirectory of # itself. _am_path = $(call _am_relto,.,$1) -am_path = $(foreach p,$1,$(call _am_relto,$p)) +am_path = $(foreach p,$1,$(call _am_relto,.,$p)) ## Declare the default target all: build diff --git a/automake.txt b/automake.txt deleted file mode 100644 index 935af5f..0000000 --- a/automake.txt +++ /dev/null @@ -1,164 +0,0 @@ -Luke's AutoMake -=============== - -Yo, this document is incomplete. It describes the magical -automake.{head,tail}.mk Makefiles and how to use them, kinda. - -I wrote a "clone" of automake. I say clone, because it works -differently. Yeah, I need a new name for it. - -High-level overview -------------------- - -Now, what this does for you is: - -It makes it _easy_ to write non-recursive Makefiles--and ones that are -similar to plain recursive Makefiles, at that! (search for the paper -"Recursive Make Considered Harmful") As harmful as recursive make is, -it's historically been difficult to to write non-recursive Makefiles. -This makes it easy. - -It also makes it easy to follow the GNU standards for your makefiles: -it takes care of this entire table of .PHONY targets for you: - -| this | and this | are aliases for this | -|------+------------------+--------------------------------------------------------| -| all | build | $(outdir)/build | -| | install | $(outdir)/install | -| | uninstall | $(outdir)/uninstall | -| | mostlyclean | $(outdir)/mostlyclean | -| | clean | $(outdir)/clean | -| | distclean | $(outdir)/distclean | -| | maintainer-clean | $(outdir)/maintainer-clean | -| | check | $(outdir)/check (not implemented for you) | -| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) | - -(You are still responsible for implementing the `$(outdir)/check` -target in each of your Makefiles.) - -What you have to do is: - -In each source directory, you write a `Makefile`, very similarly to if -you were writing for plain GNU Make, with - - topoutdir ?= ... - topsrcdir ?= ... - include $(topsrcdir)/automake.head.mk - - # your makefile - - include $(topsrcdir)/automake.tail.mk - -And in the top-level source directory, Write your own helper makefiles -that get included: - - `common.once.head.mk`: before parsing any of your Makefiles - - `common.each.head.mk`: before parsing each of your Makefiles - - `common.each.tail.mk`: after parsing each of your Makefiles - - `common.each.tail.mk`: after parsing all of your Makefiles - -The `common.*.mk` makefiles are nice for including generic pattern -rules and variables that aren't specific to a directory. - -You're probably thinking that this sounds too good to be true! -Unfortunately, there are two major deviations from writing a plain -recursive Makefile: - - 1. all targets and prerequisites (including .PHONY targets!) need to - be prefixed with - `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`. - * sub-gotcha: this means that if a pattern rule has a - prerequisite that may be in srcdir or outdir, then it must be - specified twice, once for each case. - 2. if a prerequisite is in a directory "owned" by another Makefile, - you must filter the pathname through `am_path`: - `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain - a `..` segment; if you need to refer to a sibling directory, do it - relative to `$(topoutdir)` or `$(topsrcdir)`. - -Telling automake about your program ------------------------------------ - -You tell automake what to do for you by setting some variables. They -are all prefixed with `am_`; this prefix may be changed by editing the -`_am` variable at the top of `automake.head.mk`. - -The exception to this is the `am_path` variable, which is a macro that -is used to make a list of filenames relative to the appropriate -directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't -nescessarily equal to `.`. See above. - -There are several commands that generate files; simply record the list -of files that each command generates as the following variable -variables: - -| Variable | Create Command | Delete Command | Description | Relative to | -|--------------+----------------+-----------------------------+-----------------------------------+-------------| -| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir | -| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | -| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | -| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | -| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR | - -In addition, there are two more variables that control not how files -are created, but how they are deleted: - -| Variable | Affected command | Description | Relative to | -|----------------+------------------+------------------------------------------------+-------------| -| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir | -| | | files in `$(am_out_files)`. (Example: `*.o`) | | -|----------------+------------------+------------------------------------------------+-------------| -| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | -| | | _not_ be deleted. (otherwise, `mostlyclean` | | -| | | is the same as `clean`) | | - -Finally, there are two variables that express the relationships -between directories: - -| Variable | Description | -|------------+---------------------------------------------------------| -| am_subdirs | A list of other directories (containing Makefiles) that | -| | may be considered "children" of this | -| | directory/Makefile; building a phony target in this | -| | directory should also build it in the subdirectory. | -| | They are not necesarily actually subdirectories of this | -| | directory in the filesystem. | -|------------+---------------------------------------------------------| -| am_depdirs | A list of other directories (containing Makefiles) that | -| | contain or generate files that are dependencies of | -| | targets in this directory. They are not necesarily | -| | actually subdirectories of this directory in the | -| | filesystem. Except for files that are dependencies of | -| | files in this directory, things in the dependency | -| | directory will not be built. | - -Tips, notes ------------ - -I like to have the first (non-comment) line in a Makefile be: - - include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk - -(adjusting the number of `../` sequences as nescessary). Then, my -(user-editable) `config.mk` is of the form: - - ifeq ($(topsrcdir),) - topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) - topsrcdir := $(topoutdir) - - # your configuration - - endif - -If the package has a `./configure` script, then I have it modifiy -topsrcdir as necessary, as well as modifying whatever other parts of -the configuration. All of the configuration lives in `config.mk`; -`./configure` doesn't modify any `Makefile`s, it just generates -`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to -`$(outdir)/Makefile`. - ----- -Copyright (C) 2016 Luke Shumaker - -This documentation file is placed into the public domain. If that is -not possible in your legal system, I grant you permission to use it in -absolutely every way that I can legally grant to you. -- cgit v1.2.3-54-g00ecf From e627c4192a4c4a5b944cccd0788c3b198d778409 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 27 May 2016 15:32:35 -0400 Subject: (systemd) stuff --- automake.tail.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/automake.tail.mk b/automake.tail.mk index a24820b..ba31935 100644 --- a/automake.tail.mk +++ b/automake.tail.mk @@ -56,8 +56,9 @@ _am_phony = build install uninstall mostlyclean clean distclean maintainer-clean .PHONY: $(addprefix $(outdir)/,$(_am_phony)) $(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: - $(RM) -- $(sort $(_am_$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) + $(RM) -- $(filter-out %/,$(sort $(_am_$(@F)/$(@D)))) + $(RM) -r -- $(filter %/,$(sort $(_am_$(@F)/$(@D)))) + $(RMDIRS) $(sort $(dir $(patsubst %/,%,$(_am_$(@F)/$(@D))))) 2>/dev/null || $(TRUE) # 'build' and 'install' must be defined later, because the # am_*_files/* variables might not be complete yet. -- cgit v1.2.3-54-g00ecf From ff4c4cf32f993059889d85578e4802f372e768f1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 27 May 2016 21:09:58 -0400 Subject: move everything into build-aux --- automake.head.mk | 56 --------------- automake.tail.mk | 139 ----------------------------------- automake.txt | 164 ------------------------------------------ build-aux/Makefile.README.txt | 164 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 164 insertions(+), 359 deletions(-) delete mode 100644 automake.head.mk delete mode 100644 automake.tail.mk delete mode 100644 automake.txt create mode 100644 build-aux/Makefile.README.txt diff --git a/automake.head.mk b/automake.head.mk deleted file mode 100644 index 431f14d..0000000 --- a/automake.head.mk +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2015-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 . - -_am = am_ - -_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 = $(call _am_relto,.,$1) -am_path = $(foreach p,$1,$(call _am_relto,.,$p)) - -## Declare the default target -all: build -.PHONY: all - -## 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))) - -_am_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile) - -## Empty variables for use by each Makefile -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = - -$(_am)clean_files = -$(_am)slow_files = - -ifeq ($(_am_NO_ONCE),) -include $(topsrcdir)/common.once.head.mk -endif -include $(topsrcdir)/common.each.head.mk diff --git a/automake.tail.mk b/automake.tail.mk deleted file mode 100644 index a24820b..0000000 --- a/automake.tail.mk +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (C) 2015-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 . - -include $(topsrcdir)/common.each.tail.mk - - -# Aggregate variables - -# Add some more defaults to the *_files variables -$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) - -# Now namespace the *_files variables -define _am_save_variables -_am_src_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)src_files)) -_am_gen_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)gen_files)) -_am_cfg_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)cfg_files)) -_am_out_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)out_files)) -_am_sys_files/$(outdir) = $(addprefix $(DESTDIR),$($(_am)sys_files)) -_am_clean_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)clean_files)) -_am_slow_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)slow_files)) -_am_subdirs/$(outdir) = $($(_am)subdirs) -endef -$(eval $(_am_save_variables)) - -# And add them to the $(parent)_*_files variables (if applicable) -define _am_add_subdir -_am_src_files/%(outdir) += $(_am_src_files/%(subdir)) -_am_gen_files/%(outdir) += $(_am_gen_files/%(subdir)) -_am_cfg_files/%(outdir) += $(_am_cfg_files/%(subdir)) -_am_out_files/%(outdir) += $(_am_out_files/%(subdir)) -_am_sys_files/%(outdir) += $(_am_sys_files/%(subdir)) -_am_clean_files/%(outdir) += $(_am_clean_files/%(subdir)) -_am_slow_files/%(outdir) += $(_am_slow_files/%(subdir)) -endef -$(foreach subdir,$(call _am_path,$(addprefix $(outdir)/,$($(_am)subdirs))),$(eval $(subst %(outdir),$(outdir),$(subst %(subdir),$(subdir),$(value _am_add_subdir))))) - -_am_outdirs := $(_am_outdirs) $(outdir) - - -# Do some per-directory magic - -_am_phony = build install uninstall mostlyclean clean distclean maintainer-clean check - -.PHONY: $(addprefix $(outdir)/,$(_am_phony)) - -$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: - $(RM) -- $(sort $(_am_$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) - -# 'build' and 'install' must be defined later, because the -# am_*_files/* variables might not be complete yet. - - -# Include Makefiles from other directories - -define _am_nl - - -endef - -$(foreach _am_NO_ONCE,y,\ - $(foreach makefile,$(foreach dir,$($(_am)subdirs) $($(_am)depdirs),$(call _am_path,$(outdir)/$(dir)/Makefile)),\ - $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) - - -# This only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_am_NO_ONCE),) -# Empty directory-level variables -outdir = /bogus -srcdir = /bogus - -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = -$(_am)clean_files = -$(_am)slow_files = - -_am_clean_files/$(topoutdir) += $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(addprefix $(topoutdir)/,mostlyclean clean distclean maintainer-clean) :: - $(RM) -r -- $(topoutdir)/$(PACKAGE)-$(VERSION) - -define _am_directory_rules -# Constructive phony targets -$(outdir)/build : $(_am_out_files/%(outdir)) -$(outdir)/install: $(_am_sys_files/%(outdir)) -# Destructive phony 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))) -endef -$(foreach outdir,$(_am_outdirs),$(eval $(subst %(outdir),$(outdir),$(value _am_directory_rules)))) - -# Add the `dist` target -.PHONY: dist -dist: $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION) - $(TAR) czf $@ -C $( Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- config.mk.in | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 config.mk.in diff --git a/config.mk.in b/config.mk.in new file mode 100644 index 0000000..f0c75d2 --- /dev/null +++ b/config.mk.in @@ -0,0 +1,92 @@ +# This file is based on §7.2 "Makefile Conventions" of the release of +# the GNU Coding Standards dated April 13, 2016. + +# 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@ + +# 7.2.3 Variables for Specifying Commands +# --------------------------------------- + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# 7.2.5 Variables for Installation Directories +# -------------------------------------------- + +# Root for the installation +prefix = @prefix@ +exec_prefix = @exec_prefix@ +# Executable programs +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +# Data files (Autoconf won't support runstatedir until version 2.70) +datarootdir = @datarootdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +runstatedir = $(localstatedir)/run +# Specific types of files +includedir = @includedir@ +oldincludedir = @oldincludedir@ +docdir = @docdir@ +infodir = @infodir@ +htmldir = @htmldir@ +dvidir = @dvidir@ +pdfdir = @pdfdir@ +psdir = @psdir@ +libdir = @libdir@ +lispdir = $(datarootdir)/emacs/site-lisp +localedir = @localedir@ + +mandir = @mandir@ +man1dir = $(mandir)/man1 +man2dir = $(mandir)/man2 +man3dir = $(mandir)/man3 +man4dir = $(mandir)/man4 +man5dir = $(mandir)/man5 +man6dir = $(mandir)/man6 +man7dir = $(mandir)/man7 +man8dir = $(mandir)/man8 + +manext = .1 +man1ext = .1 +man2ext = .2 +man3ext = .3 +man4ext = .4 +man5ext = .5 +man6ext = .6 +man7ext = .7 +man8ext = .8 -- cgit v1.2.3-54-g00ecf From c959c6b0a235fae077864a494f383285bac0a5b1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 22:53:31 -0400 Subject: stuff --- config.mk.in | 70 +++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/config.mk.in b/config.mk.in index f0c75d2..ffe7c1c 100644 --- a/config.mk.in +++ b/config.mk.in @@ -1,46 +1,68 @@ # This file is based on §7.2 "Makefile Conventions" of the release of # the GNU Coding Standards dated April 13, 2016. +dist.pkgname = @PACKAGE_TARNAME@ +gnu.pkgname = @PACKAGE_NAME@ + +# AC_PROG_{AWK,GREP,EGREP,FGREP,INSTALL,MKDIR_P,SED} # 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@ +CAT = cat +CMP = cmp +CP = cp +DIFF = diff +ECHO = echo EGREP = @EGREP@ -EXPR = @EXPR@ -FALSE = @FALSE@ +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@ +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@ +SLEEP = sleep +SORT = sort +TAR = tar +TEST = test +TOUCH = touch +TR = tr +TRUE = true + +AR = @AR@ +BISON = bison +CC = @CC@ +FLEX = flex +INSTALL = @INSTALL@ +LD = ld +LDCONFIG = ldconfig +LEX = @LEX@ +MAKEINFO = makeinfo +RANLIB = @RANLIB@ +TEXI2DVI = texi2dvi +YACC = @YACC@ # 7.2.3 Variables for Specifying Commands # --------------------------------------- -INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +STRIP = strip +TEXI2HTML = $(MAKEINFO) --html +TEXI2PDF = $(TEXI2DVI) --pdf +TEXI2PS = $(TEXI2DVI) --ps +MKDIR_P = @MKDIR_P@ + # 7.2.5 Variables for Installation Directories # -------------------------------------------- -- cgit v1.2.3-54-g00ecf From 9c11591c59f467be3ca7c2a511ae22de8f5fb2fd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 00:57:02 -0400 Subject: strip out stuff from gnuconf --- build-aux/Makefile.each.tail/11-gnu.mk | 59 ------------ build-aux/Makefile.each.tail/11-gnustuff.mk | 59 ++++++++++++ build-aux/Makefile.once.head/11-gnu.mk | 143 ---------------------------- build-aux/Makefile.once.head/11-gnustuff.mk | 30 ++++++ build-aux/Makefile.once.tail/11-gnu.mk | 17 ---- build-aux/Makefile.once.tail/11-gnustuff.mk | 17 ++++ 6 files changed, 106 insertions(+), 219 deletions(-) delete mode 100644 build-aux/Makefile.each.tail/11-gnu.mk create mode 100644 build-aux/Makefile.each.tail/11-gnustuff.mk delete mode 100644 build-aux/Makefile.once.head/11-gnu.mk create mode 100644 build-aux/Makefile.once.head/11-gnustuff.mk delete mode 100644 build-aux/Makefile.once.tail/11-gnu.mk create mode 100644 build-aux/Makefile.once.tail/11-gnustuff.mk diff --git a/build-aux/Makefile.each.tail/11-gnu.mk b/build-aux/Makefile.each.tail/11-gnu.mk deleted file mode 100644 index c7cb1cb..0000000 --- a/build-aux/Makefile.each.tail/11-gnu.mk +++ /dev/null @@ -1,59 +0,0 @@ -# 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 . - -# 7.2.6: Standard Targets for Users -# --------------------------------- - -std.gen_files += $(foreach f,$(gnu.info_docs), $f.info ) -std.sys_files += $(foreach f,$(gnu.info_docs), $(infodir)/$f.info ) - -$(foreach d,$(gnu.program_dirs),$(eval $(call _gnu.install_program,$d))) -$(foreach d,$(gnu.data_dirs) ,$(eval $(call _gnu.install_data,$d))) - -#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 $(addsuffix /%,$(gnu.program_dirs)),$(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)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< -$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< -#installdirs: std diff --git a/build-aux/Makefile.each.tail/11-gnustuff.mk b/build-aux/Makefile.each.tail/11-gnustuff.mk new file mode 100644 index 0000000..fe76eb8 --- /dev/null +++ b/build-aux/Makefile.each.tail/11-gnustuff.mk @@ -0,0 +1,59 @@ +# 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 . + +# 7.2.6: Standard Targets for Users +# --------------------------------- + +std.gen_files += $(foreach f,$(gnustuff.info_docs), $f.info ) +std.sys_files += $(foreach f,$(gnustuff.info_docs), $(infodir)/$f.info ) + +$(foreach d,$(gnustuff.program_dirs),$(eval $(call _gnustuff.install_program,$d))) +$(foreach d,$(gnustuff.data_dirs) ,$(eval $(call _gnustuff.install_data,$d))) + +#all: std +#install: std +$(outdir)/install-html: $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(htmldir)/$f.html ) +$(outdir)/install-dvi : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) +$(outdir)/install-pdf : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) +$(outdir)/install-ps : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(psdir)/$f.ps ) +#uninstall: std +$(outdir)/install-strip: install + $(STRIP) $(filter $(addsuffix /%,$(gnustuff.program_dirs)),$(std.sys_files/$(@D))) +#clean: std +#distclean: std +#mostlyclean: std +#maintainer-clean: std +TAGS: TODO +$(outdir)/info: $(addsuffix .info,$(gnustuff.info_docs)) +$(outdir)/dvi : $(addsuffix .dvi ,$(gnustuff.info_docs)) +$(outdir)/html: $(addsuffix .html,$(gnustuff.info_docs)) +$(outdir)/pdf : $(addsuffix .pdf ,$(gnustuff.info_docs)) +$(outdir)/ps : $(addsuffix .ps ,$(gnustuff.info_docs)) +#dist:dist +check: TODO +installcheck: TODO +#installdirs: std + +$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< +$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< +#installdirs: std diff --git a/build-aux/Makefile.once.head/11-gnu.mk b/build-aux/Makefile.once.head/11-gnu.mk deleted file mode 100644 index b704a57..0000000 --- a/build-aux/Makefile.once.head/11-gnu.mk +++ /dev/null @@ -1,143 +0,0 @@ -# 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 . - -# 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 - -# 7.2.3 Variables for Specifying Commands -# --------------------------------------- - -INSTALL ?= install -INSTALL_PROGRAM ?= $(INSTALL) -INSTALL_DATA ?= ${INSTALL} -m 644 - -# These aren't specified in the standards, but we use them -STRIP ?= strip -MAKEINFO ?= makeinfo -TEXI2DVI ?= texi2dvi -TEXI2HTML ?= makeinfo --html -TEXI2PDF ?= texi2pdf -TEXI2PS ?= makeinfo --ps -MKDIR_P ?= mkdir -p - -# 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 - -# Other initialization -gnu.info_docs ?= -std.dirlocal += gnu.info_docs - -define _gnu.install_program -$$($1)/%: $$(outdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_PROGRAM) -$$($1)/%: $$(srcdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_PROGRAM) -endef - -define _gnu.install_data -$$($1)/%: $$(outdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_DATA) -$$($1)/%: $$(srcdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_DATA) -endef - -gnu.dirs += $(gnu.program_dirs) $(gnu.data_dirs) diff --git a/build-aux/Makefile.once.head/11-gnustuff.mk b/build-aux/Makefile.once.head/11-gnustuff.mk new file mode 100644 index 0000000..d91832d --- /dev/null +++ b/build-aux/Makefile.once.head/11-gnustuff.mk @@ -0,0 +1,30 @@ +# 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 . + +STRIP ?= strip +TEXI2HTML ?= makeinfo --html +TEXI2PDF ?= texi2pdf +TEXI2PS ?= texi2dvi --ps +MKDIR_P ?= mkdir -p + +gnustuff.program_dirs += $(bindir) $(sbindir) $(libexecdir) +gnustuff.data_dirs += $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) +gnustuff.data_dirs += $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) +gnustuff.data_dirs += $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) + +gnustuff.info_docs ?= +std.dirlocal += gnustuff.info_docs + +gnustuff.dirs += $(gnu.program_dirs) $(gnu.data_dirs) diff --git a/build-aux/Makefile.once.tail/11-gnu.mk b/build-aux/Makefile.once.tail/11-gnu.mk deleted file mode 100644 index df5f192..0000000 --- a/build-aux/Makefile.once.tail/11-gnu.mk +++ /dev/null @@ -1,17 +0,0 @@ -# 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 . - -$(gnu.dirs): - $(MKDIR_P) $@ diff --git a/build-aux/Makefile.once.tail/11-gnustuff.mk b/build-aux/Makefile.once.tail/11-gnustuff.mk new file mode 100644 index 0000000..df5f192 --- /dev/null +++ b/build-aux/Makefile.once.tail/11-gnustuff.mk @@ -0,0 +1,17 @@ +# 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 . + +$(gnu.dirs): + $(MKDIR_P) $@ -- cgit v1.2.3-54-g00ecf From 081f7d3c73c212ddb239c81ce27940771da593f8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 11:16:48 -0400 Subject: add install rule, add missing at.phony definitions --- build-aux/Makefile.each.tail/11-gnustuff.mk | 3 ++- build-aux/Makefile.once.head/11-gnustuff.mk | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build-aux/Makefile.each.tail/11-gnustuff.mk b/build-aux/Makefile.each.tail/11-gnustuff.mk index fe76eb8..790efad 100644 --- a/build-aux/Makefile.each.tail/11-gnustuff.mk +++ b/build-aux/Makefile.each.tail/11-gnustuff.mk @@ -23,7 +23,8 @@ $(foreach d,$(gnustuff.program_dirs),$(eval $(call _gnustuff.install_program,$d) $(foreach d,$(gnustuff.data_dirs) ,$(eval $(call _gnustuff.install_data,$d))) #all: std -#install: std +install: + $(foreach f,$(gnustuff.info_docs),$(INSTALL_INFO) $(DESTDIR)$(infodir)/$f.info $(DESTDIR)$(infodir)/dir$(at.nl)) $(outdir)/install-html: $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(htmldir)/$f.html ) $(outdir)/install-dvi : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) $(outdir)/install-pdf : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) diff --git a/build-aux/Makefile.once.head/11-gnustuff.mk b/build-aux/Makefile.once.head/11-gnustuff.mk index d91832d..800f6d2 100644 --- a/build-aux/Makefile.once.head/11-gnustuff.mk +++ b/build-aux/Makefile.once.head/11-gnustuff.mk @@ -28,3 +28,7 @@ gnustuff.info_docs ?= std.dirlocal += gnustuff.info_docs gnustuff.dirs += $(gnu.program_dirs) $(gnu.data_dirs) + +at.phony += install-html install-dvi install-pdf install-ps +at.phony += info html dvi pdf ps +at.phony += install-strip -- cgit v1.2.3-54-g00ecf From c8c1b794b51ef20646cb6d30702cb79dee3248ea Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 20:26:00 -0400 Subject: Turn the master branch into just a README --- README.md | 283 ++++++++++++++++++++++++++++++++++++++++++ build-aux/Makefile.README.txt | 164 ------------------------ 2 files changed, 283 insertions(+), 164 deletions(-) create mode 100644 README.md delete mode 100644 build-aux/Makefile.README.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..e7606eb --- /dev/null +++ b/README.md @@ -0,0 +1,283 @@ +Autothing +========= + +Autothing is a set of Makefile fragments that you can `include` in +your GNU Makefiles to provide two core things: + + 1. Make it _easy_ to write non-recursive Makefiles. (search for the + paper "Recursive Make Considered Harmful") + 2. Provide boilerplate for standard features people expect to be + implemented in Makefiles. + +Between these two, it should largely obviate GNU Automake in your +projects. + +The recommended including Autothing into your project is to add the +autothing repository as a `git` remote, and merge the `core` branch, +and whichever `mod-*` module branches you want into your project's +branch. + +| module name | dependencies | description | +|-------------+--------------+--------------------------------------------------------------------------------------------------| +| at | | The core of Autothing | +|-------------+--------------+--------------------------------------------------------------------------------------------------| +| std | at | Provide .PHONY targets: all/build/install/uninstall/mostlyclean/clean/distclean/maintainer-clean | +| dist | std | Provide .PHONY target: dist | +| gnuconf | dist | Provide default values for user-variables from the GNU Coding Standards' Makefile Conventions | +| gnustuff | gnuconf | Provide remaining stuff from the GNU Coding Standards' Makefile Conventions | + +Core (psuedo-module: at) +------------------------ + +As harmful as recursive make is, it's historically been difficult to +to write non-recursive Makefiles. The goal of the core of Autothing +is to make it easy. + +In each source directory, you write a `Makefile`, very similarly to if +you were writing for plain GNU Make, with the form: + + topoutdir ?= ... + topsrcdir ?= ... + include $(topsrcdir)/build-aux/Makefile.head.mk + + # your makefile + + include $(topsrcdir)/build-aux/Makefile.tail.mk + +| at.path | Use $(call at.path,FILENAME1 FILENAME2...) sanitize filenames that are not in the current Makefile's directory or its children | +| at.nl | A newline, for convenience, since it is difficult to type a newline in GNU Make expressions | + +| at.dirlocal | Which variables to apply the namespacing mechanism to | +| at.phony | Which targets to mark as .PHONY, and have automatic recursive dependencies | +| at.subdirs | Which directories to consider as children of this one | +| at.depdirs | Which directories are't subdirs, but may contain dependencies of targets in this directory | + +outdir +srcdir + +Module: std +----------- + +| Variable | Create Command | Delete Command | Description | Relative to | +|---------------+----------------+-----------------------------+-----------------------------------+-------------| +| std.src_files | emacs | rm -rf . | Files that the developer writes | srcdir | +| std.gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | +| std.cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | +| std.out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | +| std.sys_files | make install | make uninstall | Files the user installs | DESTDIR | + +In addition, there are two more variables that control not how files +are created, but how they are deleted: + +| Variable | Affected command | Description | Relative to | +|-----------------+------------------+------------------------------------------------+-------------| +| std.clean_files | make clean | A list of things to `rm` in addition to the | outdir | +| | | files in `$(std.out_files)`. (Example: `*.o`) | | +|-----------------+------------------+------------------------------------------------+-------------| +| std.slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | +| | | _not_ be deleted. (otherwise, `mostlyclean` | | +| | | is the same as `clean`) | | + +| Variable | Default | Description | +|----------+----------+-------------| +| DESTDIR | | | +|----------+----------+-------------| +| RM | rm -f | | +| RMDIR_P | rmdir -p | | +| TRUE | true | | + +Module: dist +------------ + +The `dist` module produces distribution tarballs + +| Variable | Default | Description | +|--------------+------------+-------------| +| dist.exts | .tar.gz | | +| dist.pkgname | $(PACKAGE) | | +| dist.version | $(VERSION) | | + +| Variable | Default | Description | +|-----------+-------------+----------------------------------------------------| +| CP | cp | | +| GZIP | gzip | | +| MKDIR | mkdir | | +| MKDIR_P | mkdir -p | | +| MV | mv | | +| RM | rm -f | | +| TAR | tar | | +|-----------+-------------+----------------------------------------------------| +| GZIPFLAGS | $(GZIP_ENV) | | +| GZIP_ENV | --best | Because of GNU Automake, users expect this to work | + +Module: gnuconf +--------------- + +The `gnuconf` module provides default values for user-facing toggles +required by the GNU Coding Standards. + +There is only one developer configuration option: + +| Variable | Default | Description | +|-----------------+------------+-----------------------------------------------| +| gnuconf.pkgname | $(PACKAGE) | The package name to use in the default docdir | + +There is an extensive list of user configuration options: + +| Variable | Default | Description | +|-----------------+---------------------------------------+-------------------------------------------| +| 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 | | +|-----------------+---------------------------------------+-------------------------------------------| +| AR | ar | | +| ARFLAGS | | | +| BISON | bison | | +| BISONFLAGS | | | +| CC | cc | | +| CCFLAGS | $(CFLAGS) | | +| FLEX | flex | | +| FLEXFLAGS | | | +| INSTALL | install | | +| INSTALLFLAGS | | | +| LD | ld | | +| LDFLAGS | | | +| LDCONFIG | ldconfig | TODO: detect absence, fall back to `true` | +| LDCONFIGFLAGS | | | +| LEX | lex | | +| LEXFLAGS | $(LFLAGS) | | +| MAKEINFO | makeinfo | | +| MAKEINFOFLAGS | | | +| RANLIB | ranlib | TODO: detect absence, fall back to `true` | +| RANLIBFLAGS | | | +| TEXI2DVI | texi2dvi | | +| TEXI2DVIFLAGS | | | +| YACC | yacc | | +| YACCFLAGS | $(YFLAGS) | | +|-----------------+---------------------------------------+-------------------------------------------| +| CFLAGS | | | +| LFLAGS | | | +| YFLAGS | | | +|-----------------+---------------------------------------+-------------------------------------------| +| LN_S | ln -s | TODO: detect when to fall back to `cp` | +|-----------------+---------------------------------------+-------------------------------------------| +| CHGRP | chgrp | | +| CHMOD | chmod | | +| CHOWN | chown | | +| MKNOD | mknod | | +|-----------------+---------------------------------------+-------------------------------------------| +| INSTALL_PROGRAM | $(INSTALL) | | +| INSTALL_DATA | ${INSTALL} -m 644 | | +|-----------------+---------------------------------------+-------------------------------------------| +| prefix | /usr/local | | +| exec_prefix | $(prefix) | | +|-----------------+---------------------------------------+-------------------------------------------| +| bindir | $(exec_prefix)/bin | | +| sbindir | $(exec_prefix)/sbin | | +| libexecdir | $(exec_prefix)/libexec | | +|-----------------+---------------------------------------+-------------------------------------------| +| datadir | $(datarootdir) | | +| sysconfdir | $(prefix)/etc | | +| sharedstatedir | $(prefix)/com | | +| localstatedir | $(prefix)/var | | +| runstatedir | $(localstatedir)/run | | +|-----------------+---------------------------------------+-------------------------------------------| +| includedir | $(prefix)/include | | +| oldincludedir | /usr/include | | +| docdir | $(datarootdir)/doc/$(gnuconf.pkgname) | | +| infodir | $(datarootdir)/info | | +| htmldir | $(docdir) | | +| dvidir | $(docdir) | | +| pdfdir | $(docdir) | | +| psdir | $(docdir) | | +| libdir | $(exec_prefix)/lib | | +| lispdir | $(datarootdir)/emacs/site-lisp | | +| localedir | $(datarootdir)/locale | | +|-----------------+---------------------------------------+-------------------------------------------| +| 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 | | +|-----------------+---------------------------------------+-------------------------------------------| +| manext | .1 | | +| man1ext | .1 | | +| man2ext | .2 | | +| man3ext | .3 | | +| man4ext | .4 | | +| man5ext | .5 | | +| man6ext | .6 | | +| man7ext | .7 | | +| man8ext | .8 | | + +Module: gnustuff +---------------- + +This is a poorly-thought-out module implementing remaining things from +the GNU Coding Standards. + +This is poorly thought out and poorly tested because it's basically +the part of the GNU Coding Standards that I don't use. + +Developer configuration options: + +| Variable | Default | Description | +|-----------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------| +| gnustuff.info_docs | | The list of texinfo documents in the current directory, without the `.texi` suffix. | +| gnustuff.program_dirs | $(bindir) $(sbindir) $(libexecdir) | Directories to use $(INSTALL_PROGRAM) for inserting files into. | +| gnustuff.data_dirs | | Directories to use $(INSTALL_DATA) for inserting files into. | +| gnustuff.dirs | $(gnustuff.program_dirs) $(gnustuff.data_dirs) | Directories to create | + +User configuration options: + +| Variable | Default | Description | +|-----------+-----------------+-------------| +| STRIP | strip | | +| TEXI2HTML | makeinfo --html | | +| TEXI2PDF | texi2pdf | | +| TEXI2PS | texi2dvi --ps | | +| MKDIR_P | mkdir -p | | + +It provides several `.phony` targets: + - install-{html,dvi,pdf,ps} + - install-strip + - {info,html,dvi,pdf,ps} + - TAGS + - check + - installcheck + +It also augments the `std` `install` rule to run $(INSTALL_INFO) as +necessary. + +And several real rules: + - How to install files into any of the $(gnustuff.program_dirs) or + $(gnustuff.data_dirs). + - How to generate info, dvi, html, pdf, and ps files from texi files. diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt deleted file mode 100644 index 935af5f..0000000 --- a/build-aux/Makefile.README.txt +++ /dev/null @@ -1,164 +0,0 @@ -Luke's AutoMake -=============== - -Yo, this document is incomplete. It describes the magical -automake.{head,tail}.mk Makefiles and how to use them, kinda. - -I wrote a "clone" of automake. I say clone, because it works -differently. Yeah, I need a new name for it. - -High-level overview -------------------- - -Now, what this does for you is: - -It makes it _easy_ to write non-recursive Makefiles--and ones that are -similar to plain recursive Makefiles, at that! (search for the paper -"Recursive Make Considered Harmful") As harmful as recursive make is, -it's historically been difficult to to write non-recursive Makefiles. -This makes it easy. - -It also makes it easy to follow the GNU standards for your makefiles: -it takes care of this entire table of .PHONY targets for you: - -| this | and this | are aliases for this | -|------+------------------+--------------------------------------------------------| -| all | build | $(outdir)/build | -| | install | $(outdir)/install | -| | uninstall | $(outdir)/uninstall | -| | mostlyclean | $(outdir)/mostlyclean | -| | clean | $(outdir)/clean | -| | distclean | $(outdir)/distclean | -| | maintainer-clean | $(outdir)/maintainer-clean | -| | check | $(outdir)/check (not implemented for you) | -| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) | - -(You are still responsible for implementing the `$(outdir)/check` -target in each of your Makefiles.) - -What you have to do is: - -In each source directory, you write a `Makefile`, very similarly to if -you were writing for plain GNU Make, with - - topoutdir ?= ... - topsrcdir ?= ... - include $(topsrcdir)/automake.head.mk - - # your makefile - - include $(topsrcdir)/automake.tail.mk - -And in the top-level source directory, Write your own helper makefiles -that get included: - - `common.once.head.mk`: before parsing any of your Makefiles - - `common.each.head.mk`: before parsing each of your Makefiles - - `common.each.tail.mk`: after parsing each of your Makefiles - - `common.each.tail.mk`: after parsing all of your Makefiles - -The `common.*.mk` makefiles are nice for including generic pattern -rules and variables that aren't specific to a directory. - -You're probably thinking that this sounds too good to be true! -Unfortunately, there are two major deviations from writing a plain -recursive Makefile: - - 1. all targets and prerequisites (including .PHONY targets!) need to - be prefixed with - `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`. - * sub-gotcha: this means that if a pattern rule has a - prerequisite that may be in srcdir or outdir, then it must be - specified twice, once for each case. - 2. if a prerequisite is in a directory "owned" by another Makefile, - you must filter the pathname through `am_path`: - `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain - a `..` segment; if you need to refer to a sibling directory, do it - relative to `$(topoutdir)` or `$(topsrcdir)`. - -Telling automake about your program ------------------------------------ - -You tell automake what to do for you by setting some variables. They -are all prefixed with `am_`; this prefix may be changed by editing the -`_am` variable at the top of `automake.head.mk`. - -The exception to this is the `am_path` variable, which is a macro that -is used to make a list of filenames relative to the appropriate -directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't -nescessarily equal to `.`. See above. - -There are several commands that generate files; simply record the list -of files that each command generates as the following variable -variables: - -| Variable | Create Command | Delete Command | Description | Relative to | -|--------------+----------------+-----------------------------+-----------------------------------+-------------| -| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir | -| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | -| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | -| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | -| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR | - -In addition, there are two more variables that control not how files -are created, but how they are deleted: - -| Variable | Affected command | Description | Relative to | -|----------------+------------------+------------------------------------------------+-------------| -| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir | -| | | files in `$(am_out_files)`. (Example: `*.o`) | | -|----------------+------------------+------------------------------------------------+-------------| -| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | -| | | _not_ be deleted. (otherwise, `mostlyclean` | | -| | | is the same as `clean`) | | - -Finally, there are two variables that express the relationships -between directories: - -| Variable | Description | -|------------+---------------------------------------------------------| -| am_subdirs | A list of other directories (containing Makefiles) that | -| | may be considered "children" of this | -| | directory/Makefile; building a phony target in this | -| | directory should also build it in the subdirectory. | -| | They are not necesarily actually subdirectories of this | -| | directory in the filesystem. | -|------------+---------------------------------------------------------| -| am_depdirs | A list of other directories (containing Makefiles) that | -| | contain or generate files that are dependencies of | -| | targets in this directory. They are not necesarily | -| | actually subdirectories of this directory in the | -| | filesystem. Except for files that are dependencies of | -| | files in this directory, things in the dependency | -| | directory will not be built. | - -Tips, notes ------------ - -I like to have the first (non-comment) line in a Makefile be: - - include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk - -(adjusting the number of `../` sequences as nescessary). Then, my -(user-editable) `config.mk` is of the form: - - ifeq ($(topsrcdir),) - topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) - topsrcdir := $(topoutdir) - - # your configuration - - endif - -If the package has a `./configure` script, then I have it modifiy -topsrcdir as necessary, as well as modifying whatever other parts of -the configuration. All of the configuration lives in `config.mk`; -`./configure` doesn't modify any `Makefile`s, it just generates -`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to -`$(outdir)/Makefile`. - ----- -Copyright (C) 2016 Luke Shumaker - -This documentation file is placed into the public domain. If that is -not possible in your legal system, I grant you permission to use it in -absolutely every way that I can legally grant to you. -- cgit v1.2.3-54-g00ecf From 0bb5183e4e1ac300e8b7f38477a0e12d7d0d3df5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 12:51:31 -0400 Subject: (systemd) f --- build-aux/Makefile.once.head/00-gnuconf.mk | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/00-gnuconf.mk index 79ecc34..8e10f04 100644 --- a/build-aux/Makefile.once.head/00-gnuconf.mk +++ b/build-aux/Makefile.once.head/00-gnuconf.mk @@ -64,7 +64,7 @@ CCFLAGS ?= $(CFLAGS) FLEX ?= flex FLEXFLAGS ?= INSTALL ?= install -INSTALLFLAGS ?= +#INSTALLFLAGS ?= LD ?= ld LDFLAGS ?= LDCONFIG ?= ldconfig #TODO @@ -92,14 +92,14 @@ CHMOD ?= chmod CHOWN ?= chown MKNOD ?= mknod -# 7.2.3 Variables for Specifying Commands -# --------------------------------------- +# 7.2.3: Variables for Specifying Commands +# ---------------------------------------- INSTALL_PROGRAM ?= $(INSTALL) INSTALL_DATA ?= ${INSTALL} -m 644 -# 7.2.5 Variables for Installation Directories -# -------------------------------------------- +# 7.2.5: Variables for Installation Directories +# --------------------------------------------- # Root for the installation prefix ?= /usr/local @@ -147,3 +147,14 @@ man5ext ?= .5 man6ext ?= .6 man7ext ?= .7 man8ext ?= .8 + +# 7.2.7: Install Command Categories +# --------------------------------- + +PRE_INSTALL ?= +POST_INSTALL ?= +NORMAL_INSTALL ?= + +PRE_UNINSTALL ?= +POST_UNINSTALL ?= +NORMAL_UNINSTALL ?= -- cgit v1.2.3-54-g00ecf From 786d22b74eaac27ae4c93d35e7b7718ad7d25af6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2016 13:02:33 -0400 Subject: (systemd) new autothing --- automake.head.mk | 56 ------------ automake.tail.mk | 140 ----------------------------- build-aux/Makefile.once.head/00-dist.mk | 4 +- build-aux/Makefile.once.head/00-gnuconf.mk | 2 +- 4 files changed, 3 insertions(+), 199 deletions(-) delete mode 100644 automake.head.mk delete mode 100644 automake.tail.mk diff --git a/automake.head.mk b/automake.head.mk deleted file mode 100644 index 431f14d..0000000 --- a/automake.head.mk +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2015-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 . - -_am = am_ - -_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 = $(call _am_relto,.,$1) -am_path = $(foreach p,$1,$(call _am_relto,.,$p)) - -## Declare the default target -all: build -.PHONY: all - -## 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))) - -_am_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile) - -## Empty variables for use by each Makefile -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = - -$(_am)clean_files = -$(_am)slow_files = - -ifeq ($(_am_NO_ONCE),) -include $(topsrcdir)/common.once.head.mk -endif -include $(topsrcdir)/common.each.head.mk diff --git a/automake.tail.mk b/automake.tail.mk deleted file mode 100644 index ba31935..0000000 --- a/automake.tail.mk +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright (C) 2015-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 . - -include $(topsrcdir)/common.each.tail.mk - - -# Aggregate variables - -# Add some more defaults to the *_files variables -$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) - -# Now namespace the *_files variables -define _am_save_variables -_am_src_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)src_files)) -_am_gen_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)gen_files)) -_am_cfg_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)cfg_files)) -_am_out_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)out_files)) -_am_sys_files/$(outdir) = $(addprefix $(DESTDIR),$($(_am)sys_files)) -_am_clean_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)clean_files)) -_am_slow_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)slow_files)) -_am_subdirs/$(outdir) = $($(_am)subdirs) -endef -$(eval $(_am_save_variables)) - -# And add them to the $(parent)_*_files variables (if applicable) -define _am_add_subdir -_am_src_files/%(outdir) += $(_am_src_files/%(subdir)) -_am_gen_files/%(outdir) += $(_am_gen_files/%(subdir)) -_am_cfg_files/%(outdir) += $(_am_cfg_files/%(subdir)) -_am_out_files/%(outdir) += $(_am_out_files/%(subdir)) -_am_sys_files/%(outdir) += $(_am_sys_files/%(subdir)) -_am_clean_files/%(outdir) += $(_am_clean_files/%(subdir)) -_am_slow_files/%(outdir) += $(_am_slow_files/%(subdir)) -endef -$(foreach subdir,$(call _am_path,$(addprefix $(outdir)/,$($(_am)subdirs))),$(eval $(subst %(outdir),$(outdir),$(subst %(subdir),$(subdir),$(value _am_add_subdir))))) - -_am_outdirs := $(_am_outdirs) $(outdir) - - -# Do some per-directory magic - -_am_phony = build install uninstall mostlyclean clean distclean maintainer-clean check - -.PHONY: $(addprefix $(outdir)/,$(_am_phony)) - -$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: - $(RM) -- $(filter-out %/,$(sort $(_am_$(@F)/$(@D)))) - $(RM) -r -- $(filter %/,$(sort $(_am_$(@F)/$(@D)))) - $(RMDIRS) $(sort $(dir $(patsubst %/,%,$(_am_$(@F)/$(@D))))) 2>/dev/null || $(TRUE) - -# 'build' and 'install' must be defined later, because the -# am_*_files/* variables might not be complete yet. - - -# Include Makefiles from other directories - -define _am_nl - - -endef - -$(foreach _am_NO_ONCE,y,\ - $(foreach makefile,$(foreach dir,$($(_am)subdirs) $($(_am)depdirs),$(call _am_path,$(outdir)/$(dir)/Makefile)),\ - $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) - - -# This only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_am_NO_ONCE),) -# Empty directory-level variables -outdir = /bogus -srcdir = /bogus - -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = -$(_am)clean_files = -$(_am)slow_files = - -_am_clean_files/$(topoutdir) += $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(addprefix $(topoutdir)/,mostlyclean clean distclean maintainer-clean) :: - $(RM) -r -- $(topoutdir)/$(PACKAGE)-$(VERSION) - -define _am_directory_rules -# Constructive phony targets -$(outdir)/build : $(_am_out_files/%(outdir)) -$(outdir)/install: $(_am_sys_files/%(outdir)) -# Destructive phony 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))) -endef -$(foreach outdir,$(_am_outdirs),$(eval $(subst %(outdir),$(outdir),$(value _am_directory_rules)))) - -# Add the `dist` target -.PHONY: dist -dist: $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION) - $(TAR) czf $@ -C $( Date: Wed, 1 Jun 2016 14:51:05 -0400 Subject: (systemd) I think I accidentally rm'ed this while messing with .gitignore --- build-aux/Makefile.each.tail/20-systemd.mk | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 build-aux/Makefile.each.tail/20-systemd.mk diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk new file mode 100644 index 0000000..89a8739 --- /dev/null +++ b/build-aux/Makefile.each.tail/20-systemd.mk @@ -0,0 +1,3 @@ +-include $(outdir)/$(DEPDIR)/*.P* +std.clean_files += *.o *.lo .deps/ .libs/ +include $(topsrcdir)/am-pat-rules.mk -- cgit v1.2.3-54-g00ecf From dd84a8ab8f67cbc94aa3a427693970dbf3797e23 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2016 16:09:26 -0400 Subject: (systemd) tidy --- build-aux/Makefile.each.tail/20-systemd.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk index 89a8739..8f2f612 100644 --- a/build-aux/Makefile.each.tail/20-systemd.mk +++ b/build-aux/Makefile.each.tail/20-systemd.mk @@ -1,3 +1,15 @@ -include $(outdir)/$(DEPDIR)/*.P* + std.clean_files += *.o *.lo .deps/ .libs/ -include $(topsrcdir)/am-pat-rules.mk + +$(outdir)/%.o: $(srcdir)/%.c | $(outdir)/.deps + $(AM_V_CC)$(COMPILE) -c -o $@ $< + +$(outdir)/%.lo: $(srcdir)/%.c | $(outdir)/.deps + $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< + +$(outdir)/.deps: + $(AM_V_at)$(MKDIR_P) $@ + +$(outdir)/%.la: + $(AM_V_CCLD)$(LINK) $(filter-out .var%,$^) -- cgit v1.2.3-54-g00ecf From 1c5a4e839cf68c45d7b2a15bd5f64290d2154118 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2016 16:14:57 -0400 Subject: (systemd) Be a little tougher with --no-builtin-variables --- build-aux/no-builtin-variables.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 build-aux/no-builtin-variables.mk diff --git a/build-aux/no-builtin-variables.mk b/build-aux/no-builtin-variables.mk new file mode 100644 index 0000000..c3aef58 --- /dev/null +++ b/build-aux/no-builtin-variables.mk @@ -0,0 +1,15 @@ +MAKEFLAGS += --no-builtin-variables + +# This version is more correct, but is slower: +# $(foreach v,$(shell bash -c 'comm -23 <(env -i $(MAKE) -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort) <(env -i $(MAKE) -R -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort)'), +# $(if $(filter default,$(origin $v)),$(eval undefine $v))) + +_default_variables = $(foreach v,$(.VARIABLES),$(if $(filter default,$(origin $v)),$v)) +$(foreach v,$(filter-out .% MAKE% SUFFIXES,$(_default_variables))\ + $(filter .LIBPATTERNS MAKEINFO,$(_default_variables)),\ + $(eval undefine $v)) +undefine _default_variables + +# Because Make uses .LIBPATTERNS internally, it should always be +# defined in case --warn-undefined-variables +.LIBPATTERNS ?= -- cgit v1.2.3-54-g00ecf From 855a912a9f029cf66a757dbfc25d0aa7181a6dbf Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2016 17:18:06 -0400 Subject: (systemd) get libbasic to build again --- build-aux/Makefile.each.tail/20-systemd.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk index 8f2f612..fa0bd9e 100644 --- a/build-aux/Makefile.each.tail/20-systemd.mk +++ b/build-aux/Makefile.each.tail/20-systemd.mk @@ -2,10 +2,10 @@ std.clean_files += *.o *.lo .deps/ .libs/ -$(outdir)/%.o: $(srcdir)/%.c | $(outdir)/.deps +$(outdir)/%.o: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps $(AM_V_CC)$(COMPILE) -c -o $@ $< -$(outdir)/%.lo: $(srcdir)/%.c | $(outdir)/.deps +$(outdir)/%.lo: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< $(outdir)/.deps: -- cgit v1.2.3-54-g00ecf From 7a2cf8e049e04865caefaec838507cee227c82b9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2016 18:48:01 -0400 Subject: (systemd) stuff --- build-aux/Makefile.each.tail/20-systemd.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk index fa0bd9e..48963c2 100644 --- a/build-aux/Makefile.each.tail/20-systemd.mk +++ b/build-aux/Makefile.each.tail/20-systemd.mk @@ -13,3 +13,6 @@ $(outdir)/.deps: $(outdir)/%.la: $(AM_V_CCLD)$(LINK) $(filter-out .var%,$^) + +$(DESTDIR)$(libdir)/%.so: $(outdir)/%.la + $(LIBTOOL) $(ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $< $(@D) -- cgit v1.2.3-54-g00ecf From 9e6e4290fe8cc630da40f3d66420928a2305da28 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jun 2016 19:26:04 -0400 Subject: (systemd) Merge branch 'lukeshu/postmove' into lukeshu/master # Conflicts: # build-aux/Makefile.each.tail/20-systemd.mk --- build-aux/Makefile.each.tail/20-systemd.mk | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 build-aux/Makefile.each.tail/20-systemd.mk diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk deleted file mode 100644 index 48963c2..0000000 --- a/build-aux/Makefile.each.tail/20-systemd.mk +++ /dev/null @@ -1,18 +0,0 @@ --include $(outdir)/$(DEPDIR)/*.P* - -std.clean_files += *.o *.lo .deps/ .libs/ - -$(outdir)/%.o: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps - $(AM_V_CC)$(COMPILE) -c -o $@ $< - -$(outdir)/%.lo: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps - $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< - -$(outdir)/.deps: - $(AM_V_at)$(MKDIR_P) $@ - -$(outdir)/%.la: - $(AM_V_CCLD)$(LINK) $(filter-out .var%,$^) - -$(DESTDIR)$(libdir)/%.so: $(outdir)/%.la - $(LIBTOOL) $(ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $< $(@D) -- cgit v1.2.3-54-g00ecf From b8dd4cd68e0d3b09a53b602306e587cbfd4ecedf Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 4 Jun 2016 17:06:17 -0400 Subject: (systemd) stuff --- build-aux/Makefile.tail.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index dfbad5a..b1c5045 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -18,7 +18,7 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) at.subdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.subdirs))) -at.depdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.depdirs))) +at.depdirs := $(at.depdirs) # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) -- cgit v1.2.3-54-g00ecf From 887efad351ba773c69020379cdaf47598d715291 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 7 Jun 2016 01:56:30 -0400 Subject: (systemd) stuff --- build-aux/Makefile.each.tail/30-module.mk | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 build-aux/Makefile.each.tail/30-module.mk diff --git a/build-aux/Makefile.each.tail/30-module.mk b/build-aux/Makefile.each.tail/30-module.mk new file mode 100644 index 0000000..10ebc4c --- /dev/null +++ b/build-aux/Makefile.each.tail/30-module.mk @@ -0,0 +1,4 @@ +dir_variables = $(foreach v,$(filter-out _%,$(patsubst %/$(@D),%,$(filter %/$(@D),$(.VARIABLES)))),$(if $(findstring /,$v),, $v)) +$(outdir)/directory-info: + $(AM_V_at)printf '%s = %s\n' $(foreach v,$(dir_variables),'$v' '$($v/$(@D))') | sort | column -s= -o= -t +.PHONY: $(outdir)/module-info -- cgit v1.2.3-54-g00ecf From 544821d744e54882d74f8090b30cd1c0dfe8b6fd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 7 Jun 2016 02:38:08 -0400 Subject: (systemd) Makefile tidy --- build-aux/Makefile.each.tail/30-directory-info.mk | 4 ++++ build-aux/Makefile.each.tail/30-module.mk | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 build-aux/Makefile.each.tail/30-directory-info.mk delete mode 100644 build-aux/Makefile.each.tail/30-module.mk diff --git a/build-aux/Makefile.each.tail/30-directory-info.mk b/build-aux/Makefile.each.tail/30-directory-info.mk new file mode 100644 index 0000000..10ebc4c --- /dev/null +++ b/build-aux/Makefile.each.tail/30-directory-info.mk @@ -0,0 +1,4 @@ +dir_variables = $(foreach v,$(filter-out _%,$(patsubst %/$(@D),%,$(filter %/$(@D),$(.VARIABLES)))),$(if $(findstring /,$v),, $v)) +$(outdir)/directory-info: + $(AM_V_at)printf '%s = %s\n' $(foreach v,$(dir_variables),'$v' '$($v/$(@D))') | sort | column -s= -o= -t +.PHONY: $(outdir)/module-info diff --git a/build-aux/Makefile.each.tail/30-module.mk b/build-aux/Makefile.each.tail/30-module.mk deleted file mode 100644 index 10ebc4c..0000000 --- a/build-aux/Makefile.each.tail/30-module.mk +++ /dev/null @@ -1,4 +0,0 @@ -dir_variables = $(foreach v,$(filter-out _%,$(patsubst %/$(@D),%,$(filter %/$(@D),$(.VARIABLES)))),$(if $(findstring /,$v),, $v)) -$(outdir)/directory-info: - $(AM_V_at)printf '%s = %s\n' $(foreach v,$(dir_variables),'$v' '$($v/$(@D))') | sort | column -s= -o= -t -.PHONY: $(outdir)/module-info -- cgit v1.2.3-54-g00ecf From f602c8fe063392e9f38390c6eb0816bef85063ac Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 11:12:23 -0400 Subject: (systemd) add at.addprefix, a safe root-aware addprefix for directories --- build-aux/Makefile.head.mk | 7 ++++++- build-aux/Makefile.tail.mk | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 63a3462..47c17c9 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -34,11 +34,16 @@ at.relto = $(foreach p,$2,$(call _at.relto,$1,$p)) # itself. at.path = $(call at.relto,.,$1) +_at.addprefix = $(if $(filter /%,$2),$2,$1/$2) +at.addprefix = $(call at.path,$(foreach f,$2, $(call _at.addprefix,$1,$f) )) + define at.nl endef +at.Makefile ?= Makefile + _at.rest = $(wordlist 2,$(words $1),$1) _at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) @@ -56,7 +61,7 @@ endif # _at.NO_ONCE outdir := $(call at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir))) -_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/Makefile) +_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/$(at.Makefile)) $(foreach v,$(at.dirlocal),$(eval $v=)) diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index b1c5045..be3a8c2 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,8 +17,8 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -at.subdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.subdirs))) -at.depdirs := $(at.depdirs) +at.subdirs := $(call at.addprefix,$(outdir)/,$(at.subdirs)) +at.depdirs := $(call at.addprefix,$(outdir)/,$(at.depdirs)) # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) @@ -35,7 +35,7 @@ $(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outd # Include Makefiles from other directories $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call at.path,$(addsuffix /Makefile,$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ + $(foreach makefile,$(call at.path,$(addsuffix /$(at.Makefile),$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read -- cgit v1.2.3-54-g00ecf From 624be97781dfd9060e5d0c6341c8c21e95b8c47b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 11:12:40 -0400 Subject: (systemd) use at.addprefix --- build-aux/Makefile.each.tail/10-std.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index 5150a71..ca78f3c 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -19,13 +19,13 @@ std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) $(foreach c,src gen cfg out sys clean slow,$(eval std.$c_files := $$(std.$c_files))) # Make each of the standard variables relative to the correct directory -std.src_files := $(patsubst ./%,%,$(addprefix $(srcdir)/,$(std.src_files))) -std.gen_files := $(patsubst ./%,%,$(addprefix $(srcdir)/,$(std.gen_files))) -std.cfg_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.cfg_files))) -std.out_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.out_files))) -std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) -std.clean_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.clean_files))) -std.slow_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.slow_files))) +std.src_files := $(call at.addprefix,$(srcdir)/,$(std.src_files)) +std.gen_files := $(call at.addprefix,$(srcdir)/,$(std.gen_files)) +std.cfg_files := $(call at.addprefix,$(outdir)/,$(std.cfg_files)) +std.out_files := $(call at.addprefix,$(outdir)/,$(std.out_files)) +std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) +std.clean_files := $(call at.addprefix,$(outdir)/,$(std.clean_files)) +std.slow_files := $(call at.addprefix,$(outdir)/,$(std.slow_files)) # Creative targets $(outdir)/build : $(std.out_files) -- cgit v1.2.3-54-g00ecf From 893a5768ae55d8f739eb3e61f52494741495a625 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 11:29:44 -0400 Subject: (systemd) at.addprefix: fix --- build-aux/Makefile.head.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 47c17c9..11b1374 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -35,7 +35,7 @@ at.relto = $(foreach p,$2,$(call _at.relto,$1,$p)) at.path = $(call at.relto,.,$1) _at.addprefix = $(if $(filter /%,$2),$2,$1/$2) -at.addprefix = $(call at.path,$(foreach f,$2, $(call _at.addprefix,$1,$f) )) +at.addprefix = $(foreach f,$2, $(addsuffix $(if $(filter %/,$f),/),$(call at.path,$(call _at.addprefix,$1,$f)) )) define at.nl -- cgit v1.2.3-54-g00ecf From edaf4f48d0844a6d606debbb478c39ba8ba02b7e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 12:25:04 -0400 Subject: (systemd) fixity --- build-aux/Makefile.tail.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index be3a8c2..38f40c2 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,13 +17,14 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -at.subdirs := $(call at.addprefix,$(outdir)/,$(at.subdirs)) -at.depdirs := $(call at.addprefix,$(outdir)/,$(at.depdirs)) - # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) $(foreach v,$(at.dirlocal),$(eval undefine $v)) +# Adjust subdirs and depdirs to be relative to $(outdir) +at.subdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.subdirs/$(outdir))))) +at.depdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.depdirs/$(outdir))))) + # Remember that this is a directory that we've visited _at.outdirs := $(_at.outdirs) $(outdir) -- cgit v1.2.3-54-g00ecf From 7c52645f1dcf5274d05990a25024d652934737cd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 14:40:34 -0400 Subject: (systemd) fix --- build-aux/Makefile.head.mk | 5 ++++- build-aux/Makefile.tail.mk | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 11b1374..36c2c0a 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -14,7 +14,7 @@ # along with this program. If not, see . # This bit only gets evaluated once, at the very beginning -ifeq ($(_at.NO_ONCE),) +ifeq ($(origin _at.NO_ONCE),undefined) ifeq ($(topsrcdir),) $(error topsrcdir must be set before including Makefile.head.mk) @@ -50,6 +50,9 @@ _at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) at.dirlocal += at.subdirs at.dirlocal += at.depdirs +_at.outdirs ?= +_at.included_makefiles ?= + include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk)) endif # _at.NO_ONCE diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index 38f40c2..a8b3d89 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -40,7 +40,7 @@ $(foreach _at.NO_ONCE,y,\ $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_at.NO_ONCE),) +ifeq ($(origin _at.NO_ONCE),undefined) outdir = /bogus srcdir = /bogus -- cgit v1.2.3-54-g00ecf From a13198f6ea2547d69159be7a2f2a1b1c0119c6f9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 2 Aug 2016 12:17:53 -0400 Subject: (systemd) fix --- build-aux/Makefile.each.tail/30-directory-info.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.each.tail/30-directory-info.mk b/build-aux/Makefile.each.tail/30-directory-info.mk index 10ebc4c..80f5e68 100644 --- a/build-aux/Makefile.each.tail/30-directory-info.mk +++ b/build-aux/Makefile.each.tail/30-directory-info.mk @@ -1,4 +1,4 @@ dir_variables = $(foreach v,$(filter-out _%,$(patsubst %/$(@D),%,$(filter %/$(@D),$(.VARIABLES)))),$(if $(findstring /,$v),, $v)) $(outdir)/directory-info: - $(AM_V_at)printf '%s = %s\n' $(foreach v,$(dir_variables),'$v' '$($v/$(@D))') | sort | column -s= -o= -t + $(AM_V_at)printf '%s = «%s»\n' $(foreach v,$(dir_variables),$(if $($v/$(@D)),'$v' '$($v/$(@D))')) | sort | column -s= -o= -t .PHONY: $(outdir)/module-info -- cgit v1.2.3-54-g00ecf From 8a5ecbb4fcaf0d9864074666a45d9263b73f31b8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 7 Aug 2016 21:03:44 -0400 Subject: (systemd) stuff --- build-aux/Makefile.each.head/00-dist.mk | 5 +- build-aux/Makefile.each.head/00-files.mk | 29 ++++ build-aux/Makefile.each.head/00-nested.mk | 16 ++ build-aux/Makefile.each.head/zz-mod.mk | 1 + build-aux/Makefile.each.tail/10-files.mk | 55 ++++++ build-aux/Makefile.each.tail/10-nested.mk | 19 +++ build-aux/Makefile.each.tail/10-std.mk | 46 ----- build-aux/Makefile.each.tail/30-directory-info.mk | 4 - build-aux/Makefile.head.mk | 101 +++++++---- build-aux/Makefile.once.head/00-dist.mk | 44 ----- build-aux/Makefile.once.head/00-gnuconf.mk | 160 ------------------ build-aux/Makefile.once.head/00-write-ifchanged.mk | 1 - build-aux/Makefile.once.head/10-dist.mk | 42 +++++ build-aux/Makefile.once.head/10-files.mk | 37 ++++ build-aux/Makefile.once.head/10-gnuconf.mk | 188 +++++++++++++++++++++ build-aux/Makefile.once.head/10-lt.mk | 12 ++ build-aux/Makefile.once.head/10-nested.mk | 18 ++ build-aux/Makefile.once.head/10-std.mk | 39 ----- build-aux/Makefile.once.head/10-write-ifchanged.mk | 3 + build-aux/Makefile.once.head/zz-mod.mk | 24 +++ build-aux/Makefile.once.tail/00-dist.mk | 12 +- build-aux/Makefile.once.tail/00-mod.mk | 32 ++++ build-aux/Makefile.once.tail/00-noop.mk | 2 + build-aux/Makefile.tail.mk | 40 ++--- build-aux/no-builtin-variables.mk | 15 -- 25 files changed, 575 insertions(+), 370 deletions(-) create mode 100644 build-aux/Makefile.each.head/00-files.mk create mode 100644 build-aux/Makefile.each.head/00-nested.mk create mode 100644 build-aux/Makefile.each.head/zz-mod.mk create mode 100644 build-aux/Makefile.each.tail/10-files.mk create mode 100644 build-aux/Makefile.each.tail/10-nested.mk delete mode 100644 build-aux/Makefile.each.tail/10-std.mk delete mode 100644 build-aux/Makefile.each.tail/30-directory-info.mk delete mode 100644 build-aux/Makefile.once.head/00-dist.mk delete mode 100644 build-aux/Makefile.once.head/00-gnuconf.mk delete mode 100644 build-aux/Makefile.once.head/00-write-ifchanged.mk create mode 100644 build-aux/Makefile.once.head/10-dist.mk create mode 100644 build-aux/Makefile.once.head/10-files.mk create mode 100644 build-aux/Makefile.once.head/10-gnuconf.mk create mode 100644 build-aux/Makefile.once.head/10-lt.mk create mode 100644 build-aux/Makefile.once.head/10-nested.mk delete mode 100644 build-aux/Makefile.once.head/10-std.mk create mode 100644 build-aux/Makefile.once.head/10-write-ifchanged.mk create mode 100644 build-aux/Makefile.once.head/zz-mod.mk create mode 100644 build-aux/Makefile.once.tail/00-mod.mk create mode 100644 build-aux/Makefile.once.tail/00-noop.mk delete mode 100644 build-aux/no-builtin-variables.mk diff --git a/build-aux/Makefile.each.head/00-dist.mk b/build-aux/Makefile.each.head/00-dist.mk index a094305..924d79a 100644 --- a/build-aux/Makefile.each.head/00-dist.mk +++ b/build-aux/Makefile.each.head/00-dist.mk @@ -13,8 +13,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +mod.dist.depends += files + ifeq ($(outdir),$(topoutdir)) -std.clean_files += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /) +files.out.int += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /) .tmp.$(dist.pkgname)-*/ endif $(outdir)/dist: $(addprefix $(topoutdir)/$(dist.pkgname)-$(dist.version),$(dist.exts)) +.PHONY: $(outdir)/dist diff --git a/build-aux/Makefile.each.head/00-files.mk b/build-aux/Makefile.each.head/00-files.mk new file mode 100644 index 0000000..7bf323e --- /dev/null +++ b/build-aux/Makefile.each.head/00-files.mk @@ -0,0 +1,29 @@ +# Copyright (C) 2015-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 . + +files.src.src ?= +files.src.int ?= +files.src.cfg ?= +files.src.gen ?= +files.src = $(sort $(foreach _files.v,$(filter files.src.%,$(.VARIABLES)),$($(_files.v)))) + +files.out.slow ?= +files.out.int ?= +files.out.cfg ?= +$(foreach t,$(files.groups),$(eval files.out.$t ?=)) +files.out = $(sort $(foreach _files.v,$(filter files.out.%,$(.VARIABLES)),$($(_files.v)))) + +$(foreach t,$(files.groups),$(eval files.sys.$t ?=)) +files.sys = $(sort $(foreach _files.v,$(filter files.sys.%,$(.VARIABLES)),$($(_files.v)))) diff --git a/build-aux/Makefile.each.head/00-nested.mk b/build-aux/Makefile.each.head/00-nested.mk new file mode 100644 index 0000000..4325825 --- /dev/null +++ b/build-aux/Makefile.each.head/00-nested.mk @@ -0,0 +1,16 @@ +# 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 . + +nested.subdirs ?= diff --git a/build-aux/Makefile.each.head/zz-mod.mk b/build-aux/Makefile.each.head/zz-mod.mk new file mode 100644 index 0000000..b83c223 --- /dev/null +++ b/build-aux/Makefile.each.head/zz-mod.mk @@ -0,0 +1 @@ +_mod.each := $(sort $(_mod.each) $(filter-out $(_mod.once),$(_mod.vars))) diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk new file mode 100644 index 0000000..4607c43 --- /dev/null +++ b/build-aux/Makefile.each.tail/10-files.mk @@ -0,0 +1,55 @@ +# Copyright (C) 2015-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 . +# Add some more defaults to the *_files variables + +$(foreach _files.var,$(patsubst files.%,%,files.src $(filter files.src.%,$(.VARIABLES))),\ + $(eval _files.$(_files.var) = $$(call at.addprefix,$$(srcdir),$$(files.$(_files.var))))) +$(foreach _files.var,$(patsubst files.%,%,files.out $(filter files.out.%,$(.VARIABLES))),\ + $(eval _files.$(_files.var) = $$(call at.addprefix,$$(outdir),$$(files.$(_files.var))))) +$(foreach _files.var,$(patsubst files.%,%,files.sys $(filter files.sys.%,$(.VARIABLES))),\ + $(eval _files.$(_files.var) = $$(addprefix $$(DESTDIR),$$(files.$(_files.var))))) + +_files.all = $(_files.src) $(_files.out) $(_files.sys) + +at.targets += $(subst *,%,$(_files.all)) + +# Creative targets +$(outdir)/$(files.generate): $(_files.src.gen) $(_files.src.cfg) +$(outdir)/install: $(_files.sys.$(files.default)) +$(outdir)/installdirs: $(sort $(dir $(_files.sys))) +$(foreach _files.g,$(files.groups),\ + $(eval $$(outdir)/$(_files.g): $$(_files.out.$(_files.g)))) +$(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ + $(eval $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g)))) + +# Destructive targets +_files.uninstall = $(_files.sys) +_files.mostlyclean = $(filter-out $(_files.out.slow) $(_files.out.cfg),$(_files.out)) +_files.clean = $(filter-out $(_files.out.cfg),$(_files.out)) +_files.distclean = $(_files.out) +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean): %: %-hook + $(RM) -- $(sort $(filter-out %/,$(_files.$(@F)))) + $(RM) -r -- $(sort $(filter %/,$(_files.$(@F)))) + $(RMDIR_P) -- $(sort $(dir $(_files.$(@F)))) +_files.maintainer-clean = $(filter-out $(_files.src.cfg) $(_files.src.src),$(_files.src)) +_files.$(files.vcsclean) = $(filter-out $(_files.src.src),$(_files.src)) +$(addprefix $(outdir)/,maintainer-clean $(files.vcsclean)): $(outdir)/%: $(outdir)/distclean $(outdir)/%-hook + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + $(RM) -- $(sort $(filter-out %/,$(_files.$(@F)))) + $(RM) -r -- $(sort $(filter %/,$(_files.$(@F)))) + $(RMDIR_P) -- $(sort $(dir $(_files.$(@F)))) +$(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook):: +.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook) diff --git a/build-aux/Makefile.each.tail/10-nested.mk b/build-aux/Makefile.each.tail/10-nested.mk new file mode 100644 index 0000000..e9d02ca --- /dev/null +++ b/build-aux/Makefile.each.tail/10-nested.mk @@ -0,0 +1,19 @@ +# 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 . + +$(addprefix $(outdir)/,$(nested.targets)): $(outdir)/%: $(addsuffix /%,$(call at.addprefix,$(outdir),$(nested.subdirs))) +.PHONY: $(addprefix $(outdir)/,$(nested.targets)) + +at.subdirs += $(nested.subdirs) diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk deleted file mode 100644 index ca78f3c..0000000 --- a/build-aux/Makefile.each.tail/10-std.mk +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2015-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 . -# Add some more defaults to the *_files variables -std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) - -# Fix each variable at its current value to avoid any weirdness -$(foreach c,src gen cfg out sys clean slow,$(eval std.$c_files := $$(std.$c_files))) - -# Make each of the standard variables relative to the correct directory -std.src_files := $(call at.addprefix,$(srcdir)/,$(std.src_files)) -std.gen_files := $(call at.addprefix,$(srcdir)/,$(std.gen_files)) -std.cfg_files := $(call at.addprefix,$(outdir)/,$(std.cfg_files)) -std.out_files := $(call at.addprefix,$(outdir)/,$(std.out_files)) -std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) -std.clean_files := $(call at.addprefix,$(outdir)/,$(std.clean_files)) -std.slow_files := $(call at.addprefix,$(outdir)/,$(std.slow_files)) - -# Creative targets -$(outdir)/build : $(std.out_files) -$(outdir)/install : $(std.sys_files) -$(outdir)/installdirs: $(sort $(dir $(std.sys_files))) - -# Destructive targets -_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): %: %-hook - $(RM) -- $(sort $(filter-out %/,$(_std.$(@F)/$(@D)))) - $(RM) -r -- $(sort $(filter %/,$(_std.$(@F)/$(@D)))) - $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) -$(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook):: -.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook) diff --git a/build-aux/Makefile.each.tail/30-directory-info.mk b/build-aux/Makefile.each.tail/30-directory-info.mk deleted file mode 100644 index 80f5e68..0000000 --- a/build-aux/Makefile.each.tail/30-directory-info.mk +++ /dev/null @@ -1,4 +0,0 @@ -dir_variables = $(foreach v,$(filter-out _%,$(patsubst %/$(@D),%,$(filter %/$(@D),$(.VARIABLES)))),$(if $(findstring /,$v),, $v)) -$(outdir)/directory-info: - $(AM_V_at)printf '%s = «%s»\n' $(foreach v,$(dir_variables),$(if $($v/$(@D)),'$v' '$($v/$(@D))')) | sort | column -s= -o= -t -.PHONY: $(outdir)/module-info diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 36c2c0a..8213043 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -12,60 +12,103 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . + +_at.MAKEFILE_LIST ?= +_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(abspath $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) # This bit only gets evaluated once, at the very beginning ifeq ($(origin _at.NO_ONCE),undefined) +# Internal functions ################################################### + +# These 4 functions are all $(call _at.func,parent,child) +_at.is_strict_subdir = $(filter $(abspath $1)/%,$(abspath $2)) +_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) +_at.relbase = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ + $(abspath $2))) +_at.relto = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ + ../$(call _at.relto,$(dir $1),$2))) + +# These 3 functions only take one operand; we define public multi-operand +# versions below. +_at.path = $(strip \ + $(if $(call _at.is_subdir,$(topoutdir),$1), \ + $(patsubst %/.,%,$(topoutdir)/$(call _at.relto,.,$1)), \ + $(if $(call _at.is_subdir,$(topsrcdir),$1), \ + $(patsubst %/.,%,$(topsrcdir)/$(call _at.relto,$(topsrcdir),$1)), \ + $(abspath $1)))) +_at.out2src = $(call _at.path,$(if $(call _at.is_subdir,$(topoutdir),$1),$(topsrcdir)/$(call _at.path,$1),$1)) +_at.addprefix = $(call _at.path,$(if $(filter-out /%,$2),$1/$2,$2)) + +_at.rest = $(wordlist 2,$(words $1),$1) +_at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) + +# Sanity checking ###################################################### +ifeq ($(filter undefine,$(.FEATURES)),) +$(error Autothing: We need a version of Make that supports 'undefine') +endif ifeq ($(topsrcdir),) -$(error topsrcdir must be set before including Makefile.head.mk) +$(error Autothing: topsrcdir must be set (and non-empty) before including Makefile.head.mk) endif ifeq ($(topoutdir),) -$(error topoutdir must be set before including Makefile.head.mk) +$(error Autothing: topoutdir must be set (and non-empty) before including Makefile.head.mk) endif +ifneq ($(call _at.is_strict_subdir,$(topoutdir),$(topsrcdir)),) +$(error Autothing: topsrcdir=$(topsrcdir) must not be a subdirectory of topoutdir=$(topoutdir)) +endif + +# Internal setup ####################################################### -_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)))) -at.relto = $(foreach p,$2,$(call _at.relto,$1,$p)) -# Note that _at.is_subdir says that a directory is a subdirectory of -# itself. -at.path = $(call at.relto,.,$1) +# External provisions ################################################## -_at.addprefix = $(if $(filter /%,$2),$2,$1/$2) -at.addprefix = $(foreach f,$2, $(addsuffix $(if $(filter %/,$f),/),$(call at.path,$(call _at.addprefix,$1,$f)) )) +# These 4 functions are all $(call _at.func,parent,child) +at.is_subdir = $(_at.is_subdir) +at.is_strict_subdir = $(_at.is_strict_subdir) +#at.relbase = $(if $2,$(shell realpath -sm --relative-base=$1 -- $2)) +at.relbase = $(foreach _at.tmp,$2,$(call _at.relbase,$1,$(_at.tmp))) +#at.relto = $(if $2,$(shell realpath -sm --relative-to=$1 -- $2)) +at.relto = $(foreach _at.tmp,$2,$(call _at.relto,$1,$(_at.tmp))) + +at.path = $(foreach _at.tmp,$1,$(call _at.path,$(_at.tmp))) +at.out2src = $(foreach _at.tmp,$1,$(call _at.out2src,$(_at.tmp))) +at.addprefix = $(foreach _at.tmp,$2,$(call _at.addprefix,$1,$(_at.tmp))) define at.nl endef +# External configuration ############################################### at.Makefile ?= Makefile -_at.rest = $(wordlist 2,$(words $1),$1) -_at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) - -at.dirlocal += at.subdirs -at.dirlocal += at.depdirs - -_at.outdirs ?= -_at.included_makefiles ?= - +# Include modules ###################################################### include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk)) +_at.tmp_targets = +_at.tmp_subdirs = +_at.VARIABLES = +_at.VARIABLES := $(.VARIABLES) 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 at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) -srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir))) +outdir := $(call _at.path,$(dir $(lastword $(_at.MAKEFILE_LIST)))) +ifeq ($(call _at.is_subdir,$(topoutdir),$(outdir)),) +$(error Autothing: not a subdirectory of topoutdir=$(topoutdir): $(outdir)) +endif -_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/$(at.Makefile)) +# Don't use at.out2src because we *know* that $(outdir) is inside $(topoutdir), +# and has already had $(_at.path) called on it. +srcdir := $(call _at.path,$(topsrcdir)/$(outdir)) +ifeq ($(call _at.is_subdir,$(topsrcdir),$(srcdir)),) +$(error Autothing: not a subdirectory of topsrcdir=$(topsrcdir): $(srcdir)) +endif -$(foreach v,$(at.dirlocal),$(eval $v=)) +at.subdirs = +at.targets = include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.head/*.mk)) diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk deleted file mode 100644 index 4326cde..0000000 --- a/build-aux/Makefile.once.head/00-dist.mk +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2015-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 . - -# Developer configuration - -dist.exts ?= .tar.gz -dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) -dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION)) - -ifeq ($(dist.pkgname),) -$(error dist.pkgname must be set) -endif -ifeq ($(dist.version),) -$(error dist.version must be set) -endif - -# User configuration - -CP ?= cp -GZIP ?= gzip -MKDIR ?= mkdir -MKDIR_P ?= mkdir -p -MV ?= mv -RM ?= rm -f -TAR ?= tar - -GZIPFLAGS ?= $(GZIP_ENV) -GZIP_ENV ?= --best - -# Implementation - -at.phony += dist diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/00-gnuconf.mk deleted file mode 100644 index 83cb110..0000000 --- a/build-aux/Makefile.once.head/00-gnuconf.mk +++ /dev/null @@ -1,160 +0,0 @@ -# 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 . - -# This file is based on §7.2 "Makefile Conventions" of the release of -# the GNU Coding Standards dated April 13, 2016. - -gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) -ifeq ($(gnuconf.pkgname),) -$(error gnuconf.pkgname must be set) -endif - -# 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 - -# These must be user-configurable -AR ?= ar -ARFLAGS ?= -BISON ?= bison -BISONFLAGS ?= -CC ?= cc -CCFLAGS ?= $(CFLAGS) -FLEX ?= flex -FLEXFLAGS ?= -INSTALL ?= install -#INSTALLFLAGS ?= -LD ?= ld -LDFLAGS ?= -LDCONFIG ?= ldconfig #TODO -LDCONFIGFLAGS ?= -LEX ?= lex -LEXFLAGS ?= $(LFLAGS) -#MAKE -MAKEINFO ?= makeinfo -MAKEINFOFLAGS ?= -RANLIB ?= ranlib #TODO -RANLIBFLAGS ?= -TEXI2DVI ?= texi2dvi -TEXI2DVIFLAGS ?= -YACC ?= yacc -YACCFLAGS ?= $(YFLAGS) - -CFLAGS ?= -LFLAGS ?= -YFLAGS ?= - -LN_S ?= ln -s #TODO - -CHGRP ?= chgrp -CHMOD ?= chmod -CHOWN ?= chown -MKNOD ?= mknod - -# 7.2.3: Variables for Specifying Commands -# ---------------------------------------- - -INSTALL_PROGRAM ?= $(INSTALL) -INSTALL_DATA ?= ${INSTALL} -m 644 - -# 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 -# Data files -datarootdir ?= $(prefix)/share -datadir ?= $(datarootdir) -sysconfdir ?= $(prefix)/etc -sharedstatedir ?= $(prefix)/com -localstatedir ?= $(prefix)/var -runstatedir ?= $(localstatedir)/run -# Specific types of files -includedir ?= $(prefix)/include -oldincludedir ?= /usr/include -docdir ?= $(datarootdir)/doc/$(gnuconf.pkgname) -infodir ?= $(datarootdir)/info -htmldir ?= $(docdir) -dvidir ?= $(docdir) -pdfdir ?= $(docdir) -psdir ?= $(docdir) -libdir ?= $(exec_prefix)/lib -lispdir ?= $(datarootdir)/emacs/site-lisp -localedir ?= $(datarootdir)/locale - -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 - -manext ?= .1 -man1ext ?= .1 -man2ext ?= .2 -man3ext ?= .3 -man4ext ?= .4 -man5ext ?= .5 -man6ext ?= .6 -man7ext ?= .7 -man8ext ?= .8 - -# 7.2.7: Install Command Categories -# --------------------------------- - -PRE_INSTALL ?= -POST_INSTALL ?= -NORMAL_INSTALL ?= - -PRE_UNINSTALL ?= -POST_UNINSTALL ?= -NORMAL_UNINSTALL ?= diff --git a/build-aux/Makefile.once.head/00-write-ifchanged.mk b/build-aux/Makefile.once.head/00-write-ifchanged.mk deleted file mode 100644 index 79ef1c4..0000000 --- a/build-aux/Makefile.once.head/00-write-ifchanged.mk +++ /dev/null @@ -1 +0,0 @@ -WRITE_IFCHANGED = $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk new file mode 100644 index 0000000..0e13ea2 --- /dev/null +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -0,0 +1,42 @@ +# Copyright (C) 2015-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 . + +mod.dist.description = Make distribution tarballs + +# Developer configuration + +dist.exts ?= .tar.gz +dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) +dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION)) + +ifeq ($(dist.pkgname),) +$(error Autothing module: dist: dist.pkgname must be set) +endif +ifeq ($(dist.version),) +$(error Autothing module: dist: dist.version must be set) +endif + +# User configuration + +CP ?= cp +GZIP ?= gzip +MKDIR ?= mkdir +MKDIR_P ?= mkdir -p +MV ?= mv +RM ?= rm -f +TAR ?= tar + +GZIPFLAGS ?= $(GZIP_ENV) +GZIP_ENV ?= --best diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk new file mode 100644 index 0000000..56e06ac --- /dev/null +++ b/build-aux/Makefile.once.head/10-files.mk @@ -0,0 +1,37 @@ +# Copyright (C) 2015-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 . + +mod.files.description = Keeping track of groups of files +mod.files.depends += nested + +files.groups ?= all +files.default ?= all +files.vcsclean ?= files.vcsclean +files.generate ?= files.generate + +.DEFAULT_GOAL = $(files.default_group) + +# Standard creative PHONY targets +nested.targets += $(foreach g,$(files.groups), $g install-$g install-$gdirs) +# Standard destructive PHONY targets +nested.targets += uninstall mostlyclean clean distclean maintainer-clean + +# User configuration + +DESTDIR ?= + +RM ?= rm -f +RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty +TRUE ?= true diff --git a/build-aux/Makefile.once.head/10-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk new file mode 100644 index 0000000..c07cfb5 --- /dev/null +++ b/build-aux/Makefile.once.head/10-gnuconf.mk @@ -0,0 +1,188 @@ +# 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 . + +# This file is based on §7.2 "Makefile Conventions" of the release of +# the GNU Coding Standards dated July 25, 2016. + +mod.gnuconf.description = GNU standard configuration variables + +gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) +ifeq ($(gnuconf.pkgname),) +$(error Autothing module: gnuconf: gnuconf.pkgname must be set) +endif + +# 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 + +# 7.2.2: Utilities in Makefiles/7.2.3: Variables for Specifying Commands +# ---------------------------------------------------------------------- + +# Standard user-configurable programs. +# +# The list of programs here is specified in §7.2.2, but the associated FLAGS +# variables are specified in §7.2.3. I found it cleaner to list them together. +AR ?= ar +ARFLAGS ?= +BISON ?= bison +BISONFLAGS ?= +CC ?= cc +CFLAGS ?= # CFLAGS instead of CCFLAGS +FLEX ?= flex +FLEXFLAGS ?= +INSTALL ?= install +# There is no INSTALLFLAGS[0] +LD ?= ld +LDFLAGS ?= +LDCONFIG ?= ldconfig # TODO[1] +LDCONFIGFLAGS ?= +LEX ?= lex +LFLAGS ?= # LFLAGS instead of LEXFLAGS +#MAKE +MAKEINFO ?= makeinfo +MAKEINFOFLAGS ?= +RANLIB ?= ranlib # TODO[1] +RANLIBFLAGS ?= +TEXI2DVI ?= texi2dvi +TEXI2DVIFLAGS ?= +YACC ?= yacc +YFLAGS ?= # YFLAGS instead of YACCFLAGS + +LN_S ?= ln -s # TODO[2] + +CHGRP ?= chgrp +CHGRPFLAGS ?= +CHMOD ?= chmod +CHMODFLAGS ?= +CHOWN ?= chown +CHOWNFLAGS ?= +MKNOD ?= mknod +MKNODFLAGS ?= + +# [0]: There is no INSTALLFLAGS because it would be inconsistent with how the +# standards otherwise recommend using $(INSTALL); with INSTALL_PROGRAM and +# INSTALL_DATA; which are specified in a way precluding the use of +# INSTALLFLAGS. To have the variable, but to ignore it in the common case +# would be confusing. +# +# [1]: The RANLIB and LDCONFIG variables need some extra smarts; §7.2.2 says: +# +# > When you use ranlib or ldconfig, you should make sure nothing bad +# > happens if the system does not have the program in question. Arrange +# > to ignore an error from that command, and print a message before the +# > command to tell the user that failure of this command does not mean a +# > problem. (The Autoconf ‘AC_PROG_RANLIB’ macro can help with this.) +# +# [2]: The LN_S variable isn't standard, but we have it here as an (incomplete) +# stub to help support this bit of §7.2.2: +# +# > If you use symbolic links, you should implement a fallback for +# > systems that don’t have symbolic links. + +# 7.2.3: Variables for Specifying Commands +# ---------------------------------------- + +INSTALL_PROGRAM ?= $(INSTALL) +INSTALL_DATA ?= ${INSTALL} -m 644 + +# 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 +# Data files +datarootdir ?= $(prefix)/share +datadir ?= $(datarootdir) +sysconfdir ?= $(prefix)/etc +sharedstatedir ?= $(prefix)/com +localstatedir ?= $(prefix)/var +runstatedir ?= $(localstatedir)/run +# Specific types of files +includedir ?= $(prefix)/include +oldincludedir ?= /usr/include +docdir ?= $(datarootdir)/doc/$(gnuconf.pkgname) +infodir ?= $(datarootdir)/info +htmldir ?= $(docdir) +dvidir ?= $(docdir) +pdfdir ?= $(docdir) +psdir ?= $(docdir) +libdir ?= $(exec_prefix)/lib +lispdir ?= $(datarootdir)/emacs/site-lisp +localedir ?= $(datarootdir)/locale + +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 + +manext ?= .1 +man1ext ?= .1 +man2ext ?= .2 +man3ext ?= .3 +man4ext ?= .4 +man5ext ?= .5 +man6ext ?= .6 +man7ext ?= .7 +man8ext ?= .8 + +# 7.2.7: Install Command Categories +# --------------------------------- + +PRE_INSTALL ?= +POST_INSTALL ?= +NORMAL_INSTALL ?= + +PRE_UNINSTALL ?= +POST_UNINSTALL ?= +NORMAL_UNINSTALL ?= diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk new file mode 100644 index 0000000..c8410d4 --- /dev/null +++ b/build-aux/Makefile.once.head/10-lt.mk @@ -0,0 +1,12 @@ +mod.lt.description = Easy handling of libtool dependencies +mod.lt.deps += files + +_lt.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l))) +_lt.patsubst-all = $(if $1,$(call _sd.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3) +_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(_lt.tmp)),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(_lt.tmp)),$(_lt.tmp))) + +# The semantics for the de-dup bit are a bit weird. My head hurts thinking +# about them. TODO: clarify/simplify/something +lt.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys)))) +_lt.link_files = $(filter %.o %.lo %.la -l%,$(call _lt.unLIBPATTERNS$,$^)) +lt.link_files = $(filter-out $(call _lt.dups,$(_lt.link_files)),$(_lt.link_files)) diff --git a/build-aux/Makefile.once.head/10-nested.mk b/build-aux/Makefile.once.head/10-nested.mk new file mode 100644 index 0000000..af9fdf7 --- /dev/null +++ b/build-aux/Makefile.once.head/10-nested.mk @@ -0,0 +1,18 @@ +# 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 . + +mod.nested.description = Easy nested .PHONY targets + +nested.targets ?= diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk deleted file mode 100644 index 3e058ec..0000000 --- a/build-aux/Makefile.once.head/10-std.mk +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2015-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 . - -# Declare the default target -all: build -.PHONY: all noop - -# Standard creative PHONY targets -at.phony += build install installdirs -# Standard destructive PHONY targets -at.phony += uninstall mostlyclean clean distclean maintainer-clean - -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 - -# User configuration - -DESTDIR ?= - -RM ?= rm -f -RMDIR_P ?= rmdir -p -TRUE ?= true diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk new file mode 100644 index 0000000..7917201 --- /dev/null +++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk @@ -0,0 +1,3 @@ +mod.write-ifchanged.description = build-aux/write-ifchanged helper script + +WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk new file mode 100644 index 0000000..3bf6398 --- /dev/null +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -0,0 +1,24 @@ +# 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 . + +mod.mod.description = Print information about Autothing modules + +_mod.target = at-mod-info +_mod.modules := $(sort $(patsubst %.mk,%,$(filter %.mk,$(subst -, ,$(notdir $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk)))))) +_mod.quote = '$(subst ','\'',$1)' + +_mod.vars = $(filter $(addsuffix .%,$(_mod.modules)),$(.VARIABLES)) +_mod.once := $(_mod.vars) +_mod.each := diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index b8b7733..6c6aaed 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -16,12 +16,12 @@ _dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 _dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3)) $(topoutdir)/$(dist.pkgname)-$(dist.version): $(foreach v,$(filter std.src_files/% std.gen_files/%,$(.VARIABLES)),$($v)) - $(RM) -r $@ $(@D)/tmp.$(@F) - $(MKDIR) $(@D)/tmp.$(@F) - $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F),$f)$(at.nl)) - $(MV) $(@D)/tmp.$(@F) $@ || $(RM) -r $(@D)/tmp.$(@F) + $(RM) -r $@ $(@D)/.tmp.$(@F) + $(MKDIR) $(@D)/.tmp.$(@F) + $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/.tmp.$(@F),$f)$(at.nl)) + $(MV) $(@D)/.tmp.$(@F) $@ || $(RM) -r $(@D)/.tmp.$(@F) -$(topoutdir)/$(dist.pkgname)-$(dist.version).tar: $(topoutdir)/$(dist.pkgname)-$(dist.version) +$(topoutdir)/$(dist.pkgname)-$(dist.version).tar: %.tar: % $(TAR) cf $@ -C $( $@ diff --git a/build-aux/Makefile.once.tail/00-mod.mk b/build-aux/Makefile.once.tail/00-mod.mk new file mode 100644 index 0000000..68350f0 --- /dev/null +++ b/build-aux/Makefile.once.tail/00-mod.mk @@ -0,0 +1,32 @@ +# 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 . + +$(_mod.target): + @printf 'Autothing modules used in this project:\n' + @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call _mod.quote,$(_mod.tmp))) +$(addprefix $(_mod.target)/,$(_mod.modules)): $(_mod.target)/%: + @printf 'Module : %s ' $(call _mod.quote,$*) + @$(if $(at.mod.$*.description),printf ' - %s' $(call _mod.quote,mod.$*.description)) + @echo + @echo Depends on : $(mod.$*.depends) + @echo User configuration: + @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep -v -e ^'_' -e ^'$*' | column -t -s: |sed 's|^| |' + @echo Developer global inputs: + @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' + @echo Developer per-directory inputs: + @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.each.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' + @echo Developer outputs: + @egrep '^\s*[^:#]+\s*(|:|::)=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' +.PHONY: $(addprefix mod/,$(_mod.modules)) diff --git a/build-aux/Makefile.once.tail/00-noop.mk b/build-aux/Makefile.once.tail/00-noop.mk new file mode 100644 index 0000000..bac2ec1 --- /dev/null +++ b/build-aux/Makefile.once.tail/00-noop.mk @@ -0,0 +1,2 @@ +noop: +.PHONY: noop diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index a8b3d89..136e483 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,36 +17,26 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -# Move all of the dirlocal variables to their namespaced version -$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) -$(foreach v,$(at.dirlocal),$(eval undefine $v)) - -# Adjust subdirs and depdirs to be relative to $(outdir) -at.subdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.subdirs/$(outdir))))) -at.depdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.depdirs/$(outdir))))) - -# Remember that this is a directory that we've visited -_at.outdirs := $(_at.outdirs) $(outdir) - -# Generic phony target declarations: -# mark them phony -.PHONY: $(addprefix $(outdir)/,$(at.phony)) -# have them depend on subdirs -$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outdir))))) - -# Include Makefiles from other directories +_at.tmp_targets := $(at.targets) +_at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) + +# Clean the environment +$(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)), \ + $(foreach _at.tmp_target,$(_at.tmp_targets), \ + $(if $(filter recursive,$(flavor $(_at.tmp_variable))), \ + $(eval $(_at.tmp_target): private $(_at.tmp_variable) = $(subst $(at.nl),$$(at.nl),$(value $(_at.tmp_variable)))), \ + $(eval $(_at.tmp_target): private $(_at.tmp_variable) := $$($(_at.tmp_variable))))) \ + $(eval undefine $(_at.tmp_variable))) + +# Recurse $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call at.path,$(addsuffix /$(at.Makefile),$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ - $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) + $(foreach _at.tmp,$(call at.path,$(addsuffix /$(at.Makefile),$(_at.tmp_subdirs))),\ + $(if $(filter-out $(_at.MAKEFILE_LIST),$(abspath $(_at.tmp))),\ + $(eval include $(_at.tmp))))) # This bit only gets evaluated once, after all of the other Makefiles are read ifeq ($(origin _at.NO_ONCE),undefined) -outdir = /bogus -srcdir = /bogus - -$(foreach v,$(at.dirlocal),$(eval $v=)) - include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk))) endif # _at.NO_ONCE diff --git a/build-aux/no-builtin-variables.mk b/build-aux/no-builtin-variables.mk deleted file mode 100644 index c3aef58..0000000 --- a/build-aux/no-builtin-variables.mk +++ /dev/null @@ -1,15 +0,0 @@ -MAKEFLAGS += --no-builtin-variables - -# This version is more correct, but is slower: -# $(foreach v,$(shell bash -c 'comm -23 <(env -i $(MAKE) -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort) <(env -i $(MAKE) -R -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort)'), -# $(if $(filter default,$(origin $v)),$(eval undefine $v))) - -_default_variables = $(foreach v,$(.VARIABLES),$(if $(filter default,$(origin $v)),$v)) -$(foreach v,$(filter-out .% MAKE% SUFFIXES,$(_default_variables))\ - $(filter .LIBPATTERNS MAKEINFO,$(_default_variables)),\ - $(eval undefine $v)) -undefine _default_variables - -# Because Make uses .LIBPATTERNS internally, it should always be -# defined in case --warn-undefined-variables -.LIBPATTERNS ?= -- cgit v1.2.3-54-g00ecf From bf8f76973a833659ce4ac730c4918c382192d3e0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 8 Aug 2016 01:09:59 -0400 Subject: (systemd) speed up --- build-aux/Makefile.each.head/00-files.mk | 4 ++-- build-aux/Makefile.each.tail/10-files.mk | 22 ++++++++++++---------- build-aux/Makefile.head.mk | 6 ++++-- build-aux/Makefile.once.head/zz-mod.mk | 2 ++ build-aux/Makefile.tail.mk | 10 ++++------ 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/build-aux/Makefile.each.head/00-files.mk b/build-aux/Makefile.each.head/00-files.mk index 7bf323e..c9a94e1 100644 --- a/build-aux/Makefile.each.head/00-files.mk +++ b/build-aux/Makefile.each.head/00-files.mk @@ -22,8 +22,8 @@ files.src = $(sort $(foreach _files.v,$(filter files.src.%,$(.VARIABLES)),$($(_f files.out.slow ?= files.out.int ?= files.out.cfg ?= -$(foreach t,$(files.groups),$(eval files.out.$t ?=)) +$(eval $(foreach t,$(files.groups),files.out.$t ?=$(at.nl))) files.out = $(sort $(foreach _files.v,$(filter files.out.%,$(.VARIABLES)),$($(_files.v)))) -$(foreach t,$(files.groups),$(eval files.sys.$t ?=)) +$(eval $(foreach t,$(files.groups),files.sys.$t ?=$(at.nl))) files.sys = $(sort $(foreach _files.v,$(filter files.sys.%,$(.VARIABLES)),$($(_files.v)))) diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk index 4607c43..8ab187b 100644 --- a/build-aux/Makefile.each.tail/10-files.mk +++ b/build-aux/Makefile.each.tail/10-files.mk @@ -14,12 +14,13 @@ # along with this program. If not, see . # Add some more defaults to the *_files variables -$(foreach _files.var,$(patsubst files.%,%,files.src $(filter files.src.%,$(.VARIABLES))),\ - $(eval _files.$(_files.var) = $$(call at.addprefix,$$(srcdir),$$(files.$(_files.var))))) -$(foreach _files.var,$(patsubst files.%,%,files.out $(filter files.out.%,$(.VARIABLES))),\ - $(eval _files.$(_files.var) = $$(call at.addprefix,$$(outdir),$$(files.$(_files.var))))) -$(foreach _files.var,$(patsubst files.%,%,files.sys $(filter files.sys.%,$(.VARIABLES))),\ - $(eval _files.$(_files.var) = $$(addprefix $$(DESTDIR),$$(files.$(_files.var))))) +$(eval \ + $(foreach _files.var,$(filter files.src files.src.%,$(.VARIABLES)),\ + _$(_files.var) = $$(call at.addprefix,$$(srcdir),$$($(_files.var)))$(at.nl))\ + $(foreach _files.var,$(filter files.out files.out.%,$(.VARIABLES)),\ + _$(_files.var) = $$(call at.addprefix,$$(outdir),$$($(_files.var)))$(at.nl))\ + $(foreach _files.var,$(filter files.sys files.sys.%,$(.VARIABLES)),\ + _$(_files.var) = $$(addprefix $$(DESTDIR),$$($(_files.var)))$(at.nl))) _files.all = $(_files.src) $(_files.out) $(_files.sys) @@ -29,10 +30,11 @@ at.targets += $(subst *,%,$(_files.all)) $(outdir)/$(files.generate): $(_files.src.gen) $(_files.src.cfg) $(outdir)/install: $(_files.sys.$(files.default)) $(outdir)/installdirs: $(sort $(dir $(_files.sys))) -$(foreach _files.g,$(files.groups),\ - $(eval $$(outdir)/$(_files.g): $$(_files.out.$(_files.g)))) -$(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ - $(eval $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g)))) +$(eval \ + $(foreach _files.g,$(files.groups),\ + $$(outdir)/$(_files.g): $$(_files.out.$(_files.g))$(at.nl))\ + $(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ + $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g)))$(at.nl)) # Destructive targets _files.uninstall = $(_files.sys) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 8213043..105432c 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -47,6 +47,10 @@ _at.addprefix = $(call _at.path,$(if $(filter-out /%,$2),$1/$2,$2)) _at.rest = $(wordlist 2,$(words $1),$1) _at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) +_at.target_variable = $(_at.target_variable.$(flavor $2)) +_at.target_variable.recursive = $1: private $2 = $(subst $(at.nl),$$(at.nl),$(value $2)) +_at.target_variable.simple = $1: private $2 := $$($2) + # Sanity checking ###################################################### ifeq ($(filter undefine,$(.FEATURES)),) $(error Autothing: We need a version of Make that supports 'undefine') @@ -61,8 +65,6 @@ ifneq ($(call _at.is_strict_subdir,$(topoutdir),$(topsrcdir)),) $(error Autothing: topsrcdir=$(topsrcdir) must not be a subdirectory of topoutdir=$(topoutdir)) endif -# Internal setup ####################################################### - # External provisions ################################################## # These 4 functions are all $(call _at.func,parent,child) diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk index 3bf6398..7e52606 100644 --- a/build-aux/Makefile.once.head/zz-mod.mk +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -19,6 +19,8 @@ _mod.target = at-mod-info _mod.modules := $(sort $(patsubst %.mk,%,$(filter %.mk,$(subst -, ,$(notdir $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk)))))) _mod.quote = '$(subst ','\'',$1)' +$(eval $(foreach _mod.tmp,$(_mod.modules),mod.$(_mod.tmp).description ?=$(at.nl)mod.$(_mod.tmp).depends ?=$(at.nl))) + _mod.vars = $(filter $(addsuffix .%,$(_mod.modules)),$(.VARIABLES)) _mod.once := $(_mod.vars) _mod.each := diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index 136e483..aeba2d1 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -21,12 +21,10 @@ _at.tmp_targets := $(at.targets) _at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) # Clean the environment -$(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)), \ - $(foreach _at.tmp_target,$(_at.tmp_targets), \ - $(if $(filter recursive,$(flavor $(_at.tmp_variable))), \ - $(eval $(_at.tmp_target): private $(_at.tmp_variable) = $(subst $(at.nl),$$(at.nl),$(value $(_at.tmp_variable)))), \ - $(eval $(_at.tmp_target): private $(_at.tmp_variable) := $$($(_at.tmp_variable))))) \ - $(eval undefine $(_at.tmp_variable))) +$(eval \ + $(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)),\ + $(call _at.target_variable,$(_at.tmp_targets),$(_at.tmp_variable))$(at.nl)\ + undefine $(_at.tmp_variable)$(at.nl))) # Recurse $(foreach _at.NO_ONCE,y,\ -- cgit v1.2.3-54-g00ecf From 2d47b10c0a19c9f986d2b1c4e5a06d8a49d36096 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 8 Aug 2016 13:20:56 -0400 Subject: (systemd) fix --- build-aux/Makefile.once.head/10-files.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk index 56e06ac..2af7bf8 100644 --- a/build-aux/Makefile.once.head/10-files.mk +++ b/build-aux/Makefile.once.head/10-files.mk @@ -21,7 +21,7 @@ files.default ?= all files.vcsclean ?= files.vcsclean files.generate ?= files.generate -.DEFAULT_GOAL = $(files.default_group) +.DEFAULT_GOAL = $(files.default) # Standard creative PHONY targets nested.targets += $(foreach g,$(files.groups), $g install-$g install-$gdirs) -- cgit v1.2.3-54-g00ecf From 88d181c25d2f99f8b510afe2f2cc7e1ba1fa012c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Aug 2016 11:22:38 -0400 Subject: (systemd) fix build system --- build-aux/Makefile.each.head/00-files.mk | 13 ++++--- build-aux/Makefile.each.head/zz-mod.mk | 1 - build-aux/Makefile.each.tail/00-dist.mk | 1 + build-aux/Makefile.each.tail/00-mod.mk | 41 ++++++++++++++++++++++ build-aux/Makefile.each.tail/10-nested.mk | 3 +- build-aux/Makefile.head.mk | 14 ++++---- build-aux/Makefile.once.head/10-dist.mk | 4 ++- build-aux/Makefile.once.head/10-files.mk | 5 ++- build-aux/Makefile.once.head/10-lt.mk | 12 ------- build-aux/Makefile.once.head/10-write-ifchanged.mk | 3 +- build-aux/Makefile.once.head/zz-mod.mk | 32 ++++++++++++----- build-aux/Makefile.once.tail/00-dist.mk | 2 +- build-aux/Makefile.once.tail/00-mod.mk | 32 ----------------- build-aux/Makefile.once.tail/00-noop.mk | 2 -- build-aux/Makefile.tail.mk | 2 +- 15 files changed, 95 insertions(+), 72 deletions(-) delete mode 100644 build-aux/Makefile.each.head/zz-mod.mk create mode 100644 build-aux/Makefile.each.tail/00-dist.mk create mode 100644 build-aux/Makefile.each.tail/00-mod.mk delete mode 100644 build-aux/Makefile.once.head/10-lt.mk delete mode 100644 build-aux/Makefile.once.tail/00-mod.mk delete mode 100644 build-aux/Makefile.once.tail/00-noop.mk diff --git a/build-aux/Makefile.each.head/00-files.mk b/build-aux/Makefile.each.head/00-files.mk index c9a94e1..c4820cf 100644 --- a/build-aux/Makefile.each.head/00-files.mk +++ b/build-aux/Makefile.each.head/00-files.mk @@ -17,13 +17,16 @@ files.src.src ?= files.src.int ?= files.src.cfg ?= files.src.gen ?= -files.src = $(sort $(foreach _files.v,$(filter files.src.%,$(.VARIABLES)),$($(_files.v)))) files.out.slow ?= files.out.int ?= files.out.cfg ?= -$(eval $(foreach t,$(files.groups),files.out.$t ?=$(at.nl))) -files.out = $(sort $(foreach _files.v,$(filter files.out.%,$(.VARIABLES)),$($(_files.v)))) -$(eval $(foreach t,$(files.groups),files.sys.$t ?=$(at.nl))) -files.sys = $(sort $(foreach _files.v,$(filter files.sys.%,$(.VARIABLES)),$($(_files.v)))) +# define files.out.$(group) files.sys.$(group) for every files.group +$(eval $(foreach t,$(files.groups),files.out.$t ?=$(at.nl)files.sys.$t ?=$(at.nl))) + +# define files.src, files.out, and files.sys aggregates +$(eval \ + files.src = $$(sort $(foreach _files.v,$(filter files.src.%,$(.VARIABLES)),$$($(_files.v))))$(at.nl)\ + files.out = $$(sort $(foreach _files.v,$(filter files.out.%,$(.VARIABLES)),$$($(_files.v))))$(at.nl)\ + files.sys = $$(sort $(foreach _files.v,$(filter files.sys.%,$(.VARIABLES)),$$($(_files.v))))) diff --git a/build-aux/Makefile.each.head/zz-mod.mk b/build-aux/Makefile.each.head/zz-mod.mk deleted file mode 100644 index b83c223..0000000 --- a/build-aux/Makefile.each.head/zz-mod.mk +++ /dev/null @@ -1 +0,0 @@ -_mod.each := $(sort $(_mod.each) $(filter-out $(_mod.once),$(_mod.vars))) diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk new file mode 100644 index 0000000..df363b5 --- /dev/null +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -0,0 +1 @@ +_dist.files := $(strip $(_dist.files) $(_files.src)) diff --git a/build-aux/Makefile.each.tail/00-mod.mk b/build-aux/Makefile.each.tail/00-mod.mk new file mode 100644 index 0000000..6346173 --- /dev/null +++ b/build-aux/Makefile.each.tail/00-mod.mk @@ -0,0 +1,41 @@ +# 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 . + +$(outdir)/at-variables $(outdir)/at-variables-local: _mod.VARIABLES := $(filter-out $(call _mod.quote-pattern,$(_at.VARIABLES)),$(.VARIABLES)) +$(outdir)/at-variables-global: + @printf '%s\n' $(call _mod.quote-shell-each,$(sort $(.VARIABLES))) +$(outdir)/at-variables-local: + @printf '%s\n' $(call _mod.quote-shell-each,$(sort $(_mod.VARIABLES))) +$(outdir)/at-variables $(outdir)/at-values: + @printf '%s\n' $(call _mod.quote-shell-each,$(sort $(.VARIABLES),$(_mod.VARIABLES))) +$(outdir)/at-variables/%: + @printf '%s\n' $(call _mod.quote-shell,$($*)) +$(outdir)/at-values/%: + @printf '%s\n' $(call _mod.quote-shell,$(value $*)) +.PHONY: $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values) +at.targets += $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values at-variables/% at-values/%) + +$(outdir)/at-modules: + @printf 'Autothing modules used in this project:\n' + @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call _mod.quote-shell,$(_mod.tmp) $(mod.$(_mod.tmp).description)))|column -t -s $$'\t' +$(addprefix $(outdir)/at-modules/,$(_mod.modules)): $(outdir)/at-modules/%: + @printf 'Name : %s\n' $(call _mod.quote-shell,$*) + @printf 'Description : %s\n' $(call _mod.quote-shell,$(mod.$*.description)) + @echo 'Contains Files :' $(call _mod.quote-shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk)))) + @echo 'Depends on :' $(mod.$*.depends) + +$(outdir)/at-noop: +.PHONY: $(outdir)/at-noop +at.targets += $(outdir)/at-noop diff --git a/build-aux/Makefile.each.tail/10-nested.mk b/build-aux/Makefile.each.tail/10-nested.mk index e9d02ca..5e5a40b 100644 --- a/build-aux/Makefile.each.tail/10-nested.mk +++ b/build-aux/Makefile.each.tail/10-nested.mk @@ -13,7 +13,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -$(addprefix $(outdir)/,$(nested.targets)): $(outdir)/%: $(addsuffix /%,$(call at.addprefix,$(outdir),$(nested.subdirs))) +$(eval $(foreach _tmp.nested,$(nested.targets),\ + $$(outdir)/$(_tmp.nested): $$(addsuffix /$(_tmp.nested),$$(call at.addprefix,$$(outdir),$$(nested.subdirs)))$(at.nl))) .PHONY: $(addprefix $(outdir)/,$(nested.targets)) at.subdirs += $(nested.subdirs) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 105432c..c2ce307 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -24,13 +24,13 @@ ifeq ($(origin _at.NO_ONCE),undefined) # These 4 functions are all $(call _at.func,parent,child) _at.is_strict_subdir = $(filter $(abspath $1)/%,$(abspath $2)) _at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_at.relbase = $(strip \ - $(if $(call _at.is_subdir,$1,$2), \ - $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ +_at.relbase = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst %/.,$(patsubst $(abspath $1)/%,%,$(abspath $2)/.)), \ $(abspath $2))) -_at.relto = $(strip \ - $(if $(call _at.is_subdir,$1,$2), \ - $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ +_at.relto = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst %/.,%,$(patsubst $(abspath $1)/%,%,$(abspath $2)/.)), \ ../$(call _at.relto,$(dir $1),$2))) # These 3 functions only take one operand; we define public multi-operand @@ -51,6 +51,8 @@ _at.target_variable = $(_at.target_variable.$(flavor $2)) _at.target_variable.recursive = $1: private $2 = $(subst $(at.nl),$$(at.nl),$(value $2)) _at.target_variable.simple = $1: private $2 := $$($2) +_at.quote-pattern = $(subst %,\%,$(subst \,\\,$1)) + # Sanity checking ###################################################### ifeq ($(filter undefine,$(.FEATURES)),) $(error Autothing: We need a version of Make that supports 'undefine') diff --git a/build-aux/Makefile.once.head/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk index 0e13ea2..e139096 100644 --- a/build-aux/Makefile.once.head/10-dist.mk +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -13,7 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -mod.dist.description = Make distribution tarballs +mod.dist.description = `dist` target for distribution tarballs # Developer configuration @@ -28,6 +28,8 @@ ifeq ($(dist.version),) $(error Autothing module: dist: dist.version must be set) endif +_dist.files = + # User configuration CP ?= cp diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk index 2af7bf8..5441735 100644 --- a/build-aux/Makefile.once.head/10-files.mk +++ b/build-aux/Makefile.once.head/10-files.mk @@ -24,7 +24,10 @@ files.generate ?= files.generate .DEFAULT_GOAL = $(files.default) # Standard creative PHONY targets -nested.targets += $(foreach g,$(files.groups), $g install-$g install-$gdirs) +nested.targets += $(files.generate) +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 diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk deleted file mode 100644 index c8410d4..0000000 --- a/build-aux/Makefile.once.head/10-lt.mk +++ /dev/null @@ -1,12 +0,0 @@ -mod.lt.description = Easy handling of libtool dependencies -mod.lt.deps += files - -_lt.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l))) -_lt.patsubst-all = $(if $1,$(call _sd.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3) -_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(_lt.tmp)),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(_lt.tmp)),$(_lt.tmp))) - -# The semantics for the de-dup bit are a bit weird. My head hurts thinking -# about them. TODO: clarify/simplify/something -lt.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys)))) -_lt.link_files = $(filter %.o %.lo %.la -l%,$(call _lt.unLIBPATTERNS$,$^)) -lt.link_files = $(filter-out $(call _lt.dups,$(_lt.link_files)),$(_lt.link_files)) diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk index 7917201..b0a5ac4 100644 --- a/build-aux/Makefile.once.head/10-write-ifchanged.mk +++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk @@ -1,3 +1,4 @@ -mod.write-ifchanged.description = build-aux/write-ifchanged helper script +mod.write-ifchanged.description = `write-ifchanged` auxiliary build script +mod.write-ifchanged.files += $(topsrcdir)/build-aux/write-ifchanged WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk index 7e52606..438f01e 100644 --- a/build-aux/Makefile.once.head/zz-mod.mk +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -13,14 +13,30 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -mod.mod.description = Print information about Autothing modules +mod.mod.description = Display information about Autothing modules -_mod.target = at-mod-info -_mod.modules := $(sort $(patsubst %.mk,%,$(filter %.mk,$(subst -, ,$(notdir $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk)))))) -_mod.quote = '$(subst ','\'',$1)' +# The trickery that is _mod.empty/_mod.space is from §6.2 of the GNU Make +# manual, "The Two Flavors of Variables". +_mod.empty := +_mod.space := $(_mod.empty) # +undefine _mod.empty +# _mod.rest is equivalent to GMSL rest. +_mod.rest = $(wordlist 2,$(words $1),$1) -$(eval $(foreach _mod.tmp,$(_mod.modules),mod.$(_mod.tmp).description ?=$(at.nl)mod.$(_mod.tmp).depends ?=$(at.nl))) +_mod.file2mod = $(foreach _mod.tmp,$(patsubst %.mk,%,$(notdir $1)),$(subst $(_mod.space),-,$(call _mod.rest,$(subst -, ,$(_mod.tmp))))) -_mod.vars = $(filter $(addsuffix .%,$(_mod.modules)),$(.VARIABLES)) -_mod.once := $(_mod.vars) -_mod.each := +_mod.modules := $(sort $(call _mod.file2mod,$(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk))) +undefine _mod.rest +undefine _mod.file2mod + +$(eval $(foreach _mod.tmp,$(_mod.modules),\ + mod.$(_mod.tmp).description ?=$(at.nl)\ + mod.$(_mod.tmp).depends ?=$(at.nl)\ + mod.$(_mod.tmp).files ?=$(at.nl))) + +_mod.quote-pattern = $(subst %,\%,$(subst \,\\,$1)) +_mod.quote-shell-each = $(foreach _mod.tmp,$1,$(call _mod.quote-shell,$(_mod.tmp))) + +# I put this as the last line in the file because it confuses Emacs syntax +# highlighting and makes the remainder of the file difficult to edit. +_mod.quote-shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index 6c6aaed..3fbe0c4 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -15,7 +15,7 @@ _dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 _dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3)) -$(topoutdir)/$(dist.pkgname)-$(dist.version): $(foreach v,$(filter std.src_files/% std.gen_files/%,$(.VARIABLES)),$($v)) +$(topoutdir)/$(dist.pkgname)-$(dist.version): $(_dist.files) $(RM) -r $@ $(@D)/.tmp.$(@F) $(MKDIR) $(@D)/.tmp.$(@F) $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/.tmp.$(@F),$f)$(at.nl)) diff --git a/build-aux/Makefile.once.tail/00-mod.mk b/build-aux/Makefile.once.tail/00-mod.mk deleted file mode 100644 index 68350f0..0000000 --- a/build-aux/Makefile.once.tail/00-mod.mk +++ /dev/null @@ -1,32 +0,0 @@ -# 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 . - -$(_mod.target): - @printf 'Autothing modules used in this project:\n' - @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call _mod.quote,$(_mod.tmp))) -$(addprefix $(_mod.target)/,$(_mod.modules)): $(_mod.target)/%: - @printf 'Module : %s ' $(call _mod.quote,$*) - @$(if $(at.mod.$*.description),printf ' - %s' $(call _mod.quote,mod.$*.description)) - @echo - @echo Depends on : $(mod.$*.depends) - @echo User configuration: - @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep -v -e ^'_' -e ^'$*' | column -t -s: |sed 's|^| |' - @echo Developer global inputs: - @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' - @echo Developer per-directory inputs: - @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.each.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' - @echo Developer outputs: - @egrep '^\s*[^:#]+\s*(|:|::)=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' -.PHONY: $(addprefix mod/,$(_mod.modules)) diff --git a/build-aux/Makefile.once.tail/00-noop.mk b/build-aux/Makefile.once.tail/00-noop.mk deleted file mode 100644 index bac2ec1..0000000 --- a/build-aux/Makefile.once.tail/00-noop.mk +++ /dev/null @@ -1,2 +0,0 @@ -noop: -.PHONY: noop diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index aeba2d1..2e4adc6 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -22,7 +22,7 @@ _at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) # Clean the environment $(eval \ - $(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)),\ + $(foreach _at.tmp_variable,$(filter-out $(call _at.quote-pattern,_at.tmp_variable $(_at.VARIABLES)),$(.VARIABLES)),\ $(call _at.target_variable,$(_at.tmp_targets),$(_at.tmp_variable))$(at.nl)\ undefine $(_at.tmp_variable)$(at.nl))) -- cgit v1.2.3-54-g00ecf From f97cfec567d54e883e1b868714b6beee5420ba2d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 17 Aug 2016 01:33:02 -0400 Subject: (systemd) more --- build-aux/Makefile.each.tail/00-mod.mk | 20 ++++++++++---------- build-aux/Makefile.once.head/00-quote.mk | 23 +++++++++++++++++++++++ build-aux/Makefile.once.head/zz-mod.mk | 8 +------- 3 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 build-aux/Makefile.once.head/00-quote.mk diff --git a/build-aux/Makefile.each.tail/00-mod.mk b/build-aux/Makefile.each.tail/00-mod.mk index 6346173..dc1a2fe 100644 --- a/build-aux/Makefile.each.tail/00-mod.mk +++ b/build-aux/Makefile.each.tail/00-mod.mk @@ -13,27 +13,27 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -$(outdir)/at-variables $(outdir)/at-variables-local: _mod.VARIABLES := $(filter-out $(call _mod.quote-pattern,$(_at.VARIABLES)),$(.VARIABLES)) +$(outdir)/at-variables $(outdir)/at-variables-local: _mod.VARIABLES := $(filter-out $(call quote.pattern,$(_at.VARIABLES)),$(.VARIABLES)) $(outdir)/at-variables-global: - @printf '%s\n' $(call _mod.quote-shell-each,$(sort $(.VARIABLES))) + @printf '%s\n' $(call quote.shell-each,$(sort $(.VARIABLES))) $(outdir)/at-variables-local: - @printf '%s\n' $(call _mod.quote-shell-each,$(sort $(_mod.VARIABLES))) + @printf '%s\n' $(call quote.shell-each,$(sort $(_mod.VARIABLES))) $(outdir)/at-variables $(outdir)/at-values: - @printf '%s\n' $(call _mod.quote-shell-each,$(sort $(.VARIABLES),$(_mod.VARIABLES))) + @printf '%s\n' $(call quote.shell-each,$(sort $(.VARIABLES),$(_mod.VARIABLES))) $(outdir)/at-variables/%: - @printf '%s\n' $(call _mod.quote-shell,$($*)) + @printf '%s\n' $(call quote.shell,$($*)) $(outdir)/at-values/%: - @printf '%s\n' $(call _mod.quote-shell,$(value $*)) + @printf '%s\n' $(call quote.shell,$(value $*)) .PHONY: $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values) at.targets += $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values at-variables/% at-values/%) $(outdir)/at-modules: @printf 'Autothing modules used in this project:\n' - @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call _mod.quote-shell,$(_mod.tmp) $(mod.$(_mod.tmp).description)))|column -t -s $$'\t' + @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call quote.shell,$(_mod.tmp) $(mod.$(_mod.tmp).description)))|column -t -s $$'\t' $(addprefix $(outdir)/at-modules/,$(_mod.modules)): $(outdir)/at-modules/%: - @printf 'Name : %s\n' $(call _mod.quote-shell,$*) - @printf 'Description : %s\n' $(call _mod.quote-shell,$(mod.$*.description)) - @echo 'Contains Files :' $(call _mod.quote-shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk)))) + @printf 'Name : %s\n' $(call quote.shell,$*) + @printf 'Description : %s\n' $(call quote.shell,$(mod.$*.description)) + @echo 'Contains Files :' $(call quote.shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk)))) @echo 'Depends on :' $(mod.$*.depends) $(outdir)/at-noop: diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk new file mode 100644 index 0000000..23be614 --- /dev/null +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -0,0 +1,23 @@ +# 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 . + +mod.quote.description = Macros to quote tricky strings + +quote.pattern = $(subst %,\%,$(subst \,\\,$1)) +quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_mod.tmp))) + +# I put this as the last line in the file because it confuses Emacs syntax +# highlighting and makes the remainder of the file difficult to edit. +quote.shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk index 438f01e..732f1e1 100644 --- a/build-aux/Makefile.once.head/zz-mod.mk +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -14,6 +14,7 @@ # along with this program. If not, see . mod.mod.description = Display information about Autothing modules +mod.mod.depends += quote # The trickery that is _mod.empty/_mod.space is from §6.2 of the GNU Make # manual, "The Two Flavors of Variables". @@ -33,10 +34,3 @@ $(eval $(foreach _mod.tmp,$(_mod.modules),\ mod.$(_mod.tmp).description ?=$(at.nl)\ mod.$(_mod.tmp).depends ?=$(at.nl)\ mod.$(_mod.tmp).files ?=$(at.nl))) - -_mod.quote-pattern = $(subst %,\%,$(subst \,\\,$1)) -_mod.quote-shell-each = $(foreach _mod.tmp,$1,$(call _mod.quote-shell,$(_mod.tmp))) - -# I put this as the last line in the file because it confuses Emacs syntax -# highlighting and makes the remainder of the file difficult to edit. -_mod.quote-shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') -- cgit v1.2.3-54-g00ecf From 2728d489673f1d97a43e4f8d888b3591c233cfb7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Sep 2016 14:42:55 -0400 Subject: (systemd) build-aux: gitfiles --- build-aux/Makefile.each.head/00-gitfiles.mk | 20 ++++++++++++++++++ build-aux/Makefile.once.head/00-gitfiles.mk | 32 +++++++++++++++++++++++++++++ build-aux/Makefile.once.head/00-quote.mk | 8 +++++++- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 build-aux/Makefile.each.head/00-gitfiles.mk create mode 100644 build-aux/Makefile.once.head/00-gitfiles.mk diff --git a/build-aux/Makefile.each.head/00-gitfiles.mk b/build-aux/Makefile.each.head/00-gitfiles.mk new file mode 100644 index 0000000..b872912 --- /dev/null +++ b/build-aux/Makefile.each.head/00-gitfiles.mk @@ -0,0 +1,20 @@ +# 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 . + +ifeq ($(abspath $(topsrcdir)),$(abspath $(srcdir))) +files.src.gen += $(gitfiles.file) +endif + +files.src.src += $(_gitfiles.dir.src) diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk new file mode 100644 index 0000000..95437aa --- /dev/null +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -0,0 +1,32 @@ +# 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 . + +mod.gitfiles.description = Automatically populate files.src.src from git +mod.gitfiles.depends += files nested write-ifchanged quote + +gitfiles.file ?= Makefile-src.mk + +_gitfiles.all = +-include $(topsrcdir)/$(gitfiles.file) + +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) $@ +.PHONY: _gitfiles.FORCE +endif + +_gitfiles.dir = $(call at.relto,$(topsrcdir),$(srcdir)) +_gitfiles.dir.all = $(patsubst $(_gitfiles.dir)/%,%,$(filter $(_gitfiles.dir)/%,$(_gitfiles.all))) +_gitfiles.dir.src = $(filter-out $(addsuffix /%,$(nested.subdirs)),$(_gitfiles.dir.all)) diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 23be614..17f6307 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -15,7 +15,13 @@ mod.quote.description = Macros to quote tricky strings -quote.pattern = $(subst %,\%,$(subst \,\\,$1)) +_quote.backslash = $(if $1,$(call _quote.backslash,$(wordlist 2,$(words $1),$1),$(subst $(firstword $1),\$(firstword $1),$2)),$2) + +quote.var = $(subst $(at.nl),\$(at.nl),$(subst $$,$$$$,$1)) +quote.pattern = $(call _quote.backslash, \ % ,$1) +quote.ere = $(call _quote.backslash, \ ^ . [ $$ ( ) | * + ? { ,$1) +quote.bre = $(call _quote.backslash, \ ^ . [ $$ * ,$1) + quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_mod.tmp))) # I put this as the last line in the file because it confuses Emacs syntax -- cgit v1.2.3-54-g00ecf From 8cf92796b94f8a7d1e4b27fbf86b3c790194cb6f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Sep 2016 16:06:45 -0400 Subject: (systemd) build-aux: quote.shell-each: fix --- build-aux/Makefile.once.head/00-quote.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 17f6307..9fce401 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -22,7 +22,7 @@ quote.pattern = $(call _quote.backslash, \ % ,$1) quote.ere = $(call _quote.backslash, \ ^ . [ $$ ( ) | * + ? { ,$1) quote.bre = $(call _quote.backslash, \ ^ . [ $$ * ,$1) -quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_mod.tmp))) +quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_quote.tmp))) # I put this as the last line in the file because it confuses Emacs syntax # highlighting and makes the remainder of the file difficult to edit. -- cgit v1.2.3-54-g00ecf From 8191cd39e9884464d526f48e8b85cf5b434d5dd5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 6 Sep 2016 23:14:55 -0400 Subject: (systemd) gitfiles: mv Makefile-src.mk gitfiles.mk --- build-aux/Makefile.once.head/00-gitfiles.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index 95437aa..b17b63a 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -16,7 +16,7 @@ mod.gitfiles.description = Automatically populate files.src.src from git mod.gitfiles.depends += files nested write-ifchanged quote -gitfiles.file ?= Makefile-src.mk +gitfiles.file ?= gitfiles.mk _gitfiles.all = -include $(topsrcdir)/$(gitfiles.file) -- cgit v1.2.3-54-g00ecf From 7af3811df0e4d8707d8218361dd305f42df62be2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 7 Sep 2016 01:20:54 -0400 Subject: (systemd) build-aux: add var and write-atomic modules --- build-aux/Makefile.each.tail/00-var.mk | 22 ++++++++++++++++++++++ build-aux/Makefile.once.head/00-var.mk | 18 ++++++++++++++++++ build-aux/Makefile.once.head/10-write-atomic.mk | 4 ++++ build-aux/write-atomic | 21 +++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 build-aux/Makefile.each.tail/00-var.mk create mode 100644 build-aux/Makefile.once.head/00-var.mk create mode 100644 build-aux/Makefile.once.head/10-write-atomic.mk create mode 100755 build-aux/write-atomic diff --git a/build-aux/Makefile.each.tail/00-var.mk b/build-aux/Makefile.each.tail/00-var.mk new file mode 100644 index 0000000..c2fd9d7 --- /dev/null +++ b/build-aux/Makefile.each.tail/00-var.mk @@ -0,0 +1,22 @@ +# 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 . + +mod.var.depends += quote write-ifchanged + +$(outdir)/.var.%: _var.FORCE + @printf '%s' $(call quote.shell,$($*)) | sed 's/^/#/' | $(WRITE_IFCHANGED) $@ +-include $(wildcard $(outdir)/.var.*) + +at.targets += $(addprefix $(outdir)/,.var.%) diff --git a/build-aux/Makefile.once.head/00-var.mk b/build-aux/Makefile.once.head/00-var.mk new file mode 100644 index 0000000..d1e537e --- /dev/null +++ b/build-aux/Makefile.once.head/00-var.mk @@ -0,0 +1,18 @@ +# 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 . + +mod.var.description = Depend on the values of variables + +.PHONY: _var.FORCE diff --git a/build-aux/Makefile.once.head/10-write-atomic.mk b/build-aux/Makefile.once.head/10-write-atomic.mk new file mode 100644 index 0000000..f099ae2 --- /dev/null +++ b/build-aux/Makefile.once.head/10-write-atomic.mk @@ -0,0 +1,4 @@ +mod.write-atomic.description = `write-atomic` auxiliary build script +mod.write-atomic.files += $(topsrcdir)/build-aux/write-atomic + +WRITE_ATOMIC ?= $(topsrcdir)/build-aux/write-atomic diff --git a/build-aux/write-atomic b/build-aux/write-atomic new file mode 100755 index 0000000..efb2551 --- /dev/null +++ b/build-aux/write-atomic @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Copyright (C) 2015-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 . + +outfile=$1 +tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}" + +cat > "$tmpfile" || { r=$?; rm -f "$tmpfile"; exit $r; } +mv -f "$tmpfile" "$outfile" -- cgit v1.2.3-54-g00ecf From ab69b8e9b4666ba2ad89a27b07b6944feb82eadb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 21 Oct 2016 03:00:49 -0400 Subject: (systemd) wip --- build-aux/write-atomic | 2 +- build-aux/write-ifchanged | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-aux/write-atomic b/build-aux/write-atomic index efb2551..ab2a417 100755 --- a/build-aux/write-atomic +++ b/build-aux/write-atomic @@ -15,7 +15,7 @@ # along with this program. If not, see . outfile=$1 -tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}" +tmpfile="$(dirname "$outfile")/.tmp.${outfile##*/}.tmp" cat > "$tmpfile" || { r=$?; rm -f "$tmpfile"; exit $r; } mv -f "$tmpfile" "$outfile" diff --git a/build-aux/write-ifchanged b/build-aux/write-ifchanged index 185ceb0..84dfd6e 100755 --- a/build-aux/write-ifchanged +++ b/build-aux/write-ifchanged @@ -15,7 +15,7 @@ # along with this program. If not, see . outfile=$1 -tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}" +tmpfile="$(dirname "$outfile")/.tmp.${outfile##*/}.tmp" cat > "$tmpfile" || exit $? if cmp -s "$tmpfile" "$outfile"; then -- cgit v1.2.3-54-g00ecf From 95d18493a5d3399993053b94cb1fc4542699f884 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 28 Oct 2016 12:45:33 -0400 Subject: (systemd) Autothing documentation --- build-aux/Makefile.README.old.txt | 161 +++++++++++++ build-aux/Makefile.README.txt | 262 +++++++++------------ build-aux/Makefile.each.tail/00-dist.mk | 2 +- build-aux/Makefile.each.tail/00-mod.mk | 13 +- build-aux/Makefile.once.head/00-gitfiles.mk | 41 ++++ build-aux/Makefile.once.head/00-quote.mk | 23 +- build-aux/Makefile.once.head/00-var.mk | 14 ++ build-aux/Makefile.once.head/10-dist.mk | 34 +++ build-aux/Makefile.once.head/10-files.mk | 39 +++ build-aux/Makefile.once.head/10-gnuconf.mk | 17 +- build-aux/Makefile.once.head/10-nested.mk | 26 ++ build-aux/Makefile.once.head/10-write-atomic.mk | 18 ++ build-aux/Makefile.once.head/10-write-ifchanged.mk | 18 ++ build-aux/Makefile.once.head/zz-mod.mk | 22 ++ build-aux/Makefile.once.tail/00-dist.mk | 1 + 15 files changed, 523 insertions(+), 168 deletions(-) create mode 100644 build-aux/Makefile.README.old.txt diff --git a/build-aux/Makefile.README.old.txt b/build-aux/Makefile.README.old.txt new file mode 100644 index 0000000..b0a0965 --- /dev/null +++ b/build-aux/Makefile.README.old.txt @@ -0,0 +1,161 @@ +Obsolete +======== + +The following was written for previous versions of Autothing. I'm leaving it +here for now because I'll likely canibalize it for other bits of documentation, +either for Autothing itself, the `files` module, or the `dist` module. + +High-level overview +------------------- + +Now, what this does for you is: + + (search for the paper +"Recursive Make Considered Harmful") As harmful as recursive make is, +it's historically been difficult to to write non-recursive Makefiles. +This makes it easy. + +It also makes it easy to follow the GNU standards for your makefiles: +it takes care of this entire table of .PHONY targets for you: + +| this | and this | are aliases for this | +|------+------------------+--------------------------------------------------------| +| all | build | $(outdir)/build | +| | install | $(outdir)/install | +| | uninstall | $(outdir)/uninstall | +| | mostlyclean | $(outdir)/mostlyclean | +| | clean | $(outdir)/clean | +| | distclean | $(outdir)/distclean | +| | maintainer-clean | $(outdir)/maintainer-clean | +| | check | $(outdir)/check (not implemented for you) | +| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) | + +(You are still responsible for implementing the `$(outdir)/check` +target in each of your Makefiles.) + +What you have to do is: + +In each source directory, you write a `Makefile`, very similarly to if +you were writing for plain GNU Make, with + + topoutdir ?= ... + topsrcdir ?= ... + include $(topsrcdir)/build-aux/Makefile.head.mk + + # your makefile + + include $(topsrcdir)/build-aux/Makefile.tail.mk + +And in the top-level source directory, Write your own helper makefiles +that get included: + - `common.once.head.mk`: before parsing any of your Makefiles + - `common.each.head.mk`: before parsing each of your Makefiles + - `common.each.tail.mk`: after parsing each of your Makefiles + - `common.each.tail.mk`: after parsing all of your Makefiles + +The `common.*.mk` makefiles are nice for including generic pattern +rules and variables that aren't specific to a directory. + +You're probably thinking that this sounds too good to be true! +Unfortunately, there are two major deviations from writing a plain +recursive Makefile: + + 1. all targets and prerequisites (including .PHONY targets!) need to + be prefixed with + `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`. + * sub-gotcha: this means that if a pattern rule has a + prerequisite that may be in srcdir or outdir, then it must be + specified twice, once for each case. + 2. if a prerequisite is in a directory "owned" by another Makefile, + you must filter the pathname through `am_path`: + `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain + a `..` segment; if you need to refer to a sibling directory, do it + relative to `$(topoutdir)` or `$(topsrcdir)`. + +Telling automake about your program +----------------------------------- + +You tell automake what to do for you by setting some variables. They +are all prefixed with `am_`; this prefix may be changed by editing the +`_am` variable at the top of `automake.head.mk`. + +The exception to this is the `am_path` variable, which is a macro that +is used to make a list of filenames relative to the appropriate +directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't +nescessarily equal to `.`. See above. + +There are several commands that generate files; simply record the list +of files that each command generates as the following variable +variables: + +| Variable | Create Command | Delete Command | Description | Relative to | +|--------------+----------------+-----------------------------+-----------------------------------+-------------| +| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir | +| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | +| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | +| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | +| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR | + +In addition, there are two more variables that control not how files +are created, but how they are deleted: + +| Variable | Affected command | Description | Relative to | +|----------------+------------------+------------------------------------------------+-------------| +| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir | +| | | files in `$(am_out_files)`. (Example: `*.o`) | | +|----------------+------------------+------------------------------------------------+-------------| +| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | +| | | _not_ be deleted. (otherwise, `mostlyclean` | | +| | | is the same as `clean`) | | + +Finally, there are two variables that express the relationships +between directories: + +| Variable | Description | +|------------+---------------------------------------------------------| +| am_subdirs | A list of other directories (containing Makefiles) that | +| | may be considered "children" of this | +| | directory/Makefile; building a phony target in this | +| | directory should also build it in the subdirectory. | +| | They are not necesarily actually subdirectories of this | +| | directory in the filesystem. | +|------------+---------------------------------------------------------| +| am_depdirs | A list of other directories (containing Makefiles) that | +| | contain or generate files that are dependencies of | +| | targets in this directory. They are not necesarily | +| | actually subdirectories of this directory in the | +| | filesystem. Except for files that are dependencies of | +| | files in this directory, things in the dependency | +| | directory will not be built. | + +Tips, notes +----------- + +I like to have the first (non-comment) line in a Makefile be: + + include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk + +(adjusting the number of `../` sequences as nescessary). Then, my +(user-editable) `config.mk` is of the form: + + ifeq ($(topsrcdir),) + topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) + topsrcdir := $(topoutdir) + + # your configuration + + endif + +If the package has a `./configure` script, then I have it modifiy +topsrcdir as necessary, as well as modifying whatever other parts of +the configuration. All of the configuration lives in `config.mk`; +`./configure` doesn't modify any `Makefile`s, it just generates +`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to +`$(outdir)/Makefile`. + +---- +Copyright (C) 2016 Luke Shumaker + +This documentation file is placed into the public domain. If that is +not possible in your legal system, I grant you permission to use it in +absolutely every way that I can legally grant to you. diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt index e06ba52..3be7a9d 100644 --- a/build-aux/Makefile.README.txt +++ b/build-aux/Makefile.README.txt @@ -1,160 +1,108 @@ -Luke's AutoMake -=============== - -Yo, this document is incomplete. It describes the magical -automake.{head,tail}.mk Makefiles and how to use them, kinda. - -I wrote a "clone" of automake. I say clone, because it works -differently. Yeah, I need a new name for it. - -High-level overview -------------------- - -Now, what this does for you is: - -It makes it _easy_ to write non-recursive Makefiles--and ones that are -similar to plain recursive Makefiles, at that! (search for the paper -"Recursive Make Considered Harmful") As harmful as recursive make is, -it's historically been difficult to to write non-recursive Makefiles. -This makes it easy. - -It also makes it easy to follow the GNU standards for your makefiles: -it takes care of this entire table of .PHONY targets for you: - -| this | and this | are aliases for this | -|------+------------------+--------------------------------------------------------| -| all | build | $(outdir)/build | -| | install | $(outdir)/install | -| | uninstall | $(outdir)/uninstall | -| | mostlyclean | $(outdir)/mostlyclean | -| | clean | $(outdir)/clean | -| | distclean | $(outdir)/distclean | -| | maintainer-clean | $(outdir)/maintainer-clean | -| | check | $(outdir)/check (not implemented for you) | -| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) | - -(You are still responsible for implementing the `$(outdir)/check` -target in each of your Makefiles.) - -What you have to do is: - -In each source directory, you write a `Makefile`, very similarly to if -you were writing for plain GNU Make, with - - topoutdir ?= ... - topsrcdir ?= ... - include $(topsrcdir)/build-aux/Makefile.head.mk - - # your makefile - - include $(topsrcdir)/build-aux/Makefile.tail.mk - -And in the top-level source directory, Write your own helper makefiles -that get included: - - `common.once.head.mk`: before parsing any of your Makefiles - - `common.each.head.mk`: before parsing each of your Makefiles - - `common.each.tail.mk`: after parsing each of your Makefiles - - `common.each.tail.mk`: after parsing all of your Makefiles - -The `common.*.mk` makefiles are nice for including generic pattern -rules and variables that aren't specific to a directory. - -You're probably thinking that this sounds too good to be true! -Unfortunately, there are two major deviations from writing a plain -recursive Makefile: - - 1. all targets and prerequisites (including .PHONY targets!) need to - be prefixed with - `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`. - * sub-gotcha: this means that if a pattern rule has a - prerequisite that may be in srcdir or outdir, then it must be - specified twice, once for each case. - 2. if a prerequisite is in a directory "owned" by another Makefile, - you must filter the pathname through `am_path`: - `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain - a `..` segment; if you need to refer to a sibling directory, do it - relative to `$(topoutdir)` or `$(topsrcdir)`. - -Telling automake about your program ------------------------------------ - -You tell automake what to do for you by setting some variables. They -are all prefixed with `am_`; this prefix may be changed by editing the -`_am` variable at the top of `automake.head.mk`. - -The exception to this is the `am_path` variable, which is a macro that -is used to make a list of filenames relative to the appropriate -directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't -nescessarily equal to `.`. See above. - -There are several commands that generate files; simply record the list -of files that each command generates as the following variable -variables: - -| Variable | Create Command | Delete Command | Description | Relative to | -|--------------+----------------+-----------------------------+-----------------------------------+-------------| -| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir | -| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | -| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | -| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | -| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR | - -In addition, there are two more variables that control not how files -are created, but how they are deleted: - -| Variable | Affected command | Description | Relative to | -|----------------+------------------+------------------------------------------------+-------------| -| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir | -| | | files in `$(am_out_files)`. (Example: `*.o`) | | -|----------------+------------------+------------------------------------------------+-------------| -| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | -| | | _not_ be deleted. (otherwise, `mostlyclean` | | -| | | is the same as `clean`) | | - -Finally, there are two variables that express the relationships -between directories: - -| Variable | Description | -|------------+---------------------------------------------------------| -| am_subdirs | A list of other directories (containing Makefiles) that | -| | may be considered "children" of this | -| | directory/Makefile; building a phony target in this | -| | directory should also build it in the subdirectory. | -| | They are not necesarily actually subdirectories of this | -| | directory in the filesystem. | -|------------+---------------------------------------------------------| -| am_depdirs | A list of other directories (containing Makefiles) that | -| | contain or generate files that are dependencies of | -| | targets in this directory. They are not necesarily | -| | actually subdirectories of this directory in the | -| | filesystem. Except for files that are dependencies of | -| | files in this directory, things in the dependency | -| | directory will not be built. | - -Tips, notes ------------ - -I like to have the first (non-comment) line in a Makefile be: - - include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk - -(adjusting the number of `../` sequences as nescessary). Then, my -(user-editable) `config.mk` is of the form: - - ifeq ($(topsrcdir),) - topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) - topsrcdir := $(topoutdir) - - # your configuration - - endif - -If the package has a `./configure` script, then I have it modifiy -topsrcdir as necessary, as well as modifying whatever other parts of -the configuration. All of the configuration lives in `config.mk`; -`./configure` doesn't modify any `Makefile`s, it just generates -`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to -`$(outdir)/Makefile`. +# -*- Mode: markdown -*- + +Autothing 3: The smart way to write GNU Makefiles +================================================= + +Autothing is a thing that does things automatically. + +Ok, more helpfully: Autothing is a pair of .mk Makefile fragments that +you can `include` from your Makefiles to make them easier to write; +specifically, it makes it _easy_ to write non-recursive Makefiles--and +ones that are similar to plain recursive Makefiles, at that! + +Synopsis +-------- + +Write your makefiles of the form: + + topsrcdir ?= ... + topoutdir ?= ... + at.Makefile ?= Makefile # Optional + include $(topsrcdir)/build-aux/Makefile.head.mk + + $(outdir)/%.o: $(srcdir)/%.c: + $(CC) -c -o $@ $< + + $(outdir)/hello: $(outdir)/hello.o + + at.subdirs = ... + at.targets = ... + + include $(topsrcdir)/build-aux/Makefile.tail.mk + +This is similar to, but not quite, the comfortable way that you probably +already write your Makefiles. + +Details +------- + +There are two fundamental things that Autothing provides: + + 1. Variable namespacing + 2. Tools for dealing with paths + +The first is important because globals are bad for composability. + +The second is important because GNU Make is too dumb to know that +`foo/bar/../baz` == `foo/baz`. + +Then, there's something that maybe doesn't belong, but I didn't have the heart +to cut it out: + + 3. A module (plugin) system. + +The module system is "important" because there are very often common bits that +you want to be included in every Makefile, and this gives some structure to +that. + +Requirements: + - A version of GNU Make that supports `undefine`. (TODO: check which version + of GNU Make introduced this feature) + +Inputs: + - In each `Makefile`: + - Before `Makefile.head.mk`: + - Variable (mandatory) : `topoutdir` + - Variable (mandatory) : `topsrcdir` (must not be a subdirectory of `$(topoutdir)`) + - Variable (optional) : `at.Makefile` (Default: `Makefile`) + - Between `Makefile.head.mk` and `Makefile.tail.mk`: + - Variable: `at.targets` (Default: empty) + - Variable: `at.subdirs` (Default: empty) + - Files: + - `${topsrcdir}/build-aux/Makefile.{each,once}.{head,tail}/*.mk` + +Outputs: + - Global: + - Variable (function): `$(call at.is_subdir, parent, child)` + - Variable (function): `$(call at.is_strict_subdir, parent, child)` + - Variable (function): `$(call at.relbase, parent, children...)` + - Variable (function): `$(call at.relto, parent, children...)` + - Variable (function): `$(call at.path, paths...)` + - Variable (function): `$(call at.out2src, paths...)` + - Variable (function): `$(call at.addprefix, prefix, paths...)` + - Per-directory: + - Variable: `$(outdir)` + - Variable: `$(srcdir)` + +TODO: actually explain things. + +Motivation/Exposition +--------------------- + +This section needs rewritten. Or really just written. + +Other projects like GNU Automake were created to plaster over differences +between make(1) implementations; however, this isn't all that Automake +provides, it also makes it easy to do complex things that users want, or the +GNU Coding Standards require. That's silly. + +Autothing does depend on GNU Make; other make(1) implementations will +not work. However, if you are open to adding GNU Make as a +dependency, then Autothing should obviate the need for GNU Automake, +while also making your Makefiles better. + + Peter Miller (1997) "Recursive Make Considered Harmful" + ---- Copyright (C) 2016 Luke Shumaker diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk index df363b5..bc2a3d5 100644 --- a/build-aux/Makefile.each.tail/00-dist.mk +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -1 +1 @@ -_dist.files := $(strip $(_dist.files) $(_files.src)) +_dist.files := $(strip $(_dist.files) $(call at.addprefix,$(srcdir),$(files.src))) diff --git a/build-aux/Makefile.each.tail/00-mod.mk b/build-aux/Makefile.each.tail/00-mod.mk index dc1a2fe..5b77436 100644 --- a/build-aux/Makefile.each.tail/00-mod.mk +++ b/build-aux/Makefile.each.tail/00-mod.mk @@ -29,12 +29,15 @@ at.targets += $(addprefix $(outdir)/, at-variables-global at-variables-local at- $(outdir)/at-modules: @printf 'Autothing modules used in this project:\n' - @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call quote.shell,$(_mod.tmp) $(mod.$(_mod.tmp).description)))|column -t -s $$'\t' + @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call quote.shell,$(_mod.tmp) $(mod.$(_mod.tmp).description) $(if $(value mod.$(_mod.tmp).doc),(more))))|column -t -s $$'\t' $(addprefix $(outdir)/at-modules/,$(_mod.modules)): $(outdir)/at-modules/%: - @printf 'Name : %s\n' $(call quote.shell,$*) - @printf 'Description : %s\n' $(call quote.shell,$(mod.$*.description)) - @echo 'Contains Files :' $(call quote.shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk)))) - @echo 'Depends on :' $(mod.$*.depends) + @printf 'Name : %s\n' $(call quote.shell,$*) + @printf 'Description : %s\n' $(call quote.shell,$(mod.$*.description)) + @echo 'Depends on :' $(sort $(mod.$*.depends)) + @echo 'Files :' + @printf ' %s\n' $(call quote.shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk)))) + @echo 'Documentation :' + @printf '%s\n' $(call quote.shell,$(value mod.$*.doc)) | sed -e 's/^# / /' -e 's/^#//' $(outdir)/at-noop: .PHONY: $(outdir)/at-noop diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index b17b63a..faae91d 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -15,6 +15,47 @@ mod.gitfiles.description = Automatically populate files.src.src from git mod.gitfiles.depends += files nested write-ifchanged quote +mod.gitfiles.files += $(topsrcdir)/$(gitfiles.file) +define mod.gitfiles.doc +# Inputs: +# - Global variable : `gitfiles.file` (Default: gitfiles.mk) +# - Directory variable : `nested.subdirs` +# - External : git +# Outputs: +# - File : `$(topsrcdir)/$(gitfiles.file)` +# - Directory variable : `files.src.src` +# - Directory variable : `files.src.gen` (only in top dir) +# +# The `files` module has a variable (`files.src.src`) that you (the +# developer) set to list "pure" source files; the type of files that you +# would check into a version control system. Since you are a +# responsible developer, you use a version control system. Since the +# computer is already maintaining a list of these files *in the VCS*, +# why should you--a filthy human--need to also maintain the list? Enter +# gitfiles, which will talk to git to maintain `files.src.src`, but +# won't require that the git repository be distributed to +# installing-users. +# +# If `$(topsrcdir)/.git` exists, then it will generate +# `$(topsrcdir)/$(gitfiles.file)`. Otherwise, it will assume that +# `$(topsrcdir)/$(gitfiles.file)` already exists. +# +# It will use the information in `$(topsrcdir)/$(gitfiles.file)` to +# append to `files.src.src` in each directory +# +# Finally, since the generated `$(topsrcdir)/$(gitfiles.file)` must be +# distributed to users, it is added to $(topsrcdirs)'s `files.src.gen`. +# +# When setting `files.src.src`, it needs to know which files "belong" to +# the current directory directly, and which "belong" to a further +# 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`. +endef gitfiles.file ?= gitfiles.mk diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 9fce401..4c954b1 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -14,6 +14,24 @@ # along with this program. If not, see . mod.quote.description = Macros to quote tricky strings +define mod.quote.doc +# Inputs: +# (none) +# Outputs: +# - Global variable: `quote.var` : GNU Make variables +# - Global variable: `quote.pattern` : GNU Make patterns +# - Global variable: `quote.ere` : POSIX Extended Regular Expressions +# - Global variable: `quote.bre` : POSIX Basic Regular Expressions +# - Global variable: `quote.shell` : POSIX sh(1) strings +# - Global variable: `quote.shell-each`: POSIX sh(1) strings +# +# Escaping/quoting things is hard! This module provides a number of +# functions to escape/quote strings for various contexts. +# +# `quote.shell-each` quotes each list-item separately (munging +# whitespace), while `quote.shell` keeps them as one string (preserving +# whitespace). +endef _quote.backslash = $(if $1,$(call _quote.backslash,$(wordlist 2,$(words $1),$1),$(subst $(firstword $1),\$(firstword $1),$2)),$2) @@ -24,6 +42,7 @@ quote.bre = $(call _quote.backslash, \ ^ . [ $$ * ,$1) quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_quote.tmp))) -# I put this as the last line in the file because it confuses Emacs syntax -# highlighting and makes the remainder of the file difficult to edit. +# I put this as the last line in the file because it confuses Emacs +# syntax highlighting and makes the remainder of the file difficult to +# edit. quote.shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') diff --git a/build-aux/Makefile.once.head/00-var.mk b/build-aux/Makefile.once.head/00-var.mk index d1e537e..636bbb0 100644 --- a/build-aux/Makefile.once.head/00-var.mk +++ b/build-aux/Makefile.once.head/00-var.mk @@ -14,5 +14,19 @@ # along with this program. If not, see . mod.var.description = Depend on the values of variables +define mod.var.doc +# Inputs: +# (user-defined) +# Outputs: +# Target : `$(outdir)/.var.%` +# Directory variable: `at.targets` +# +# 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`. +endef .PHONY: _var.FORCE diff --git a/build-aux/Makefile.once.head/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk index e139096..8c68d04 100644 --- a/build-aux/Makefile.once.head/10-dist.mk +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -14,6 +14,40 @@ # along with this program. If not, see . mod.dist.description = `dist` target for distribution tarballs +define mod.dist.doc +# User variables: +# - `CP ?= cp` +# - `GZIP ?= gzip` +# - `MKDIR ?= mkdir` +# - `MKDIR_P ?= mkdir -p` +# - `MV ?= mv` +# - `RM ?= rm -f` +# - `TAR ?= tar` +# - `GZIPFLAGS ?= $(GZIP_ENV)` +# - `GZIP_ENV ?= --best` (only used via `GZIPFLAGS`, not directly) +# Inputs: +# - Global variable : `dist.exts` (Default: `.tar.gz`) +# - Global variable : `dist.pkgname` (Default: first of PACKAGE_TARNAME PACKAGE PACKAGE_NAME) +# - Global variable : `dist.version` (Default: first of PACKAGE_VERSION VERSION) +# - Directory variable : `files.src` +# Outputs: +# - Directory variable : `files.out.int` (only in top dir) +# - .PHONY Target : `$(outdir)/dist` +# - Target : `$(topoutdir)/$(dist.pkgname)-$(dist.version)` +# - Target : `$(topoutdir)/$(dist.pkgname)-$(dist.version).tar` +# - Target : `$(topoutdir)/$(dist.pkgname)-$(dist.version).tar.gz` +# +# Provide the standard `dist` .PHONY target, based on the `files` module +# information. +# +# You may change the default compression target easily via the +# `dist.exts` variable, but you must define the rule for it manually. +# +# Bugs: +# +# The tarball isn't reproducible. It uses file-system ordering of +# files, and includes timestamps. +endef # Developer configuration diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk index 5441735..9d27ae9 100644 --- a/build-aux/Makefile.once.head/10-files.mk +++ b/build-aux/Makefile.once.head/10-files.mk @@ -15,6 +15,45 @@ mod.files.description = Keeping track of groups of files mod.files.depends += nested +define mod.files.doc +# User variables: +# - `DESTDIR ?=` +# - `RM ?= rm -f` +# - `RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty` +# - `TRUE ?= true` +# Inputs: +# - Global variable : `files.groups ?= all` +# - 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...)) +# Outputs: +# - Global variable : `nested.targets` +# - Global variable : `at.targets` +# - Global variable : `.DEFAULT_GOAL = $(files.default)` +# - Creative .PHONY targets: +# - `$(outdir)/$(files.generate))` +# - `$(addprefix $(outdir)/,$(files.groups))` +# - `$(outdir)/installdirs` +# - `$(outdir)/install` +# - Destructive .PHONY targets: +# - `$(outdir)/uninstall` +# - `$(outdir)/mostlyclean` +# - `$(outdir)/clean` +# - `$(outdir)/distclean` +# - `$(outdir)/maintainer-clean` +# - `$(outdir)/$(files.vcsclean)` +# +# TODO: prose documentation +endef files.groups ?= all files.default ?= all diff --git a/build-aux/Makefile.once.head/10-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk index c07cfb5..6d641bb 100644 --- a/build-aux/Makefile.once.head/10-gnuconf.mk +++ b/build-aux/Makefile.once.head/10-gnuconf.mk @@ -13,10 +13,21 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -# This file is based on §7.2 "Makefile Conventions" of the release of -# the GNU Coding Standards dated July 25, 2016. - mod.gnuconf.description = GNU standard configuration variables +define mod.gnuconf.doc +# Inputs: +# - Global variable: `gnuconf.pkgname` +# (Default: `$(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))`) +# Outputs: +# (see below) +# +# This module defines default values (using `?=`) a huge list of +# variables specified in the GNU Coding Standards that installing-users +# expect to be able to set. +# +# This is based on §7.2 "Makefile Conventions" of the July 25, 2016 +# release of the GNU Coding Standards. +endef gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) ifeq ($(gnuconf.pkgname),) diff --git a/build-aux/Makefile.once.head/10-nested.mk b/build-aux/Makefile.once.head/10-nested.mk index af9fdf7..72e15ab 100644 --- a/build-aux/Makefile.once.head/10-nested.mk +++ b/build-aux/Makefile.once.head/10-nested.mk @@ -14,5 +14,31 @@ # along with this program. If not, see . mod.nested.description = Easy nested .PHONY targets +define mod.nested.doc +# Inputs: +# - Global variable : `nested.targets` +# - Directory variable : `nested.subdirs` +# Outputs: +# - .PHONY Targets : `$(addprefix $(outdir)/,$(nested.targets))` +# - Variable : `at.subdirs` +# +# The Autothing `at.subdirs` slates a subdirectory's Makefile for inclusion, +# but doesn't help with recursive targets like `all`, `install`, or `clean`, +# which one would expect to descend into subdirectories. Enter `nested`: +# Define a global list of targets that are recursive/nested, and then in each +# directory define a list of subdirectries that one would expect them to +# recurse into. +# +# Directories added to `nested.subdirs` are automatically added to `at.subdirs` +# during the each.tail phase. +# +# It may help to think of at.subdirs and nested.subdirs in terms of their +# Automake conterparts: +# +# | Autothing | GNU Automake | +# +----------------+--------------+ +# | at.subdirs | DIST_SUBDIRS | +# | nested.subdirs | SUBDIRS | +endef nested.targets ?= diff --git a/build-aux/Makefile.once.head/10-write-atomic.mk b/build-aux/Makefile.once.head/10-write-atomic.mk index f099ae2..ce6acd8 100644 --- a/build-aux/Makefile.once.head/10-write-atomic.mk +++ b/build-aux/Makefile.once.head/10-write-atomic.mk @@ -1,4 +1,22 @@ mod.write-atomic.description = `write-atomic` auxiliary build script mod.write-atomic.files += $(topsrcdir)/build-aux/write-atomic +define mod.write-atomic.doc +# User variables: +# - `WRITE_ATOMIC ?= $(topsrcdir)/build-aux/write-atomic` +# Inputs: +# (none) +# Outputs: +# (none) +# +# The $(WRITE_ATOMIC) program reads a file from stdin, and writes it to +# the file named in argv[1], but does so atomically. +# +# That is, the following lines are almost equivalient: +# +# ... > $@ +# ... | $(WRITE_ATOMIC) $@ +# +# The are only different in that one is atomic, while the other is not. +endef WRITE_ATOMIC ?= $(topsrcdir)/build-aux/write-atomic diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk index b0a5ac4..5abb3ce 100644 --- a/build-aux/Makefile.once.head/10-write-ifchanged.mk +++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk @@ -1,4 +1,22 @@ mod.write-ifchanged.description = `write-ifchanged` auxiliary build script mod.write-ifchanged.files += $(topsrcdir)/build-aux/write-ifchanged +define mod.write-ifchanged.doc +# User variables: +# - `WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged` +# Inputs: +# (none) +# Outputs: +# (none) +# +# The $(WRITE_IFCHANGED) program reads a file from stdin, and writes it to the +# file named in argv[1], but does so atomically, but more importantly, does so +# in a way that does not bump the file's ctime if the new content is the same +# as the old content. +# +# That is, the following lines are almost equivalient: +# +# ... > $@ +# ... | $(WRITE_ATOMIC) $@ +endef WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk index 732f1e1..1b12a2f 100644 --- a/build-aux/Makefile.once.head/zz-mod.mk +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -15,6 +15,28 @@ mod.mod.description = Display information about Autothing modules mod.mod.depends += quote +define mod.mod.doc +# Inputs: +# - Files : `$(topsrcdir)/build-aux/Makefile.*/??-*.mk` +# - Global variable : `mod.*.name` +# - Global variable : `mod.*.description` +# - Global variable : `mod.*.depends` +# - Global variable : `mod.*.files` +# - Global variable : `mod.*.doc` +# Outputs: +# - Directory variable : `at.targets` +# - .PHONY Target : `$(outdir)/at-variables-local` +# - .PHONY Target : `$(outdir)/at-variables-global` +# - .PHONY Target : `$(outdir)/at-variables` +# - .PHONY Target : `$(outdir)/at-variables/%` +# - .PHONY Target : `$(outdir)/at-values` +# - .PHONY Target : `$(outdir)/at-values/%` +# - .PHONY Target : `$(outdir)/at-modules` +# - .PHONY Target : `$(outdir)/at-modules/%` +# - .PHONY Target : `$(outdir)/at-noop` +# +# TODO: prose documentation +endef # The trickery that is _mod.empty/_mod.space is from §6.2 of the GNU Make # manual, "The Two Flavors of Variables". diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index 3fbe0c4..a890d9d 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -21,6 +21,7 @@ $(topoutdir)/$(dist.pkgname)-$(dist.version): $(_dist.files) $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/.tmp.$(@F),$f)$(at.nl)) $(MV) $(@D)/.tmp.$(@F) $@ || $(RM) -r $(@D)/.tmp.$(@F) +# TODO: The tar rule isn't reproducible, it should be. $(topoutdir)/$(dist.pkgname)-$(dist.version).tar: %.tar: % $(TAR) cf $@ -C $( Date: Sun, 30 Oct 2016 19:27:23 -0400 Subject: (systemd) at: mod: don't call on .doc --- build-aux/Makefile.each.tail/00-mod.mk | 4 ++-- build-aux/Makefile.once.head/00-gitfiles.mk | 1 + build-aux/Makefile.once.head/00-quote.mk | 1 + build-aux/Makefile.once.head/00-var.mk | 1 + build-aux/Makefile.once.head/10-dist.mk | 1 + build-aux/Makefile.once.head/10-files.mk | 1 + build-aux/Makefile.once.head/10-gnuconf.mk | 1 + build-aux/Makefile.once.head/10-nested.mk | 1 + build-aux/Makefile.once.head/10-write-atomic.mk | 1 + build-aux/Makefile.once.head/10-write-ifchanged.mk | 1 + build-aux/Makefile.once.head/zz-mod.mk | 5 +++-- 11 files changed, 14 insertions(+), 4 deletions(-) diff --git a/build-aux/Makefile.each.tail/00-mod.mk b/build-aux/Makefile.each.tail/00-mod.mk index 5b77436..d6514dd 100644 --- a/build-aux/Makefile.each.tail/00-mod.mk +++ b/build-aux/Makefile.each.tail/00-mod.mk @@ -29,7 +29,7 @@ at.targets += $(addprefix $(outdir)/, at-variables-global at-variables-local at- $(outdir)/at-modules: @printf 'Autothing modules used in this project:\n' - @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call quote.shell,$(_mod.tmp) $(mod.$(_mod.tmp).description) $(if $(value mod.$(_mod.tmp).doc),(more))))|column -t -s $$'\t' + @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call quote.shell,$(_mod.tmp) $(mod.$(_mod.tmp).description) $(if $(mod.$(_mod.tmp).doc),(more))))|column -t -s $$'\t' $(addprefix $(outdir)/at-modules/,$(_mod.modules)): $(outdir)/at-modules/%: @printf 'Name : %s\n' $(call quote.shell,$*) @printf 'Description : %s\n' $(call quote.shell,$(mod.$*.description)) @@ -37,7 +37,7 @@ $(addprefix $(outdir)/at-modules/,$(_mod.modules)): $(outdir)/at-modules/%: @echo 'Files :' @printf ' %s\n' $(call quote.shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk)))) @echo 'Documentation :' - @printf '%s\n' $(call quote.shell,$(value mod.$*.doc)) | sed -e 's/^# / /' -e 's/^#//' + @printf '%s\n' $(call quote.shell,$(mod.$*.doc)) | sed -e 's/^# / /' -e 's/^#//' $(outdir)/at-noop: .PHONY: $(outdir)/at-noop diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index faae91d..1214e50 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -56,6 +56,7 @@ define mod.gitfiles.doc # 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) gitfiles.file ?= gitfiles.mk diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk index 4c954b1..94bc943 100644 --- a/build-aux/Makefile.once.head/00-quote.mk +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -32,6 +32,7 @@ define mod.quote.doc # whitespace), while `quote.shell` keeps them as one string (preserving # whitespace). endef +mod.quote.doc := $(value mod.quote.doc) _quote.backslash = $(if $1,$(call _quote.backslash,$(wordlist 2,$(words $1),$1),$(subst $(firstword $1),\$(firstword $1),$2)),$2) diff --git a/build-aux/Makefile.once.head/00-var.mk b/build-aux/Makefile.once.head/00-var.mk index 636bbb0..1f50f21 100644 --- a/build-aux/Makefile.once.head/00-var.mk +++ b/build-aux/Makefile.once.head/00-var.mk @@ -28,5 +28,6 @@ define mod.var.doc # With this module, to depend on the value of a variable, depend on # `$(outdir)/.var.VARNAME`. endef +mod.var.doc := $(value mod.var.doc) .PHONY: _var.FORCE diff --git a/build-aux/Makefile.once.head/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk index 8c68d04..831ca12 100644 --- a/build-aux/Makefile.once.head/10-dist.mk +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -48,6 +48,7 @@ define mod.dist.doc # The tarball isn't reproducible. It uses file-system ordering of # files, and includes timestamps. endef +mod.dist.doc := $(value mod.dist.doc) # Developer configuration diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk index 9d27ae9..e697a88 100644 --- a/build-aux/Makefile.once.head/10-files.mk +++ b/build-aux/Makefile.once.head/10-files.mk @@ -54,6 +54,7 @@ define mod.files.doc # # TODO: prose documentation endef +mod.files.doc := $(value mod.files.doc) files.groups ?= all files.default ?= all diff --git a/build-aux/Makefile.once.head/10-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk index 6d641bb..a4b7696 100644 --- a/build-aux/Makefile.once.head/10-gnuconf.mk +++ b/build-aux/Makefile.once.head/10-gnuconf.mk @@ -28,6 +28,7 @@ define mod.gnuconf.doc # This is based on §7.2 "Makefile Conventions" of the July 25, 2016 # release of the GNU Coding Standards. endef +mod.gnuconf.doc := $(value mod.gnuconf.doc) gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) ifeq ($(gnuconf.pkgname),) diff --git a/build-aux/Makefile.once.head/10-nested.mk b/build-aux/Makefile.once.head/10-nested.mk index 72e15ab..4f181a9 100644 --- a/build-aux/Makefile.once.head/10-nested.mk +++ b/build-aux/Makefile.once.head/10-nested.mk @@ -40,5 +40,6 @@ define mod.nested.doc # | at.subdirs | DIST_SUBDIRS | # | nested.subdirs | SUBDIRS | endef +mod.nested.doc := $(value mod.nested.doc) nested.targets ?= diff --git a/build-aux/Makefile.once.head/10-write-atomic.mk b/build-aux/Makefile.once.head/10-write-atomic.mk index ce6acd8..c4aa808 100644 --- a/build-aux/Makefile.once.head/10-write-atomic.mk +++ b/build-aux/Makefile.once.head/10-write-atomic.mk @@ -18,5 +18,6 @@ define mod.write-atomic.doc # # The are only different in that one is atomic, while the other is not. endef +mod.write-atomic.doc := $(value mod.write-atomic.doc) WRITE_ATOMIC ?= $(topsrcdir)/build-aux/write-atomic diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk index 5abb3ce..649aab9 100644 --- a/build-aux/Makefile.once.head/10-write-ifchanged.mk +++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk @@ -18,5 +18,6 @@ define mod.write-ifchanged.doc # ... > $@ # ... | $(WRITE_ATOMIC) $@ endef +mod.write-ifchanged.doc := $(value mod.write-ifchanged.doc) WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk index 1b12a2f..95d251d 100644 --- a/build-aux/Makefile.once.head/zz-mod.mk +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -18,7 +18,6 @@ mod.mod.depends += quote define mod.mod.doc # Inputs: # - Files : `$(topsrcdir)/build-aux/Makefile.*/??-*.mk` -# - Global variable : `mod.*.name` # - Global variable : `mod.*.description` # - Global variable : `mod.*.depends` # - Global variable : `mod.*.files` @@ -37,6 +36,7 @@ define mod.mod.doc # # TODO: prose documentation endef +mod.mod.doc := $(value mod.mod.doc) # The trickery that is _mod.empty/_mod.space is from §6.2 of the GNU Make # manual, "The Two Flavors of Variables". @@ -55,4 +55,5 @@ undefine _mod.file2mod $(eval $(foreach _mod.tmp,$(_mod.modules),\ mod.$(_mod.tmp).description ?=$(at.nl)\ mod.$(_mod.tmp).depends ?=$(at.nl)\ - mod.$(_mod.tmp).files ?=$(at.nl))) + mod.$(_mod.tmp).files ?=$(at.nl)\ + mod.$(_mod.tmp).doc ?=$(at.nl))) -- cgit v1.2.3-54-g00ecf From a5986ad30296a9138c7943298759526f71a510de Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 30 Oct 2016 19:28:47 -0400 Subject: (systemd) at: files: add missing things to documentaton --- build-aux/Makefile.once.head/10-files.mk | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk index e697a88..f6fcf30 100644 --- a/build-aux/Makefile.once.head/10-files.mk +++ b/build-aux/Makefile.once.head/10-files.mk @@ -36,14 +36,18 @@ define mod.files.doc # - Directory variable : `files.out.$(files.groups)` (well, $(addprefix...)) # - Directory variable : `files.sys.$(files.groups)` (well, $(addprefix...)) # Outputs: -# - Global variable : `nested.targets` -# - Global variable : `at.targets` -# - Global variable : `.DEFAULT_GOAL = $(files.default)` +# - Global variable : `nested.targets` +# - Global variable : `at.targets` +# - Global variable : `.DEFAULT_GOAL = $(files.default)` +# - Directory variable : `files.src` +# - Directory variable : `files.out` +# - Directory variable : `files.sys` # - Creative .PHONY targets: # - `$(outdir)/$(files.generate))` -# - `$(addprefix $(outdir)/,$(files.groups))` -# - `$(outdir)/installdirs` +# - `$(outdir)/$(group)` for `group` in `$(files.groups)` # - `$(outdir)/install` +# - `$(outdir)/install-$(group)` for `group` in `$(filter-out $(files.default),$(files.groups))` +# - `$(outdir)/installdirs` # - Destructive .PHONY targets: # - `$(outdir)/uninstall` # - `$(outdir)/mostlyclean` @@ -52,6 +56,9 @@ define mod.files.doc # - `$(outdir)/maintainer-clean` # - `$(outdir)/$(files.vcsclean)` # +# Basic `*` wildcards are supported. Use `*`, not `%`; it will automatically +# substitute `*`->`%` where appropriate. +# # TODO: prose documentation endef mod.files.doc := $(value mod.files.doc) -- cgit v1.2.3-54-g00ecf From 33ab91cdc94926977f921c3a741df80d66ba6de9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 14 Jan 2017 23:40:09 -0500 Subject: gnuconf: Was missing CPPFLAGS --- build-aux/Makefile.once.head/10-gnuconf.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-aux/Makefile.once.head/10-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk index a4b7696..e24dfa1 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 @@ -101,6 +101,8 @@ TEXI2DVIFLAGS ?= YACC ?= yacc YFLAGS ?= # YFLAGS instead of YACCFLAGS +CPPFLAGS ?= + LN_S ?= ln -s # TODO[2] CHGRP ?= chgrp -- cgit v1.2.3-54-g00ecf From e9619e3afa0d961eac0b0dbb3f4b7be11bbf4cfc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 14 Jan 2017 23:42:36 -0500 Subject: Update config.mk.in --- config.mk.in | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 99 insertions(+), 15 deletions(-) diff --git a/config.mk.in b/config.mk.in index ffe7c1c..be95ab4 100644 --- a/config.mk.in +++ b/config.mk.in @@ -1,15 +1,38 @@ -# This file is based on §7.2 "Makefile Conventions" of the release of -# the GNU Coding Standards dated April 13, 2016. +# 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 . + +# This is based on §7.2 "Makefile Conventions" of the July 25, 2016 +# release of the GNU Coding Standards. +# +# Grep for '^##' in this file to see which Autoconf macros it depends +# on. dist.pkgname = @PACKAGE_TARNAME@ -gnu.pkgname = @PACKAGE_NAME@ +gnuconf.pkgname = @PACKAGE_NAME@ -# AC_PROG_{AWK,GREP,EGREP,FGREP,INSTALL,MKDIR_P,SED} # 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? + +## AC_PROG_AWK +## AC_PROG_GREP +## AC_PROG_EGREP +## AC_PROG_SED + AWK = @AWK@ CAT = cat CMP = cmp @@ -38,33 +61,83 @@ TOUCH = touch TR = tr TRUE = true +# 7.2.2: Utilities in Makefiles/7.2.3: Variables for Specifying Commands +# ---------------------------------------------------------------------- + +# Standard user-configurable programs. +# +# The list of programs here is specified in §7.2.2, but the associated FLAGS +# variables are specified in §7.2.3. I found it cleaner to list them together. + +## AC_PROG_INSTALL # @INSTALL@ @INSTALL_PROGRAM@ @INSTALL_SCRIPT@ @INSTALL_DATA@ +## AC_PROG_LEX # @LEX@ @LEXLIB@ +## AC_PROG_RANLIB +## AC_PROG_YACC +## AC_PROG_CC +# +# TODO: What causes Autoconf to define @AR@? + AR = @AR@ +ARFLAGS = BISON = bison +BISONFLAGS = CC = @CC@ +CFLAGS = @CFLAGS@ # CFLAGS instead of CCFLAGS FLEX = flex +FLEXFLAGS = INSTALL = @INSTALL@ +# There is no INSTALLFLAGS[0] LD = ld -LDCONFIG = ldconfig +LDFLAGS = @LDFLAGS@ +LDCONFIG = ldconfig # TODO[1] +LDCONFIGFLAGS = LEX = @LEX@ +LFLAGS = #LFLAGS instead of LEXFLAGS +#MAKE MAKEINFO = makeinfo +MAKEINFOFLAGS = RANLIB = @RANLIB@ +RANLIBFLAGS = TEXI2DVI = texi2dvi +TEXI2DVIFLAGS = YACC = @YACC@ +YFLAGS = # YFLAGS instead of YACCFLAGS + +CPPFLAGS = @CPPFLAGS@ -# 7.2.3 Variables for Specifying Commands -# --------------------------------------- +LN_S = @LN_S@ + +CHGRP = chgrp +CHGRPFLAGS = +CHMOD = chmod +CHMODFLAGS = +CHOWN = chown +CHOWNFLAGS = +MKNOD = mknod +MKNODFLAGS = + +# [0]: There is no INSTALLFLAGS because it would be inconsistent with how the +# standards otherwise recommend using $(INSTALL); with INSTALL_PROGRAM and +# INSTALL_DATA; which are specified in a way precluding the use of +# INSTALLFLAGS. To have the variable, but to ignore it in the common case +# would be confusing. +# +# [1]: The RANLIB and LDCONFIG variables need some extra smarts; §7.2.2 says: +# +# > When you use ranlib or ldconfig, you should make sure nothing bad +# > happens if the system does not have the program in question. Arrange +# > to ignore an error from that command, and print a message before the +# > command to tell the user that failure of this command does not mean a +# > problem. (The Autoconf ‘AC_PROG_RANLIB’ macro can help with this.) + +# 7.2.3: Variables for Specifying Commands +# ---------------------------------------- INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ -STRIP = strip -TEXI2HTML = $(MAKEINFO) --html -TEXI2PDF = $(TEXI2DVI) --pdf -TEXI2PS = $(TEXI2DVI) --ps -MKDIR_P = @MKDIR_P@ - -# 7.2.5 Variables for Installation Directories -# -------------------------------------------- +# 7.2.5: Variables for Installation Directories +# --------------------------------------------- # Root for the installation prefix = @prefix@ @@ -112,3 +185,14 @@ man5ext = .5 man6ext = .6 man7ext = .7 man8ext = .8 + +# 7.2.7: Install Command Categories +# --------------------------------- + +PRE_INSTALL = +POST_INSTALL = +NORMAL_INSTALL = + +PRE_UNINSTALL = +POST_UNINSTALL = +NORMAL_UNINSTALL = -- cgit v1.2.3-54-g00ecf From 648cb00973eeb224bec85cf5b69cffca150cdf65 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 14 Jan 2017 23:55:15 -0500 Subject: Add a top-level Makefile for documentation purposes. --- .gitignore | 1 + Makefile | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cc39a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/gitfiles.mk diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cd5a79c --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +dist.pkgname = autothing +dist.version = 1.0 +gnuconf.pkgname = autothing + +topoutdir ?= . +topsrcdir ?= . +include $(topsrcdir)/build-aux/Makefile.head.mk +include $(topsrcdir)/build-aux/Makefile.tail.mk -- cgit v1.2.3-54-g00ecf From 6819ff36a37ceb091cb793875e6f4529c0bccc1a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 15 Jan 2017 01:34:04 -0500 Subject: mod: gitfiles: doc: re-flow a paragraph --- build-aux/Makefile.once.head/00-gitfiles.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index 1214e50..dbb4ae9 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-gitfiles.mk @@ -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) -- cgit v1.2.3-54-g00ecf From 5eb6e559d6665f4210be95fe46f1d0a6007dd734 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 15 Jan 2017 01:44:18 -0500 Subject: mod: files: fix a misplaced paren --- build-aux/Makefile.each.tail/10-files.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk index 8ab187b..3bb3bc2 100644 --- a/build-aux/Makefile.each.tail/10-files.mk +++ b/build-aux/Makefile.each.tail/10-files.mk @@ -34,7 +34,7 @@ $(eval \ $(foreach _files.g,$(files.groups),\ $$(outdir)/$(_files.g): $$(_files.out.$(_files.g))$(at.nl))\ $(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ - $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g)))$(at.nl)) + $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g))$(at.nl))) # Destructive targets _files.uninstall = $(_files.sys) -- cgit v1.2.3-54-g00ecf From cbee7a272b1f61843d596da913093acf77506481 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 15 Jan 2017 01:44:37 -0500 Subject: Tidy the gnustuff (and fork off gnudoc). --- build-aux/Makefile.each.head/00-gnudoc.mk | 16 +++++++++ build-aux/Makefile.each.tail/11-gnudoc.mk | 42 ++++++++++++++++++++++ build-aux/Makefile.each.tail/11-gnustuff.mk | 45 +++-------------------- build-aux/Makefile.once.head/10-gnudoc.mk | 53 +++++++++++++++++++++++++++ build-aux/Makefile.once.head/10-gnustuff.mk | 56 +++++++++++++++++++++++++++++ build-aux/Makefile.once.head/11-gnustuff.mk | 34 ------------------ build-aux/Makefile.once.tail/11-gnustuff.mk | 4 +-- 7 files changed, 173 insertions(+), 77 deletions(-) create mode 100644 build-aux/Makefile.each.head/00-gnudoc.mk create mode 100644 build-aux/Makefile.each.tail/11-gnudoc.mk create mode 100644 build-aux/Makefile.once.head/10-gnudoc.mk create mode 100644 build-aux/Makefile.once.head/10-gnustuff.mk delete mode 100644 build-aux/Makefile.once.head/11-gnustuff.mk diff --git a/build-aux/Makefile.each.head/00-gnudoc.mk b/build-aux/Makefile.each.head/00-gnudoc.mk new file mode 100644 index 0000000..631d576 --- /dev/null +++ b/build-aux/Makefile.each.head/00-gnudoc.mk @@ -0,0 +1,16 @@ +# 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 . + +gnudoc.docs ?= diff --git a/build-aux/Makefile.each.tail/11-gnudoc.mk b/build-aux/Makefile.each.tail/11-gnudoc.mk new file mode 100644 index 0000000..1df4d73 --- /dev/null +++ b/build-aux/Makefile.each.tail/11-gnudoc.mk @@ -0,0 +1,42 @@ +# 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 . + +$(outdir)/info : $(addsuffix .info,$(gnudoc.docs)) +files.src.gen += $(addsuffix .info,$(gnudoc.docs)) +files.out.dvi += $(addsuffix .dvi ,$(gnudoc.docs)) +files.out.html += $(addsuffix .html,$(gnudoc.docs)) +files.out.pdf += $(addsuffix .pdf ,$(gnudoc.docs)) +files.out.ps += $(addsuffix .ps ,$(gnudoc.docs)) + +files.sys.all += $(foreach f,$(gnudoc.docs), $(infodir)/$f.info ) +files.sys.dvi += $(foreach f,$(gnudoc.docs), $(dvidir)/$f.dvi ) +files.sys.html += $(foreach f,$(gnudoc.docs), $(htmldir)/$f.html ) +files.sys.pdf += $(foreach f,$(gnudoc.docs), $(pdfdir)/$f.pdf ) +files.sys.ps += $(foreach f,$(gnudoc.docs), $(psdir)/$f.ps ) + +$(outdir)/install: + $(POST_INSTALL) + $(foreach f,$(gnudoc.docs),$(INSTALL_INFO) $(DESTDIR)$(infodir)/$f.info $(DESTDIR)$(infodir)/dir$(at.nl)) + +$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< +$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< diff --git a/build-aux/Makefile.each.tail/11-gnustuff.mk b/build-aux/Makefile.each.tail/11-gnustuff.mk index 790efad..d89d204 100644 --- a/build-aux/Makefile.each.tail/11-gnustuff.mk +++ b/build-aux/Makefile.each.tail/11-gnustuff.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 @@ -12,49 +12,12 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -# 7.2.6: Standard Targets for Users -# --------------------------------- - -std.gen_files += $(foreach f,$(gnustuff.info_docs), $f.info ) -std.sys_files += $(foreach f,$(gnustuff.info_docs), $(infodir)/$f.info ) - $(foreach d,$(gnustuff.program_dirs),$(eval $(call _gnustuff.install_program,$d))) $(foreach d,$(gnustuff.data_dirs) ,$(eval $(call _gnustuff.install_data,$d))) -#all: std -install: - $(foreach f,$(gnustuff.info_docs),$(INSTALL_INFO) $(DESTDIR)$(infodir)/$f.info $(DESTDIR)$(infodir)/dir$(at.nl)) -$(outdir)/install-html: $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(htmldir)/$f.html ) -$(outdir)/install-dvi : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) -$(outdir)/install-pdf : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) -$(outdir)/install-ps : $(foreach f,$(gnustuff.info_docs), $(DESTDIR)$(psdir)/$f.ps ) -#uninstall: std $(outdir)/install-strip: install $(STRIP) $(filter $(addsuffix /%,$(gnustuff.program_dirs)),$(std.sys_files/$(@D))) -#clean: std -#distclean: std -#mostlyclean: std -#maintainer-clean: std -TAGS: TODO -$(outdir)/info: $(addsuffix .info,$(gnustuff.info_docs)) -$(outdir)/dvi : $(addsuffix .dvi ,$(gnustuff.info_docs)) -$(outdir)/html: $(addsuffix .html,$(gnustuff.info_docs)) -$(outdir)/pdf : $(addsuffix .pdf ,$(gnustuff.info_docs)) -$(outdir)/ps : $(addsuffix .ps ,$(gnustuff.info_docs)) -#dist:dist -check: TODO -installcheck: TODO -#installdirs: std -$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< -$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< -#installdirs: std +#TAGS: TODO +#check: TODO +#installcheck: TODO diff --git a/build-aux/Makefile.once.head/10-gnudoc.mk b/build-aux/Makefile.once.head/10-gnudoc.mk new file mode 100644 index 0000000..a53c89f --- /dev/null +++ b/build-aux/Makefile.once.head/10-gnudoc.mk @@ -0,0 +1,53 @@ +# 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 . + +mod.gnudoc.description = GNU Info page support +mod.gnudoc.depends += files nested gnuconf +define mod.gnudoc.doc +# User variables (in addition to gnuconf): +# - `TEXI2HTML ?= makeinfo --html` +# - `TEXI2PDF ?= texi2pdf` +# - `TEXI2PS ?= texi2dvi --ps` +# Inputs: +# - Directory variable : `gnudoc.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` +# - .PHONY target : `$(outdir)/install` (see below) +# - Target : `$(outdir)/%.info` +# - Target : `$(outdir)/%.dvi` +# - target : `$(outdir)/%.html` +# - target : `$(outdir)/%.pdf` +# - Target : `$(outdir)/%.ps` +# +# The The `gnudoc + +# The module counts on the `$(outdir)/install` target being defined by +# `files`, but not having a rule that executes once the dependencies +# have been taken care of; it adds a "post-install" rule to add the +# info files to the index. +endef +mod.gnudoc.doc := $(value mod.gnudoc.doc) + +TEXI2HTML ?= makeinfo --html +TEXI2PDF ?= texi2pdf +TEXI2PS ?= texi2dvi --ps + +files.groups += html dvi pdf ps +nested.targets += info diff --git a/build-aux/Makefile.once.head/10-gnustuff.mk b/build-aux/Makefile.once.head/10-gnustuff.mk new file mode 100644 index 0000000..759e48a --- /dev/null +++ b/build-aux/Makefile.once.head/10-gnustuff.mk @@ -0,0 +1,56 @@ +# 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 . + +mod.gnustuff.description = Misc parts of the GNU Coding Standards +mod.gnustuff.depends += files nested +define mod.gnustuff.doc +# User variables: +# - `STRIP ?= strip` +# - `MKDIR_P ?= mkdir -p` +# Inputs: +# - Global variable : `gnustuff.program_dirs ?= $(bindir) $(sbindir) $(libexecdir)` +# - Global variable : `gnustuff.data_dirs ?= +# - Global variable : `gnustuff.dirs ?= $(gnustuff.program_dirs) $(gnustuff.data_dirs) +# Outputs: +# - Global variable : `nested.targets += install-strip` +# - .PHONY target : `$(outdir)/install-strip` +# +# gnustuff.info_docs: +# The list of texinfo documents in the current directory, without +# the `.texi` suffix. +# +# gnustuff.program_dirs: +# Directories to use $(INSTALL_PROGRAM) for inserting files into. +# +# gnustuff.data_dirs: +# Directories to use $(INSTALL_DATA) for inserting files into. +# +# gnustuff.dirs: +# Directories to create +endef +mod.gnustuff.doc := $(value mod.gnustuff.doc) + +STRIP ?= strip +MKDIR_P ?= mkdir -p + +gnustuff.program_dirs ?= $(bindir) $(sbindir) $(libexecdir) +gnustuff.data_dirs ?= \ + $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) \ + $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) \ + $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) +gnustuff.dirs += $(gnu.program_dirs) $(gnu.data_dirs) + +nested.targets += install-strip diff --git a/build-aux/Makefile.once.head/11-gnustuff.mk b/build-aux/Makefile.once.head/11-gnustuff.mk deleted file mode 100644 index 800f6d2..0000000 --- a/build-aux/Makefile.once.head/11-gnustuff.mk +++ /dev/null @@ -1,34 +0,0 @@ -# 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 . - -STRIP ?= strip -TEXI2HTML ?= makeinfo --html -TEXI2PDF ?= texi2pdf -TEXI2PS ?= texi2dvi --ps -MKDIR_P ?= mkdir -p - -gnustuff.program_dirs += $(bindir) $(sbindir) $(libexecdir) -gnustuff.data_dirs += $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) -gnustuff.data_dirs += $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) -gnustuff.data_dirs += $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) - -gnustuff.info_docs ?= -std.dirlocal += gnustuff.info_docs - -gnustuff.dirs += $(gnu.program_dirs) $(gnu.data_dirs) - -at.phony += install-html install-dvi install-pdf install-ps -at.phony += info html dvi pdf ps -at.phony += install-strip diff --git a/build-aux/Makefile.once.tail/11-gnustuff.mk b/build-aux/Makefile.once.tail/11-gnustuff.mk index df5f192..e4b18c0 100644 --- a/build-aux/Makefile.once.tail/11-gnustuff.mk +++ b/build-aux/Makefile.once.tail/11-gnustuff.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 @@ -13,5 +13,5 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -$(gnu.dirs): +$(gnustuff.dirs): $(MKDIR_P) $@ -- cgit v1.2.3-54-g00ecf From 0a1826bd8b2fe2a374112c3218b5139aba40555d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 15 Jan 2017 01:51:02 -0500 Subject: Rename gnudoc->texinfo --- build-aux/Makefile.each.head/00-gnudoc.mk | 16 --------- build-aux/Makefile.each.head/00-texinfo.mk | 16 +++++++++ build-aux/Makefile.each.tail/11-gnudoc.mk | 42 ----------------------- build-aux/Makefile.each.tail/11-texinfo.mk | 42 +++++++++++++++++++++++ build-aux/Makefile.once.head/10-gnudoc.mk | 53 ------------------------------ build-aux/Makefile.once.head/10-texinfo.mk | 51 ++++++++++++++++++++++++++++ 6 files changed, 109 insertions(+), 111 deletions(-) delete mode 100644 build-aux/Makefile.each.head/00-gnudoc.mk create mode 100644 build-aux/Makefile.each.head/00-texinfo.mk delete mode 100644 build-aux/Makefile.each.tail/11-gnudoc.mk create mode 100644 build-aux/Makefile.each.tail/11-texinfo.mk delete mode 100644 build-aux/Makefile.once.head/10-gnudoc.mk create mode 100644 build-aux/Makefile.once.head/10-texinfo.mk diff --git a/build-aux/Makefile.each.head/00-gnudoc.mk b/build-aux/Makefile.each.head/00-gnudoc.mk deleted file mode 100644 index 631d576..0000000 --- a/build-aux/Makefile.each.head/00-gnudoc.mk +++ /dev/null @@ -1,16 +0,0 @@ -# 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 . - -gnudoc.docs ?= diff --git a/build-aux/Makefile.each.head/00-texinfo.mk b/build-aux/Makefile.each.head/00-texinfo.mk new file mode 100644 index 0000000..88aaeb5 --- /dev/null +++ b/build-aux/Makefile.each.head/00-texinfo.mk @@ -0,0 +1,16 @@ +# 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 . + +texinfo.docs ?= diff --git a/build-aux/Makefile.each.tail/11-gnudoc.mk b/build-aux/Makefile.each.tail/11-gnudoc.mk deleted file mode 100644 index 1df4d73..0000000 --- a/build-aux/Makefile.each.tail/11-gnudoc.mk +++ /dev/null @@ -1,42 +0,0 @@ -# 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 . - -$(outdir)/info : $(addsuffix .info,$(gnudoc.docs)) -files.src.gen += $(addsuffix .info,$(gnudoc.docs)) -files.out.dvi += $(addsuffix .dvi ,$(gnudoc.docs)) -files.out.html += $(addsuffix .html,$(gnudoc.docs)) -files.out.pdf += $(addsuffix .pdf ,$(gnudoc.docs)) -files.out.ps += $(addsuffix .ps ,$(gnudoc.docs)) - -files.sys.all += $(foreach f,$(gnudoc.docs), $(infodir)/$f.info ) -files.sys.dvi += $(foreach f,$(gnudoc.docs), $(dvidir)/$f.dvi ) -files.sys.html += $(foreach f,$(gnudoc.docs), $(htmldir)/$f.html ) -files.sys.pdf += $(foreach f,$(gnudoc.docs), $(pdfdir)/$f.pdf ) -files.sys.ps += $(foreach f,$(gnudoc.docs), $(psdir)/$f.ps ) - -$(outdir)/install: - $(POST_INSTALL) - $(foreach f,$(gnudoc.docs),$(INSTALL_INFO) $(DESTDIR)$(infodir)/$f.info $(DESTDIR)$(infodir)/dir$(at.nl)) - -$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< -$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< diff --git a/build-aux/Makefile.each.tail/11-texinfo.mk b/build-aux/Makefile.each.tail/11-texinfo.mk new file mode 100644 index 0000000..9491820 --- /dev/null +++ b/build-aux/Makefile.each.tail/11-texinfo.mk @@ -0,0 +1,42 @@ +# 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 . + +$(outdir)/info : $(addsuffix .info,$(texinfo.docs)) +files.src.gen += $(addsuffix .info,$(texinfo.docs)) +files.out.dvi += $(addsuffix .dvi ,$(texinfo.docs)) +files.out.html += $(addsuffix .html,$(texinfo.docs)) +files.out.pdf += $(addsuffix .pdf ,$(texinfo.docs)) +files.out.ps += $(addsuffix .ps ,$(texinfo.docs)) + +files.sys.all += $(foreach f,$(texinfo.docs), $(infodir)/$f.info ) +files.sys.dvi += $(foreach f,$(texinfo.docs), $(dvidir)/$f.dvi ) +files.sys.html += $(foreach f,$(texinfo.docs), $(htmldir)/$f.html ) +files.sys.pdf += $(foreach f,$(texinfo.docs), $(pdfdir)/$f.pdf ) +files.sys.ps += $(foreach f,$(texinfo.docs), $(psdir)/$f.ps ) + +$(outdir)/install: + $(POST_INSTALL) + $(foreach f,$(texinfo.docs),$(INSTALL_INFO) $(DESTDIR)$(infodir)/$f.info $(DESTDIR)$(infodir)/dir$(at.nl)) + +$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< +$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< diff --git a/build-aux/Makefile.once.head/10-gnudoc.mk b/build-aux/Makefile.once.head/10-gnudoc.mk deleted file mode 100644 index a53c89f..0000000 --- a/build-aux/Makefile.once.head/10-gnudoc.mk +++ /dev/null @@ -1,53 +0,0 @@ -# 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 . - -mod.gnudoc.description = GNU Info page support -mod.gnudoc.depends += files nested gnuconf -define mod.gnudoc.doc -# User variables (in addition to gnuconf): -# - `TEXI2HTML ?= makeinfo --html` -# - `TEXI2PDF ?= texi2pdf` -# - `TEXI2PS ?= texi2dvi --ps` -# Inputs: -# - Directory variable : `gnudoc.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` -# - .PHONY target : `$(outdir)/install` (see below) -# - Target : `$(outdir)/%.info` -# - Target : `$(outdir)/%.dvi` -# - target : `$(outdir)/%.html` -# - target : `$(outdir)/%.pdf` -# - Target : `$(outdir)/%.ps` -# -# The The `gnudoc - -# The module counts on the `$(outdir)/install` target being defined by -# `files`, but not having a rule that executes once the dependencies -# have been taken care of; it adds a "post-install" rule to add the -# info files to the index. -endef -mod.gnudoc.doc := $(value mod.gnudoc.doc) - -TEXI2HTML ?= makeinfo --html -TEXI2PDF ?= texi2pdf -TEXI2PS ?= texi2dvi --ps - -files.groups += html dvi pdf ps -nested.targets += info 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 0000000..aac2c28 --- /dev/null +++ b/build-aux/Makefile.once.head/10-texinfo.mk @@ -0,0 +1,51 @@ +# 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 . + +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` +# - .PHONY target : `$(outdir)/install` (see below) +# - Target : `$(outdir)/%.info` +# - Target : `$(outdir)/%.dvi` +# - target : `$(outdir)/%.html` +# - target : `$(outdir)/%.pdf` +# - Target : `$(outdir)/%.ps` +# +# The module counts on the `$(outdir)/install` target being defined by +# `files`, but not having a rule that executes once the dependencies +# have been taken care of; it adds a "post-install" rule to add the +# info files to the index. +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 -- cgit v1.2.3-54-g00ecf From aca833ffe2fc52c7f18b641031e371d22fd926bd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 15 Jan 2017 01:56:50 -0500 Subject: remove gnustuff --- build-aux/Makefile.each.tail/11-gnustuff.mk | 23 ------------ build-aux/Makefile.once.head/10-gnustuff.mk | 56 ----------------------------- build-aux/Makefile.once.tail/11-gnustuff.mk | 17 --------- 3 files changed, 96 deletions(-) delete mode 100644 build-aux/Makefile.each.tail/11-gnustuff.mk delete mode 100644 build-aux/Makefile.once.head/10-gnustuff.mk delete mode 100644 build-aux/Makefile.once.tail/11-gnustuff.mk diff --git a/build-aux/Makefile.each.tail/11-gnustuff.mk b/build-aux/Makefile.each.tail/11-gnustuff.mk deleted file mode 100644 index d89d204..0000000 --- a/build-aux/Makefile.each.tail/11-gnustuff.mk +++ /dev/null @@ -1,23 +0,0 @@ -# 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 . -$(foreach d,$(gnustuff.program_dirs),$(eval $(call _gnustuff.install_program,$d))) -$(foreach d,$(gnustuff.data_dirs) ,$(eval $(call _gnustuff.install_data,$d))) - -$(outdir)/install-strip: install - $(STRIP) $(filter $(addsuffix /%,$(gnustuff.program_dirs)),$(std.sys_files/$(@D))) - -#TAGS: TODO -#check: TODO -#installcheck: TODO diff --git a/build-aux/Makefile.once.head/10-gnustuff.mk b/build-aux/Makefile.once.head/10-gnustuff.mk deleted file mode 100644 index 759e48a..0000000 --- a/build-aux/Makefile.once.head/10-gnustuff.mk +++ /dev/null @@ -1,56 +0,0 @@ -# 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 . - -mod.gnustuff.description = Misc parts of the GNU Coding Standards -mod.gnustuff.depends += files nested -define mod.gnustuff.doc -# User variables: -# - `STRIP ?= strip` -# - `MKDIR_P ?= mkdir -p` -# Inputs: -# - Global variable : `gnustuff.program_dirs ?= $(bindir) $(sbindir) $(libexecdir)` -# - Global variable : `gnustuff.data_dirs ?= -# - Global variable : `gnustuff.dirs ?= $(gnustuff.program_dirs) $(gnustuff.data_dirs) -# Outputs: -# - Global variable : `nested.targets += install-strip` -# - .PHONY target : `$(outdir)/install-strip` -# -# gnustuff.info_docs: -# The list of texinfo documents in the current directory, without -# the `.texi` suffix. -# -# gnustuff.program_dirs: -# Directories to use $(INSTALL_PROGRAM) for inserting files into. -# -# gnustuff.data_dirs: -# Directories to use $(INSTALL_DATA) for inserting files into. -# -# gnustuff.dirs: -# Directories to create -endef -mod.gnustuff.doc := $(value mod.gnustuff.doc) - -STRIP ?= strip -MKDIR_P ?= mkdir -p - -gnustuff.program_dirs ?= $(bindir) $(sbindir) $(libexecdir) -gnustuff.data_dirs ?= \ - $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) \ - $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) \ - $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) -gnustuff.dirs += $(gnu.program_dirs) $(gnu.data_dirs) - -nested.targets += install-strip diff --git a/build-aux/Makefile.once.tail/11-gnustuff.mk b/build-aux/Makefile.once.tail/11-gnustuff.mk deleted file mode 100644 index e4b18c0..0000000 --- a/build-aux/Makefile.once.tail/11-gnustuff.mk +++ /dev/null @@ -1,17 +0,0 @@ -# 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 . - -$(gnustuff.dirs): - $(MKDIR_P) $@ -- cgit v1.2.3-54-g00ecf From 9dd14f211994ca4009539b68b9b82022eb3ad9c3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 15 Jan 2017 02:30:21 -0500 Subject: Documentation. --- README.md | 343 +++++++++++------------------------------- build-aux/Makefile.README.txt | 10 +- 2 files changed, 92 insertions(+), 261 deletions(-) diff --git a/README.md b/README.md index e7606eb..ac5ff61 100644 --- a/README.md +++ b/README.md @@ -1,283 +1,114 @@ -Autothing -========= +Autothing 3: The smart way to write GNU Makefiles +================================================= -Autothing is a set of Makefile fragments that you can `include` in -your GNU Makefiles to provide two core things: +Autothing is a thing that does things automatically. - 1. Make it _easy_ to write non-recursive Makefiles. (search for the - paper "Recursive Make Considered Harmful") - 2. Provide boilerplate for standard features people expect to be - implemented in Makefiles. +Ok, more helpfully: Autothing is a pair of .mk Makefile fragments that +you can `include` from your Makefiles to make them easier to write; +specifically, it makes it _easy_ to write non-recursive Makefiles--and +ones that are similar to plain recursive Makefiles, at that! -Between these two, it should largely obviate GNU Automake in your -projects. +Sample +------ -The recommended including Autothing into your project is to add the -autothing repository as a `git` remote, and merge the `core` branch, -and whichever `mod-*` module branches you want into your project's -branch. +Write your makefiles of the form: -| module name | dependencies | description | -|-------------+--------------+--------------------------------------------------------------------------------------------------| -| at | | The core of Autothing | -|-------------+--------------+--------------------------------------------------------------------------------------------------| -| std | at | Provide .PHONY targets: all/build/install/uninstall/mostlyclean/clean/distclean/maintainer-clean | -| dist | std | Provide .PHONY target: dist | -| gnuconf | dist | Provide default values for user-variables from the GNU Coding Standards' Makefile Conventions | -| gnustuff | gnuconf | Provide remaining stuff from the GNU Coding Standards' Makefile Conventions | + topsrcdir ?= ... + topoutdir ?= ... + at.Makefile ?= Makefile # Optional + include $(topsrcdir)/build-aux/Makefile.head.mk -Core (psuedo-module: at) ------------------------- + $(outdir)/%.o: $(srcdir)/%.c: + $(CC) -c -o $@ $< -As harmful as recursive make is, it's historically been difficult to -to write non-recursive Makefiles. The goal of the core of Autothing -is to make it easy. + $(outdir)/hello: $(outdir)/hello.o -In each source directory, you write a `Makefile`, very similarly to if -you were writing for plain GNU Make, with the form: + at.subdirs = ... + at.targets = ... - topoutdir ?= ... - topsrcdir ?= ... - include $(topsrcdir)/build-aux/Makefile.head.mk + include $(topsrcdir)/build-aux/Makefile.tail.mk - # your makefile +This is similar to, but not quite, the comfortable way that you probably +already write your Makefiles. - include $(topsrcdir)/build-aux/Makefile.tail.mk +What's where? +------------- -| at.path | Use $(call at.path,FILENAME1 FILENAME2...) sanitize filenames that are not in the current Makefile's directory or its children | -| at.nl | A newline, for convenience, since it is difficult to type a newline in GNU Make expressions | +There are three things that Autothing provides: -| at.dirlocal | Which variables to apply the namespacing mechanism to | -| at.phony | Which targets to mark as .PHONY, and have automatic recursive dependencies | -| at.subdirs | Which directories to consider as children of this one | -| at.depdirs | Which directories are't subdirs, but may contain dependencies of targets in this directory | + 1. Variable namespacing + 2. Tools for dealing with paths + 3. A module (plugin) system. -outdir -srcdir +This repository contains both Autothing itself, and several modules. -Module: std ------------ +Autothing itself is described in `build-aux/Makefile.README.txt`. +That file is the core documentation. -| Variable | Create Command | Delete Command | Description | Relative to | -|---------------+----------------+-----------------------------+-----------------------------------+-------------| -| std.src_files | emacs | rm -rf . | Files that the developer writes | srcdir | -| std.gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | -| std.cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | -| std.out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | -| std.sys_files | make install | make uninstall | Files the user installs | DESTDIR | +There is a "mod" module that adds self-documenting capabilities to the +module system; adding Make targets that print documentation about the +modules used in a project. For convenience, in the top level of this +repository, there is a Makefile allowing you to use these targets to +get documentation on the modules in this repository. -In addition, there are two more variables that control not how files -are created, but how they are deleted: +Running `make at-modules` will produce a list of modules, and short +descriptions of them: -| Variable | Affected command | Description | Relative to | -|-----------------+------------------+------------------------------------------------+-------------| -| std.clean_files | make clean | A list of things to `rm` in addition to the | outdir | -| | | files in `$(std.out_files)`. (Example: `*.o`) | | -|-----------------+------------------+------------------------------------------------+-------------| -| std.slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | -| | | _not_ be deleted. (otherwise, `mostlyclean` | | -| | | is the same as `clean`) | | + $ make at-modules + Autothing modules used in this project: + - dist `dist` target for distribution tarballs (more) + - files Keeping track of groups of files (more) + - gitfiles Automatically populate files.src.src from git (more) + - gnuconf GNU standard configuration variables (more) + - mod Display information about Autothing modules (more) + - nested Easy nested .PHONY targets (more) + - quote Macros to quote tricky strings (more) + - texinfo The GNU documentation system (more) + - var Depend on the values of variables (more) + - write-atomic `write-atomic` auxiliary build script (more) + - write-ifchanged `write-ifchanged` auxiliary build script (more) -| Variable | Default | Description | -|----------+----------+-------------| -| DESTDIR | | | -|----------+----------+-------------| -| RM | rm -f | | -| RMDIR_P | rmdir -p | | -| TRUE | true | | +The "(more)" at the end of a line indicates that there is further +documentation for that module, which can be produced by running the +command `make at-modules/MODULE_NAME`. -Module: dist ------------- +Further development +------------------- -The `dist` module produces distribution tarballs +The raison d'être of GNU Automake is that targeting multiple +implementations of Make is hard; the different dialects have diverged +significantly. -| Variable | Default | Description | -|--------------+------------+-------------| -| dist.exts | .tar.gz | | -| dist.pkgname | $(PACKAGE) | | -| dist.version | $(VERSION) | | +But GNU's requirement of supporting multiple implementations of Make +is relaxing. With GNU Emacs 25, it GNU Make is explicitly required. +We can finally rise up from our Automake shackles! -| Variable | Default | Description | -|-----------+-------------+----------------------------------------------------| -| CP | cp | | -| GZIP | gzip | | -| MKDIR | mkdir | | -| MKDIR_P | mkdir -p | | -| MV | mv | | -| RM | rm -f | | -| TAR | tar | | -|-----------+-------------+----------------------------------------------------| -| GZIPFLAGS | $(GZIP_ENV) | | -| GZIP_ENV | --best | Because of GNU Automake, users expect this to work | +... But we soon discover that the GNU Coding Standards require many +things of our Makefiles, which Automake took care of for us. -Module: gnuconf ---------------- +So, several of the modules in this repository combine to attempt to +provide the things that the GNU Coding Standards require. Between +`gnuconf`, `dist`, `files`, and `texinfo`; the GNU Coding Standards +for Makefiles are nearly entirely satisfied. However, there are a few +targets that are required, but aren't implemented by a module (yet!): -The `gnuconf` module provides default values for user-facing toggles -required by the GNU Coding Standards. + - `install-strip` + - `TAGS` + - `check` + - `installcheck` (optional, but recommended) -There is only one developer configuration option: +Further, none of the standard modules actually provide rules for +installing files; they merely define the standard install targets with +dependencies on the files they need to install. This is because +actual rules for installing them can be project-specific, but also +depend on classes of files that none of the modules are aware of; +binary executables might need a strip flag passed to INSTALL, but we +need to avoid that flag for scripts; some parts might need libtool +install commands, others not. -| Variable | Default | Description | -|-----------------+------------+-----------------------------------------------| -| gnuconf.pkgname | $(PACKAGE) | The package name to use in the default docdir | - -There is an extensive list of user configuration options: - -| Variable | Default | Description | -|-----------------+---------------------------------------+-------------------------------------------| -| 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 | | -|-----------------+---------------------------------------+-------------------------------------------| -| AR | ar | | -| ARFLAGS | | | -| BISON | bison | | -| BISONFLAGS | | | -| CC | cc | | -| CCFLAGS | $(CFLAGS) | | -| FLEX | flex | | -| FLEXFLAGS | | | -| INSTALL | install | | -| INSTALLFLAGS | | | -| LD | ld | | -| LDFLAGS | | | -| LDCONFIG | ldconfig | TODO: detect absence, fall back to `true` | -| LDCONFIGFLAGS | | | -| LEX | lex | | -| LEXFLAGS | $(LFLAGS) | | -| MAKEINFO | makeinfo | | -| MAKEINFOFLAGS | | | -| RANLIB | ranlib | TODO: detect absence, fall back to `true` | -| RANLIBFLAGS | | | -| TEXI2DVI | texi2dvi | | -| TEXI2DVIFLAGS | | | -| YACC | yacc | | -| YACCFLAGS | $(YFLAGS) | | -|-----------------+---------------------------------------+-------------------------------------------| -| CFLAGS | | | -| LFLAGS | | | -| YFLAGS | | | -|-----------------+---------------------------------------+-------------------------------------------| -| LN_S | ln -s | TODO: detect when to fall back to `cp` | -|-----------------+---------------------------------------+-------------------------------------------| -| CHGRP | chgrp | | -| CHMOD | chmod | | -| CHOWN | chown | | -| MKNOD | mknod | | -|-----------------+---------------------------------------+-------------------------------------------| -| INSTALL_PROGRAM | $(INSTALL) | | -| INSTALL_DATA | ${INSTALL} -m 644 | | -|-----------------+---------------------------------------+-------------------------------------------| -| prefix | /usr/local | | -| exec_prefix | $(prefix) | | -|-----------------+---------------------------------------+-------------------------------------------| -| bindir | $(exec_prefix)/bin | | -| sbindir | $(exec_prefix)/sbin | | -| libexecdir | $(exec_prefix)/libexec | | -|-----------------+---------------------------------------+-------------------------------------------| -| datadir | $(datarootdir) | | -| sysconfdir | $(prefix)/etc | | -| sharedstatedir | $(prefix)/com | | -| localstatedir | $(prefix)/var | | -| runstatedir | $(localstatedir)/run | | -|-----------------+---------------------------------------+-------------------------------------------| -| includedir | $(prefix)/include | | -| oldincludedir | /usr/include | | -| docdir | $(datarootdir)/doc/$(gnuconf.pkgname) | | -| infodir | $(datarootdir)/info | | -| htmldir | $(docdir) | | -| dvidir | $(docdir) | | -| pdfdir | $(docdir) | | -| psdir | $(docdir) | | -| libdir | $(exec_prefix)/lib | | -| lispdir | $(datarootdir)/emacs/site-lisp | | -| localedir | $(datarootdir)/locale | | -|-----------------+---------------------------------------+-------------------------------------------| -| 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 | | -|-----------------+---------------------------------------+-------------------------------------------| -| manext | .1 | | -| man1ext | .1 | | -| man2ext | .2 | | -| man3ext | .3 | | -| man4ext | .4 | | -| man5ext | .5 | | -| man6ext | .6 | | -| man7ext | .7 | | -| man8ext | .8 | | - -Module: gnustuff ----------------- - -This is a poorly-thought-out module implementing remaining things from -the GNU Coding Standards. - -This is poorly thought out and poorly tested because it's basically -the part of the GNU Coding Standards that I don't use. - -Developer configuration options: - -| Variable | Default | Description | -|-----------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------| -| gnustuff.info_docs | | The list of texinfo documents in the current directory, without the `.texi` suffix. | -| gnustuff.program_dirs | $(bindir) $(sbindir) $(libexecdir) | Directories to use $(INSTALL_PROGRAM) for inserting files into. | -| gnustuff.data_dirs | | Directories to use $(INSTALL_DATA) for inserting files into. | -| gnustuff.dirs | $(gnustuff.program_dirs) $(gnustuff.data_dirs) | Directories to create | - -User configuration options: - -| Variable | Default | Description | -|-----------+-----------------+-------------| -| STRIP | strip | | -| TEXI2HTML | makeinfo --html | | -| TEXI2PDF | texi2pdf | | -| TEXI2PS | texi2dvi --ps | | -| MKDIR_P | mkdir -p | | - -It provides several `.phony` targets: - - install-{html,dvi,pdf,ps} - - install-strip - - {info,html,dvi,pdf,ps} - - TAGS - - check - - installcheck - -It also augments the `std` `install` rule to run $(INSTALL_INFO) as -necessary. - -And several real rules: - - How to install files into any of the $(gnustuff.program_dirs) or - $(gnustuff.data_dirs). - - How to generate info, dvi, html, pdf, and ps files from texi files. +---- +Copyright (C) 2016-2017 Luke Shumaker + +This documentation file is placed into the public domain. If that is +not possible in your legal system, I grant you permission to use it in +absolutely every way that I can legally grant to you. diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt index 3be7a9d..c68870a 100644 --- a/build-aux/Makefile.README.txt +++ b/build-aux/Makefile.README.txt @@ -21,9 +21,9 @@ Write your makefiles of the form: include $(topsrcdir)/build-aux/Makefile.head.mk $(outdir)/%.o: $(srcdir)/%.c: - $(CC) -c -o $@ $< + $(CC) -c -o $@ $< - $(outdir)/hello: $(outdir)/hello.o + $(outdir)/hello: $(outdir)/hello.o at.subdirs = ... at.targets = ... @@ -56,8 +56,8 @@ you want to be included in every Makefile, and this gives some structure to that. Requirements: - - A version of GNU Make that supports `undefine`. (TODO: check which version - of GNU Make introduced this feature) + - A version of GNU Make that supports `undefine` (ie, version 3.82 + and above). Inputs: - In each `Makefile`: @@ -105,7 +105,7 @@ while also making your Makefiles better. ---- -Copyright (C) 2016 Luke Shumaker +Copyright (C) 2016-2017 Luke Shumaker This documentation file is placed into the public domain. If that is not possible in your legal system, I grant you permission to use it in -- cgit v1.2.3-54-g00ecf From 106c6cf6365794dd9bc6315358d12a5d4400a586 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 16 Jan 2017 19:24:18 -0500 Subject: core: Derp, the at.relbase function was broken. --- build-aux/Makefile.head.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index c2ce307..e6b4a19 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -24,9 +24,9 @@ ifeq ($(origin _at.NO_ONCE),undefined) # These 4 functions are all $(call _at.func,parent,child) _at.is_strict_subdir = $(filter $(abspath $1)/%,$(abspath $2)) _at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_at.relbase = $(strip \ - $(if $(call _at.is_subdir,$1,$2), \ - $(patsubst %/.,$(patsubst $(abspath $1)/%,%,$(abspath $2)/.)), \ +_at.relbase = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst %/.,%,$(patsubst $(abspath $1)/%,%,$(abspath $2)/.)), \ $(abspath $2))) _at.relto = $(strip \ $(if $(call _at.is_subdir,$1,$2), \ -- cgit v1.2.3-54-g00ecf From 2d33bd2f34f011c4f025a073b50d536f6a66a4db Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 16 Jan 2017 19:27:20 -0500 Subject: Improve documentation. --- Makefile | 12 + README.md | 115 +--------- build-aux/Makefile.README.old.txt | 134 +---------- build-aux/Makefile.README.txt | 391 +++++++++++++++++++++++++++++--- build-aux/Makefile.once.head/10-dist.mk | 2 +- 5 files changed, 381 insertions(+), 273 deletions(-) mode change 100644 => 120000 README.md diff --git a/Makefile b/Makefile index cd5a79c..fe9010a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,15 @@ +# This Makefile is a minimal stub that exists to allow the +# `at-modules` set of Make targets to print documentation for the +# present Autothing modules. +# +# This file is part of the documentation for Autothing. +# +# Copyright (C) 2017 Luke Shumaker +# +# This documentation file is placed into the public domain. If that +# is not possible in your legal system, I grant you permission to use +# it in absolutely every way that I can legally grant to you. + dist.pkgname = autothing dist.version = 1.0 gnuconf.pkgname = autothing diff --git a/README.md b/README.md deleted file mode 100644 index ac5ff61..0000000 --- a/README.md +++ /dev/null @@ -1,114 +0,0 @@ -Autothing 3: The smart way to write GNU Makefiles -================================================= - -Autothing is a thing that does things automatically. - -Ok, more helpfully: Autothing is a pair of .mk Makefile fragments that -you can `include` from your Makefiles to make them easier to write; -specifically, it makes it _easy_ to write non-recursive Makefiles--and -ones that are similar to plain recursive Makefiles, at that! - -Sample ------- - -Write your makefiles of the form: - - topsrcdir ?= ... - topoutdir ?= ... - at.Makefile ?= Makefile # Optional - include $(topsrcdir)/build-aux/Makefile.head.mk - - $(outdir)/%.o: $(srcdir)/%.c: - $(CC) -c -o $@ $< - - $(outdir)/hello: $(outdir)/hello.o - - at.subdirs = ... - at.targets = ... - - include $(topsrcdir)/build-aux/Makefile.tail.mk - -This is similar to, but not quite, the comfortable way that you probably -already write your Makefiles. - -What's where? -------------- - -There are three things that Autothing provides: - - 1. Variable namespacing - 2. Tools for dealing with paths - 3. A module (plugin) system. - -This repository contains both Autothing itself, and several modules. - -Autothing itself is described in `build-aux/Makefile.README.txt`. -That file is the core documentation. - -There is a "mod" module that adds self-documenting capabilities to the -module system; adding Make targets that print documentation about the -modules used in a project. For convenience, in the top level of this -repository, there is a Makefile allowing you to use these targets to -get documentation on the modules in this repository. - -Running `make at-modules` will produce a list of modules, and short -descriptions of them: - - $ make at-modules - Autothing modules used in this project: - - dist `dist` target for distribution tarballs (more) - - files Keeping track of groups of files (more) - - gitfiles Automatically populate files.src.src from git (more) - - gnuconf GNU standard configuration variables (more) - - mod Display information about Autothing modules (more) - - nested Easy nested .PHONY targets (more) - - quote Macros to quote tricky strings (more) - - texinfo The GNU documentation system (more) - - var Depend on the values of variables (more) - - write-atomic `write-atomic` auxiliary build script (more) - - write-ifchanged `write-ifchanged` auxiliary build script (more) - -The "(more)" at the end of a line indicates that there is further -documentation for that module, which can be produced by running the -command `make at-modules/MODULE_NAME`. - -Further development -------------------- - -The raison d'être of GNU Automake is that targeting multiple -implementations of Make is hard; the different dialects have diverged -significantly. - -But GNU's requirement of supporting multiple implementations of Make -is relaxing. With GNU Emacs 25, it GNU Make is explicitly required. -We can finally rise up from our Automake shackles! - -... But we soon discover that the GNU Coding Standards require many -things of our Makefiles, which Automake took care of for us. - -So, several of the modules in this repository combine to attempt to -provide the things that the GNU Coding Standards require. Between -`gnuconf`, `dist`, `files`, and `texinfo`; the GNU Coding Standards -for Makefiles are nearly entirely satisfied. However, there are a few -targets that are required, but aren't implemented by a module (yet!): - - - `install-strip` - - `TAGS` - - `check` - - `installcheck` (optional, but recommended) - -Further, none of the standard modules actually provide rules for -installing files; they merely define the standard install targets with -dependencies on the files they need to install. This is because -actual rules for installing them can be project-specific, but also -depend on classes of files that none of the modules are aware of; -binary executables might need a strip flag passed to INSTALL, but we -need to avoid that flag for scripts; some parts might need libtool -install commands, others not. - ----- -Copyright (C) 2016-2017 Luke Shumaker - -This documentation file is placed into the public domain. If that is -not possible in your legal system, I grant you permission to use it in -absolutely every way that I can legally grant to you. diff --git a/README.md b/README.md new file mode 120000 index 0000000..5e5ea4a --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +build-aux/Makefile.README.txt \ No newline at end of file diff --git a/build-aux/Makefile.README.old.txt b/build-aux/Makefile.README.old.txt index b0a0965..b4ea562 100644 --- a/build-aux/Makefile.README.old.txt +++ b/build-aux/Makefile.README.old.txt @@ -1,20 +1,14 @@ Obsolete ======== -The following was written for previous versions of Autothing. I'm leaving it -here for now because I'll likely canibalize it for other bits of documentation, -either for Autothing itself, the `files` module, or the `dist` module. +The following was written for previous versions of Autothing. I'm +leaving it here for now because I'll likely canibalize it for other +bits of documentation, either for Autothing itself, the `files` +module, or the `dist` module. High-level overview ------------------- -Now, what this does for you is: - - (search for the paper -"Recursive Make Considered Harmful") As harmful as recursive make is, -it's historically been difficult to to write non-recursive Makefiles. -This makes it easy. - It also makes it easy to follow the GNU standards for your makefiles: it takes care of this entire table of .PHONY targets for you: @@ -33,126 +27,6 @@ it takes care of this entire table of .PHONY targets for you: (You are still responsible for implementing the `$(outdir)/check` target in each of your Makefiles.) -What you have to do is: - -In each source directory, you write a `Makefile`, very similarly to if -you were writing for plain GNU Make, with - - topoutdir ?= ... - topsrcdir ?= ... - include $(topsrcdir)/build-aux/Makefile.head.mk - - # your makefile - - include $(topsrcdir)/build-aux/Makefile.tail.mk - -And in the top-level source directory, Write your own helper makefiles -that get included: - - `common.once.head.mk`: before parsing any of your Makefiles - - `common.each.head.mk`: before parsing each of your Makefiles - - `common.each.tail.mk`: after parsing each of your Makefiles - - `common.each.tail.mk`: after parsing all of your Makefiles - -The `common.*.mk` makefiles are nice for including generic pattern -rules and variables that aren't specific to a directory. - -You're probably thinking that this sounds too good to be true! -Unfortunately, there are two major deviations from writing a plain -recursive Makefile: - - 1. all targets and prerequisites (including .PHONY targets!) need to - be prefixed with - `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`. - * sub-gotcha: this means that if a pattern rule has a - prerequisite that may be in srcdir or outdir, then it must be - specified twice, once for each case. - 2. if a prerequisite is in a directory "owned" by another Makefile, - you must filter the pathname through `am_path`: - `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain - a `..` segment; if you need to refer to a sibling directory, do it - relative to `$(topoutdir)` or `$(topsrcdir)`. - -Telling automake about your program ------------------------------------ - -You tell automake what to do for you by setting some variables. They -are all prefixed with `am_`; this prefix may be changed by editing the -`_am` variable at the top of `automake.head.mk`. - -The exception to this is the `am_path` variable, which is a macro that -is used to make a list of filenames relative to the appropriate -directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't -nescessarily equal to `.`. See above. - -There are several commands that generate files; simply record the list -of files that each command generates as the following variable -variables: - -| Variable | Create Command | Delete Command | Description | Relative to | -|--------------+----------------+-----------------------------+-----------------------------------+-------------| -| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir | -| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir | -| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir | -| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir | -| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR | - -In addition, there are two more variables that control not how files -are created, but how they are deleted: - -| Variable | Affected command | Description | Relative to | -|----------------+------------------+------------------------------------------------+-------------| -| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir | -| | | files in `$(am_out_files)`. (Example: `*.o`) | | -|----------------+------------------+------------------------------------------------+-------------| -| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir | -| | | _not_ be deleted. (otherwise, `mostlyclean` | | -| | | is the same as `clean`) | | - -Finally, there are two variables that express the relationships -between directories: - -| Variable | Description | -|------------+---------------------------------------------------------| -| am_subdirs | A list of other directories (containing Makefiles) that | -| | may be considered "children" of this | -| | directory/Makefile; building a phony target in this | -| | directory should also build it in the subdirectory. | -| | They are not necesarily actually subdirectories of this | -| | directory in the filesystem. | -|------------+---------------------------------------------------------| -| am_depdirs | A list of other directories (containing Makefiles) that | -| | contain or generate files that are dependencies of | -| | targets in this directory. They are not necesarily | -| | actually subdirectories of this directory in the | -| | filesystem. Except for files that are dependencies of | -| | files in this directory, things in the dependency | -| | directory will not be built. | - -Tips, notes ------------ - -I like to have the first (non-comment) line in a Makefile be: - - include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk - -(adjusting the number of `../` sequences as nescessary). Then, my -(user-editable) `config.mk` is of the form: - - ifeq ($(topsrcdir),) - topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) - topsrcdir := $(topoutdir) - - # your configuration - - endif - -If the package has a `./configure` script, then I have it modifiy -topsrcdir as necessary, as well as modifying whatever other parts of -the configuration. All of the configuration lives in `config.mk`; -`./configure` doesn't modify any `Makefile`s, it just generates -`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to -`$(outdir)/Makefile`. - ---- Copyright (C) 2016 Luke Shumaker diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt index c68870a..f67ede2 100644 --- a/build-aux/Makefile.README.txt +++ b/build-aux/Makefile.README.txt @@ -5,36 +5,110 @@ Autothing 3: The smart way to write GNU Makefiles Autothing is a thing that does things automatically. -Ok, more helpfully: Autothing is a pair of .mk Makefile fragments that -you can `include` from your Makefiles to make them easier to write; -specifically, it makes it _easy_ to write non-recursive Makefiles--and -ones that are similar to plain recursive Makefiles, at that! +Ok, more helpfully: Autothing is a pair of .mk Makefile fragments +(`Makefile.head.mk` and `Makefile.tail.mk`) that you can `include` +from your Makefiles to make them easier to write; specifically, it +makes it _easy_ to write non-recursive Makefiles--and ones that are +similar to plain recursive Makefiles, at that! -Synopsis --------- +To many people, talking about GNU Make directly is a non-starter +because it means giving up the many other features that things like +GNU Automake provide. Other projects like GNU Automake were created +to plaster over differences between make(1) implementations; however, +this isn't all that Automake provides, it also makes it easy to do +complex things that users want, or the GNU Coding Standards require. +That's silly; the implementation of these features should be +orthogonal to plastering over the differences between Make +implementations. So, in addition to the Automake core, Automake is +distributed with several "modules" that implement similar feature sets +to what Automake provides. -Write your makefiles of the form: +Autothing does depend on GNU Make; other make(1) implementations will +not work. However, if you are open to adding GNU Make as a +dependency, then Autothing should obviate the need for GNU Automake, +while also making your Makefiles better. + +Non-recursive? +-------------- + + (For those of you who aren't up on Makefile jargon) + +When you have a project that spans multiple directories, you'll +probably want to split up the Makefile, having the appropriate parts +in each sub-directory. There are a number of strategies you can use +to approach this. + +One of the more prevelant strategies (so much so that GNU make +includes special support for it) is to write "recursive Makefiles"; +that is, have Make rules that include commands like + + other-directory/libfoo.so: + $(MAKE) -C other-directory libfoo.so + +or + + other-directory/libfoo.so + cd other-directory && $(MAKE) libfoo.so +This approach is popular because it is both very easy to implement, +and is supported by a wide variety of Make implementations. But, it +also introduces a wide variety of issues; so much so that a rather +famous paper was written about it: "Recursive Make Considered Harmful" +(Miller, 1997). + +For all of the arguments against it, and all of the alternative +approaches, recusive Makefiles are hard to beat because they are just +so easy to write, and the alternatives... aren't. UNTIL NOW! + +Instead of having rules that spawn a separate Make process in another +directory for targets in that directory, Autothing lets you provide a +list of directories that include targets that targets in this +directory might depend on, and Autothing will automagically include +the Makefile in that other directory into *this* instance of the Make +program. + + Peter Miller (1997) "Recursive Make Considered Harmful" + + +An example Makefile / Introduction +---------------------------------- + +Write your Makefiles of the form: + + # Initialize basic information about how your project is structured. topsrcdir ?= ... topoutdir ?= ... - at.Makefile ?= Makefile # Optional + + # Include the Autothing entry point include $(topsrcdir)/build-aux/Makefile.head.mk + # Now write your Makefile very similarly to how you normally + # would. Just make sure that outputs are relative to $(outdir) + # and inputs relative to $(srcdir). $(outdir)/%.o: $(srcdir)/%.c: $(CC) -c -o $@ $< - $(outdir)/hello: $(outdir)/hello.o + # If any of the dependencies of files here are outputs of a + # Makefile in another directory, list those directories here. at.subdirs = ... - at.targets = ... + # This part is kind of a pain: define a list of ouput targets that + # this Makefile produces. + at.targets = $(outdir)/%.o $(outdir)/hello + + # Include the Autothing exit point include $(topsrcdir)/build-aux/Makefile.tail.mk This is similar to, but not quite, the comfortable way that you probably already write your Makefiles. -Details -------- +It is recommended that Autothing lives inside of the "build-aux" +directory in the top level of your project sources; "build-aux" is a +standard directory for auxiliary build programs and tools. + +What does Autothing do for me? +------------------------------ There are two fundamental things that Autothing provides: @@ -49,16 +123,179 @@ The second is important because GNU Make is too dumb to know that Then, there's something that maybe doesn't belong, but I didn't have the heart to cut it out: - 3. A module (plugin) system. + 3. A module (plugin) system, which allows for modules to provide + additional feature sets. The module system is "important" because there are very often common bits that you want to be included in every Makefile, and this gives some structure to that. -Requirements: +Let's step through each of those features. + +## Variable namespacing + +When you write a Makefile, you quite likely use (global) variables. +When you have a project that uses multiple Makefiles, each Makefile +might have the same variable names, but with different values +(especially if converting from recursive Make). + +You could be very disciplined and carefully name your variables so +that they don't conflict. This is difficult and error prone normally, +but becomes neigh-on-impossible if you are converting a large-ish +project from recursive Make. + +So, Autothing provides a solution. If you provide Autothing with a +list of targets defined in your Makefile (via the `at.targets` +variable), Autothing will make any variables you defined local to that +Makefile; they will be present when making targets listed in +`at.targets`, but will be hidden from other Makfiles that get +included. + +Any variables defined before `Makefile.head.mk` is included are +treated as truly global; all Makefiles included will have access to +them. + +## Tools for dealing with paths + +As stated above, GNU Make is too dumb to realize that `foo/bar/../baz` +== `foo/baz`; so one has to be reasonably careful about path +normalization. For dealing with path normalization problems that +arise because of the way Autothing inclusions work, several global +functions are provided for dealing with paths. + +`$(call at.is_subdir,a,b)` returns whether `b` is a sub-directory of +`a` (including `a` as a sub-directory of itself). +`at.is_strict_subdir` does the same, but does not treat `a` as a +sub-directory of itself. (These function names mimic the terms +"subset" and "strict subset" in mathematics.) These use an empty +string for "false" and a non-empty string for "true". + +`$(call at.path,files...)` is a generic path-normalization routine. +The outputs of the other `at.*` functions are already normalized, and +do not need to be passed through this. Files immediately inside of +`$(srcdir)` or `$(outdir)` (without another directory name after the +variable) are already normalized, and do not need to be passed through +this function either. However, it is always safe to pass a path +through this function, so if in doubt, call `at.path`. + +`$(call at.relbase,dir,files...)` and its cousin `at.relto` take a +directory and a list of files, and transform each of the filenames to +be relative to the directory, if the file is inside of the directory. +Where they differ is that if the file is not inside of the directory; +`at.relbase` transforms it into an absolute path, while `at.relto` +prepends as many `../` segments as necessary to make it relative to +the directory. (These function names mimic the `--relative-base` and +`--relative-to` flags of the `realpath` utility that is part of GNU +coreutils.) + +If `$(srcdir)` and `$(outdir)` are the same, then `$(call +at.out2src,files...)` is a no-op, but otherwise it takes a (possibly +relative) path in `$(outdir)`, and transforms it to the equivalent +filename in `$(srcdir)`. + +`$(call at.addprefix,dir,files...)` takes a directory and a list of +filenames, and looks at each filename; if it is an absolute path, it +passes it through (well, "only" normalizes it); if the filename is a +relative path, it is joined with the given base directory. + +## Modules to provide feature sets + +The module system serves two purposes + + 1. Allow your developers to share logic between Makefiles in multiple + directories. + 2. Allow your developers to import "standard" modules implementing + common feature sets, so they don't have to. + +Distributed along with autothing are some "standard" modules that +provide commonly desired functionality from Makefiles; tricky little +things that your developers shouldn't have to implement themselves for +every project; the things that GNU Automake would take care of if you +used Automake (a piece of software that Autothing hopes to replace). + +The module system is conceptually quite simple: have 4 directories for +`.mk` makefile snippets that get included at certain points: + + Makefile.once.head/*.mk + + Makefile.each.head/*.mk + a/Makefile + Makefile.each.tail/*.mk + + Makefile.each.head/*.mk + b/Makefile + Makefile.each.tail/*.mk + + Makefile.each.head/*.mk + c/Makefile + Makefile.each.tail/*.mk + + Makefile.once.tail/*.mk + +Deciding which of the 4 directories to put your snippets in... you'll +figure it out pretty quickly once you start playing with it. + +Beyond these 4 directories, Autothing itself imposes no structure, but +there are some conventions that are followed by the distributed along +with Autothing, and I recommend that your developers follow. + +Each of the `.mk` files is name `NN-MODULE.mk` where NN is a number +(to affect the order that the module files are evaluated in, in case +of dependencies between them), and MODULE is the module name. Each +module has "public" variables prefixed with `MODULE.`, and "private" +variables prefixed with `_MODULE.` (again, "MODULE" being the module +name). For example, the "groups" parameter of the "files" module is +configured via the `files.groups` variable. Within this convention, +Autothing presents itself as a pseudo-module named "at"; that is, +public Autothing variables are prefixed with `at.`. + +If you follow these conventions, then the "mod" module distributed +along with Autothing can display information about the modules that a +project uses, and documentation on each module. Running the command +`make at-modules` (implemented by the "mod" module) will produce a +list of the modules present in a project, and short descriptions of +them: + + $ make at-modules + Autothing modules used in this project: + - dist `dist` target for distribution tarballs (more) + - files Keeping track of groups of files (more) + - gitfiles Automatically populate files.src.src from git (more) + - gnuconf GNU standard configuration variables (more) + - mod Display information about Autothing modules (more) + - nested Easy nested .PHONY targets (more) + - quote Macros to quote tricky strings (more) + - texinfo The GNU documentation system (more) + - var Depend on the values of variables (more) + - write-atomic `write-atomic` auxiliary build script (more) + - write-ifchanged `write-ifchanged` auxiliary build script (more) + +The "(more)" at the end of a line indicates that there is further +documentation for that module, which can be produced by running the +command `make at-modules/MODULE_NAME`. See the output of `make +at-modules/mod` for instructions on how to produce this further +documentation for modules you develop. + +Besides the "mod" module, the set modules distributed along with +Autothing primarily exists to provide the bits of (sometimes somewhat +tricky) functionality required of Makefiles by the GNU Coding +Standards. Run the `at-modules` commands above for documentation on +each of them. + +Formal interface +---------------- + +System requirements: - A version of GNU Make that supports `undefine` (ie, version 3.82 and above). + If the user attempts to use your Autothing-using Makefile with an + older version of GNU Make, `Makefile.head.mk` will print an error + message and refuse to proceed: + + $ make-3.81 + build-aux/Makefile.head.mk:58: *** Autothing: We need a version of Make that supports 'undefine'. Stop. + Inputs: - In each `Makefile`: - Before `Makefile.head.mk`: @@ -71,6 +308,31 @@ Inputs: - Files: - `${topsrcdir}/build-aux/Makefile.{each,once}.{head,tail}/*.mk` + Unfortunately, a limitation of Autothing is that it does require a + designated "top" directory; it can't be used to have a sub-project + that can also be totally separate and built alone. In your + Makefiles, before you include `Makefile.head.mk`, you must tell + Autothing what the top directory is by setting `topoutdir` and + `topsrcdir`. + + If you wish for your per-directory Makefiles to have a name other + than `Makefile` (such as `GNUmakefile` or `makefile`, which GNU Make + also looks for by default; or another name for project-specific + reasons), Autothing supports this by setting the `at.Makefile` + variable. Unfortunately, Autothing does not support having a list + of filenames to try; so one must be consistent about the filename + throughout the project. + + In the body of each Makefile, you may set the `at.targets` variable + to list which targets should have access to the variables defined in + the body of that Makefile. + + In the body of each Makefile, you may set the `at.subdirs` variable + to list of directories which have their own Makefile which produces + targets that targets in this directory depend on. Directories + listed in `at.subdirs` may be relative or absolute; if relative, + they are interpreted as relative to `$(outdir)`. + Outputs: - Global: - Variable (function): `$(call at.is_subdir, parent, child)` @@ -80,29 +342,102 @@ Outputs: - Variable (function): `$(call at.path, paths...)` - Variable (function): `$(call at.out2src, paths...)` - Variable (function): `$(call at.addprefix, prefix, paths...)` + - Variable : `$(at.nl)` # a single newline - Per-directory: - Variable: `$(outdir)` - Variable: `$(srcdir)` -TODO: actually explain things. + For dealing with path normalization problems that arise because of + the way Autothing inclusions work, several global functions are + provided for dealing with paths; see the above "Tools for dealing + with paths" section for documentation on each of these functions. -Motivation/Exposition ---------------------- + For convenience, it also provides `$(at.nl)` which is a single + newline, as newlines are very difficult to type in Make variable + values. -This section needs rewritten. Or really just written. +Tips, notes +----------- -Other projects like GNU Automake were created to plaster over differences -between make(1) implementations; however, this isn't all that Automake -provides, it also makes it easy to do complex things that users want, or the -GNU Coding Standards require. That's silly. +If you use Autoconf (or similar), I recommend having a file at +`$(topsrcdir)/config.mk.in` of the form -Autothing does depend on GNU Make; other make(1) implementations will -not work. However, if you are open to adding GNU Make as a -dependency, then Autothing should obviate the need for GNU Automake, -while also making your Makefiles better. + ifeq ($(origin topsrcdir),undefined) + topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) + topsrcdir := $(topoutdir)/@top_srcdir@ - Peter Miller (1997) "Recursive Make Considered Harmful" - + # Any other global variables you might want to set + + endif + +Then have `./configure` generate `$(topoutdir)/config.mk` from it by +placing `AC_CONFIG_FILES([config.mk])` in your `configure.ac`. I +recommend that you have `config.mk` be the _only_ Makefile edited by +`./configure`; which will require manual support to have `./configure` +link/copy the Makefiles unedited into `$(topoutdir)`; you can do this +by placing something like this in your `configure.ac`: + + AC_OUTPUT([], [], [ + if test "$srcdir" != .; then + find "$srcdir" -name Makefile -printf '%P\n' \ + | while read -r filename; do + mkdir -p "\$(dirname "\$filename")" + ln -srfT "$srcdir/\$filename" "\$filename" + done + fi + ]) + +This will allow you to write your Makefiles in the form: + + include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk + include $(topsrcdir)/build-aux/Makefile.head.mk + + # your Makefile here + + include $(topsrcdir)/build-aux/Makefile.tail.mk + +Where you only need to adjust the number of `../` segments in the +first line based on how deep that directory is. + +Further development +------------------- + +Most of the modules distributed along with Autothing have the goal of +combining to provide the things that the GNU Coding Standards require. +Between `gnuconf`, `dist`, `files`, and `texinfo`; the GNU Coding +Standards for Makefiles are nearly entirely satisfied. However, there +are a few targets that are required, but aren't implemented by a +module (yet!): + + - `install-strip` + - `TAGS` + - `check` + - `installcheck` (optional, but recommended) + +TODO +---- + + - Write documentation on `srcdir`, `outdir`, and out-of-tree builds; + I don't think discussions involving the separate `srcdir` and + `outdir` make much sense without that context. + +Bugs/Limitations +---------------- + + - This documentation file is almost three times as long as the code + that it documents. + + - The "parse time" for projects with hundreds of sub-directories + (each having a Makefile) can be slow (ex: a project with 166 + directories has a parse time of around 12 seconds on my box). I + blame GNU Make's garbage collector; I don't think it was ever + designed to deal with as much "garbage" as Autothing's variable + namespacing throws at it. + + - Requires a designated "top" directory; see discussion above. + + - Does not support varying per-directory Makefile names; see + discussion above. ---- Copyright (C) 2016-2017 Luke Shumaker diff --git a/build-aux/Makefile.once.head/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk index 831ca12..27b39ec 100644 --- a/build-aux/Makefile.once.head/10-dist.mk +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -13,7 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -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` -- cgit v1.2.3-54-g00ecf From dd98e1c994520acc817d3dfa651ccf291827630d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jan 2017 02:20:31 -0500 Subject: Backport fixes from work on parabola-hackers.git. - core: Actually support at.Makefile; how it set the internal variable _at.MAKEFILE_LIST was broken if $(at.Makefile) != Makefile - mod: dist: * Don't try to distribute $(files.src.int) files. * Add a comment noting that the lack of the `-P` flag to `cp` is not a bug. - mod: gitfiles: * Correctly list files in $(topsrcdir). * Also enumerate files in git submodules. --- build-aux/Makefile.each.tail/00-dist.mk | 2 +- build-aux/Makefile.head.mk | 8 +++----- build-aux/Makefile.once.head/00-gitfiles.mk | 7 ++++--- build-aux/Makefile.once.tail/00-dist.mk | 5 ++++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk index bc2a3d5..b023e80 100644 --- a/build-aux/Makefile.each.tail/00-dist.mk +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -1 +1 @@ -_dist.files := $(strip $(_dist.files) $(call at.addprefix,$(srcdir),$(files.src))) +_dist.files := $(strip $(_dist.files) $(call at.addprefix,$(srcdir),$(filter-out $(files.src.int),$(files.src)))) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index e6b4a19..f4eb51d 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.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,8 +13,9 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +at.Makefile ?= Makefile _at.MAKEFILE_LIST ?= -_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(abspath $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) +_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(lastword $(filter %/$(at.Makefile),$(abspath $(MAKEFILE_LIST))))) # This bit only gets evaluated once, at the very beginning ifeq ($(origin _at.NO_ONCE),undefined) @@ -86,9 +87,6 @@ define at.nl endef -# External configuration ############################################### -at.Makefile ?= Makefile - # Include modules ###################################################### include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk)) _at.tmp_targets = diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk index dbb4ae9..8566a7f 100644 --- a/build-aux/Makefile.once.head/00-gitfiles.mk +++ b/build-aux/Makefile.once.head/00-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 @@ -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.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index a890d9d..59a7dc3 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-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,6 +13,9 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +# NB: intentionally resolve symlinks (tack on the -P flag to `cp` to +# not resolve them). The GNU Coding Standards say to avoid symlinks +# in tarballs. _dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 _dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3)) $(topoutdir)/$(dist.pkgname)-$(dist.version): $(_dist.files) -- cgit v1.2.3-54-g00ecf From 36e62cbb6bdb17c318c00ee55f8049930438aa83 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jan 2017 19:45:51 -0500 Subject: Tidy the files in the repo root. --- .gitignore | 3 +++ Makefile | 21 +-------------------- build-aux/Makefile.README.mk | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 20 deletions(-) mode change 100644 => 120000 Makefile create mode 100644 build-aux/Makefile.README.mk diff --git a/.gitignore b/.gitignore index 1cc39a1..30be33f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ +.tmp.* +.var.* + /gitfiles.mk diff --git a/Makefile b/Makefile deleted file mode 100644 index fe9010a..0000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# This Makefile is a minimal stub that exists to allow the -# `at-modules` set of Make targets to print documentation for the -# present Autothing modules. -# -# This file is part of the documentation for Autothing. -# -# Copyright (C) 2017 Luke Shumaker -# -# This documentation file is placed into the public domain. If that -# is not possible in your legal system, I grant you permission to use -# it in absolutely every way that I can legally grant to you. - -dist.pkgname = autothing -dist.version = 1.0 -gnuconf.pkgname = autothing - -topoutdir ?= . -topsrcdir ?= . -include $(topsrcdir)/build-aux/Makefile.head.mk -include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/Makefile b/Makefile new file mode 120000 index 0000000..4ecdba5 --- /dev/null +++ b/Makefile @@ -0,0 +1 @@ +build-aux/Makefile.README.mk \ No newline at end of file diff --git a/build-aux/Makefile.README.mk b/build-aux/Makefile.README.mk new file mode 100644 index 0000000..fe9010a --- /dev/null +++ b/build-aux/Makefile.README.mk @@ -0,0 +1,20 @@ +# This Makefile is a minimal stub that exists to allow the +# `at-modules` set of Make targets to print documentation for the +# present Autothing modules. +# +# This file is part of the documentation for Autothing. +# +# Copyright (C) 2017 Luke Shumaker +# +# This documentation file is placed into the public domain. If that +# is not possible in your legal system, I grant you permission to use +# it in absolutely every way that I can legally grant to you. + +dist.pkgname = autothing +dist.version = 1.0 +gnuconf.pkgname = autothing + +topoutdir ?= . +topsrcdir ?= . +include $(topsrcdir)/build-aux/Makefile.head.mk +include $(topsrcdir)/build-aux/Makefile.tail.mk -- cgit v1.2.3-54-g00ecf