From 42f72fea1078ddb379dd4e6df80a98e1072ba726 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 --- build-aux/Makefile.README.txt | 164 ++++++++++++++++++++++++++++++++++++++++++ build-aux/Makefile.head.mk | 49 +++++++++++++ build-aux/Makefile.tail.mk | 52 ++++++++++++++ 3 files changed, 265 insertions(+) create mode 100644 build-aux/Makefile.README.txt create mode 100644 build-aux/Makefile.head.mk create mode 100644 build-aux/Makefile.tail.mk (limited to 'build-aux') diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt new file mode 100644 index 0000000..935af5f --- /dev/null +++ b/build-aux/Makefile.README.txt @@ -0,0 +1,164 @@ +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. diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk new file mode 100644 index 0000000..e4ae329 --- /dev/null +++ b/build-aux/Makefile.head.mk @@ -0,0 +1,49 @@ +# 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 . + +# This bit only gets evaluated once, at the very beginning +ifeq ($(_am_NO_ONCE),) + +_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 = $(foreach p,$1,$(call _am_relto,.,$p)) + +$(_am)dirlocal += $(_am)subdirs +$(_am)dirlocal += $(_am)depdirs + +include $(topsrcdir)/common.once.head.mk + +endif # _am_NO_ONCE + +# This bit gets evaluated for each Makefile + +## Set outdir and srcdir (assumes that topoutdir and topsrcdir are +## already set) +outdir := $(call am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) +srcdir := $(call am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir))) + +_am_included_makefiles := $(_am_included_makefiles) $(call am_path,$(outdir)/Makefile) + +$(foreach v,$($(_am)dirlocal),$(eval $v=)) + +include $(topsrcdir)/common.each.head.mk diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk new file mode 100644 index 0000000..472d2db --- /dev/null +++ b/build-aux/Makefile.tail.mk @@ -0,0 +1,52 @@ +# 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 . + +# This bit gets evaluated for each Makefile processed + +include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk) + +# Make the namespaced versions of all of the dirlocal variables +$(foreach v,$($(_am)dirlocal),$(eval $v/$(outdir) = $($v))) + +# Remember that this is a directory that we've visited +_am_outdirs := $(_am_outdirs) $(outdir) + +# Generic phony target declarations: +# mark them phony +.PHONY: $(addprefix $(outdir)/,$($(_am)phony)) +# have them depend on subdirs +$(foreach t,$($(_am)phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) + +# Include Makefiles from other directories + +define _am_nl + + +endef +$(foreach _am_NO_ONCE,y,\ + $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$($(_am)subdirs) $($(_am)depdirs))),\ + $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) + +# This bit only gets evaluated once, after all of the other Makefiles are read +ifeq ($(_am_NO_ONCE),) + +outdir = /bogus +srcdir = /bogus + +$(foreach v,$($(_am)dirlocal),$(eval $v=)) + +include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk) + +endif # _am_NO_ONCE -- cgit v1.2.2 From df54432d56964e39b49915289a44fe5569ce9eb1 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 --- build-aux/Makefile.each.tail/10-std.mk | 42 ++++++++++++++++++++++++++++++++++ build-aux/Makefile.once.head/10-std.mk | 31 +++++++++++++++++++++++++ build-aux/Makefile.once.tail/10-std.mk | 16 +++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 build-aux/Makefile.each.tail/10-std.mk create mode 100644 build-aux/Makefile.once.head/10-std.mk create mode 100644 build-aux/Makefile.once.tail/10-std.mk (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk new file mode 100644 index 0000000..ca8497c --- /dev/null +++ b/build-aux/Makefile.each.tail/10-std.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 . + +# Add some more defaults to the *_files variables +$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) + +# Make each of the standard variables relative to the correct directory +$(_am)src_files := $(addprefix $(srcdir)/,$($(_am)src_files)) +$(_am)gen_files := $(addprefix $(srcdir)/,$($(_am)gen_files)) +$(_am)cfg_files := $(addprefix $(outdir)/,$($(_am)cfg_files)) +$(_am)out_files := $(addprefix $(outdir)/,$($(_am)out_files)) +$(_am)sys_files := $(addprefix $(DESTDIR),$($(_am)sys_files)) +$(_am)clean_files := $(addprefix $(outdir)/,$($(_am)clean_files)) +$(_am)slow_files := $(addprefix $(outdir)/,$($(_am)slow_files)) +$(_am)subdirs := $(addprefix $(outdir)/,$($(_am)subdirs)) + +# Creative targets +$(outdir)/build : $($(_am)out_files/$(outdir)) +$(outdir)/install : $($(_am)sys_files/$(outdir)) +$(outdir)/installdirs: $(dir $($(_am)sys_files/$(outdir))) + +# Destructive targets +_am_uninstall/$(outdir) = $(_am_sys_files/$(outdir)) +_am_mostlyclean/$(outdir) = $(filter-out $(_am_slow_files/$(outdir)) $(_am_cfg_files/$(outdir)) $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) +_am_clean/$(outdir) = $(filter-out $(_am_cfg_files/$(outdir)) $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) +_am_distclean/$(outdir) = $(filter-out $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) +_am_maintainer-clean/$(outdir) = $(filter-out $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): + $(RM) -- $(sort $(_am_$(@F)/$(@D))) + $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk new file mode 100644 index 0000000..dec850c --- /dev/null +++ b/build-aux/Makefile.once.head/10-std.mk @@ -0,0 +1,31 @@ +# 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 + +# Standard creative PHONY targets +$(_am)phony += build install installdirs +# Standard destructive PHONY targets +$(_am)phony += uninstall mostlyclean clean distclean maintainer-clean + +$(_am)dirlocal += $(_am)src_files +$(_am)dirlocal += $(_am)gen_files +$(_am)dirlocal += $(_am)cfg_files +$(_am)dirlocal += $(_am)out_files +$(_am)dirlocal += $(_am)sys_files +$(_am)dirlocal += $(_am)clean_files +$(_am)dirlocal += $(_am)slow_files diff --git a/build-aux/Makefile.once.tail/10-std.mk b/build-aux/Makefile.once.tail/10-std.mk new file mode 100644 index 0000000..56c4f2c --- /dev/null +++ b/build-aux/Makefile.once.tail/10-std.mk @@ -0,0 +1,16 @@ +# 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 . + +.PHONY: noop -- cgit v1.2.2 From 42bc23772059e663a8195a086e0b5b3c32366a92 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 --- build-aux/Makefile.each.tail/00-dist.mk | 18 +++++++++++++++ build-aux/Makefile.once.head/00-dist.mk | 16 +++++++++++++ build-aux/Makefile.once.tail/00-dist.mk | 40 +++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 build-aux/Makefile.each.tail/00-dist.mk create mode 100644 build-aux/Makefile.once.head/00-dist.mk create mode 100644 build-aux/Makefile.once.tail/00-dist.mk (limited to 'build-aux') 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..042af23 --- /dev/null +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -0,0 +1,18 @@ +# 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 . + +ifeq ($(outdir),$(topoutdir)) +$(_am)clean_files += $(addprefix $(PACKAGE)-*,$($(_am)distexts) /) +endif diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk new file mode 100644 index 0000000..5be9c72 --- /dev/null +++ b/build-aux/Makefile.once.head/00-dist.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 . + +$(_am)distexts ?= .tar.gz diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk new file mode 100644 index 0000000..2527404 --- /dev/null +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -0,0 +1,40 @@ +# 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 the `dist` target +.PHONY: dist +dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$($(_am)distexts) + +$(topoutdir)/$(PACKAGE)-$(VERSION).tar: $(topoutdir)/$(PACKAGE)-$(VERSION) + $(TAR) cf $@ -C $( Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- build-aux/Makefile.head.mk | 39 +++++++++++++++++++++------------------ build-aux/Makefile.tail.mk | 25 ++++++++++--------------- 2 files changed, 31 insertions(+), 33 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index e4ae329..e5ef379 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -14,36 +14,39 @@ # along with this program. If not, see . # This bit only gets evaluated once, at the very beginning -ifeq ($(_am_NO_ONCE),) +ifeq ($(_at.NO_ONCE),) + +_at.noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) +# These are all $(call _at.func,parent,child) +#_at.relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) +_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) +_at.relto_helper = $(if $(call _at.is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _at.relto_helper,$(patsubst %/,%,$(dir $1)),$2))) +_at.relto = $(call _at.noslash,$(call _at.relto_helper,$(call _at.noslash,$(abspath $1)),$(call _at.noslash,$(abspath $2)))) +# Note that _at.is_subdir says that a directory is a subdirectory of +# itself. +at.path = $(foreach p,$1,$(call _at.relto,.,$p)) -_am = am_ +define at.nl -_am_noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) -# These are all $(call _am_func,parent,child) -#_am_relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -_am_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_am_relto_helper = $(if $(call _am_is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _am_relto_helper,$(patsubst %/,%,$(dir $1)),$2))) -_am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(abspath $1)),$(call _am_noslash,$(abspath $2)))) -# Note that _am_is_subdir says that a directory is a subdirectory of -# itself. -am_path = $(foreach p,$1,$(call _am_relto,.,$p)) -$(_am)dirlocal += $(_am)subdirs -$(_am)dirlocal += $(_am)depdirs +endef + +at.dirlocal += at.subdirs +at.dirlocal += at.depdirs include $(topsrcdir)/common.once.head.mk -endif # _am_NO_ONCE +endif # _at.NO_ONCE # This bit gets evaluated for each Makefile ## Set outdir and srcdir (assumes that topoutdir and topsrcdir are ## already set) -outdir := $(call am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) -srcdir := $(call am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir))) +outdir := $(call at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) +srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir))) -_am_included_makefiles := $(_am_included_makefiles) $(call am_path,$(outdir)/Makefile) +_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/Makefile) -$(foreach v,$($(_am)dirlocal),$(eval $v=)) +$(foreach v,$(at.dirlocal),$(eval $v=)) include $(topsrcdir)/common.each.head.mk diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index 472d2db..bb197dc 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -18,35 +18,30 @@ include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk) # Make the namespaced versions of all of the dirlocal variables -$(foreach v,$($(_am)dirlocal),$(eval $v/$(outdir) = $($v))) +$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) = $($v))) # Remember that this is a directory that we've visited -_am_outdirs := $(_am_outdirs) $(outdir) +_at.outdirs := $(_at.outdirs) $(outdir) # Generic phony target declarations: # mark them phony -.PHONY: $(addprefix $(outdir)/,$($(_am)phony)) +.PHONY: $(addprefix $(outdir)/,$(at.phony)) # have them depend on subdirs -$(foreach t,$($(_am)phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) +$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) # Include Makefiles from other directories - -define _am_nl - - -endef -$(foreach _am_NO_ONCE,y,\ - $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$($(_am)subdirs) $($(_am)depdirs))),\ - $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) +$(foreach _at.NO_ONCE,y,\ + $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$(at.subdirs) $(at.depdirs))),\ + $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_am_NO_ONCE),) +ifeq ($(_at.NO_ONCE),) outdir = /bogus srcdir = /bogus -$(foreach v,$($(_am)dirlocal),$(eval $v=)) +$(foreach v,$(at.dirlocal),$(eval $v=)) include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk) -endif # _am_NO_ONCE +endif # _at.NO_ONCE -- cgit v1.2.2 From 44595e16ebcde42a730d927a0f7b563feef084a3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- build-aux/Makefile.each.tail/10-std.mk | 39 +++++++++++++++++----------------- build-aux/Makefile.once.head/10-std.mk | 20 +++++++++-------- 2 files changed, 30 insertions(+), 29 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index ca8497c..4d36cc5 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -12,31 +12,30 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - # Add some more defaults to the *_files variables -$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) +std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) # Make each of the standard variables relative to the correct directory -$(_am)src_files := $(addprefix $(srcdir)/,$($(_am)src_files)) -$(_am)gen_files := $(addprefix $(srcdir)/,$($(_am)gen_files)) -$(_am)cfg_files := $(addprefix $(outdir)/,$($(_am)cfg_files)) -$(_am)out_files := $(addprefix $(outdir)/,$($(_am)out_files)) -$(_am)sys_files := $(addprefix $(DESTDIR),$($(_am)sys_files)) -$(_am)clean_files := $(addprefix $(outdir)/,$($(_am)clean_files)) -$(_am)slow_files := $(addprefix $(outdir)/,$($(_am)slow_files)) -$(_am)subdirs := $(addprefix $(outdir)/,$($(_am)subdirs)) +std.src_files := $(addprefix $(srcdir)/,$(std.src_files)) +std.gen_files := $(addprefix $(srcdir)/,$(std.gen_files)) +std.cfg_files := $(addprefix $(outdir)/,$(std.cfg_files)) +std.out_files := $(addprefix $(outdir)/,$(std.out_files)) +std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) +std.clean_files := $(addprefix $(outdir)/,$(std.clean_files)) +std.slow_files := $(addprefix $(outdir)/,$(std.slow_files)) +std.subdirs := $(addprefix $(outdir)/,$(std.subdirs)) # Creative targets -$(outdir)/build : $($(_am)out_files/$(outdir)) -$(outdir)/install : $($(_am)sys_files/$(outdir)) -$(outdir)/installdirs: $(dir $($(_am)sys_files/$(outdir))) +$(outdir)/build : $(std.out_files) +$(outdir)/install : $(std.sys_files) +$(outdir)/installdirs: $(dir $(std.sys_files)) # Destructive targets -_am_uninstall/$(outdir) = $(_am_sys_files/$(outdir)) -_am_mostlyclean/$(outdir) = $(filter-out $(_am_slow_files/$(outdir)) $(_am_cfg_files/$(outdir)) $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) -_am_clean/$(outdir) = $(filter-out $(_am_cfg_files/$(outdir)) $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) -_am_distclean/$(outdir) = $(filter-out $(_am_gen_files/$(outdir)) $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) -_am_maintainer-clean/$(outdir) = $(filter-out $(_am_src_files/$(outdir)),$(_am_clean_files/$(outdir))) +_std.uninstall/$(outdir) := $(_std.sys_files) +_std.mostlyclean/$(outdir) := $(filter-out $(_std.slow_files) $(_std.cfg_files) $(_std.gen_files) $(_std.src_files),$(_std.clean_files)) +_std.clean/$(outdir) := $(filter-out $(_std.cfg_files) $(_std.gen_files) $(_std.src_files),$(_std.clean_files)) +_std.distclean/$(outdir) := $(filter-out $(_std.gen_files) $(_std.src_files),$(_std.clean_files)) +_std.maintainer-clean/$(outdir) := $(filter-out $(_std.src_files),$(_std.clean_files)) $(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): - $(RM) -- $(sort $(_am_$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) + $(RM) -- $(sort $(_std.$(@F)/$(@D))) + $(RMDIRS) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk index dec850c..b3d7c4a 100644 --- a/build-aux/Makefile.once.head/10-std.mk +++ b/build-aux/Makefile.once.head/10-std.mk @@ -17,15 +17,17 @@ all: build .PHONY: all +DESTDIR ?= + # Standard creative PHONY targets -$(_am)phony += build install installdirs +at.phony += build install installdirs # Standard destructive PHONY targets -$(_am)phony += uninstall mostlyclean clean distclean maintainer-clean +at.phony += uninstall mostlyclean clean distclean maintainer-clean -$(_am)dirlocal += $(_am)src_files -$(_am)dirlocal += $(_am)gen_files -$(_am)dirlocal += $(_am)cfg_files -$(_am)dirlocal += $(_am)out_files -$(_am)dirlocal += $(_am)sys_files -$(_am)dirlocal += $(_am)clean_files -$(_am)dirlocal += $(_am)slow_files +at.dirlocal += std.src_files +at.dirlocal += std.gen_files +at.dirlocal += std.cfg_files +at.dirlocal += std.out_files +at.dirlocal += std.sys_files +at.dirlocal += std.clean_files +at.dirlocal += std.slow_files -- cgit v1.2.2 From 7d1baa39157b6ab5e9f0cb6b5413f6fc1e2d4eea Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- build-aux/Makefile.each.tail/00-dist.mk | 2 +- build-aux/Makefile.once.head/00-dist.mk | 17 +---------------- build-aux/Makefile.once.tail/00-dist.mk | 30 +++++++++++++++++------------- 3 files changed, 19 insertions(+), 30 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk index 042af23..1ab7568 100644 --- a/build-aux/Makefile.each.tail/00-dist.mk +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -14,5 +14,5 @@ # along with this program. If not, see . ifeq ($(outdir),$(topoutdir)) -$(_am)clean_files += $(addprefix $(PACKAGE)-*,$($(_am)distexts) /) +std.clean_files += $(addprefix $(PACKAGE)-*,$(dist.exts) /) endif diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk index 5be9c72..314f7f8 100644 --- a/build-aux/Makefile.once.head/00-dist.mk +++ b/build-aux/Makefile.once.head/00-dist.mk @@ -1,16 +1 @@ -# Copyright (C) 2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -$(_am)distexts ?= .tar.gz +dist.exts ?= .tar.gz diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index 2527404..d8fa226 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -17,10 +17,7 @@ .PHONY: dist dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$($(_am)distexts) -$(topoutdir)/$(PACKAGE)-$(VERSION).tar: $(topoutdir)/$(PACKAGE)-$(VERSION) - $(TAR) cf $@ -C $( $@ + +CP ?= cp +GZIP ?= gzip +MKDIR ?= mkdir +MKDIR_P ?= mkdir -p +MV ?= mv +RM ?= rm -f +RMDIR_P ?= rmdir -p +TAR ?= tar +TRUE ?= true + +GZIP_ENV ?= --best -- cgit v1.2.2 From a50081a79688df9ff91a2ea48852bcd23fb56c0f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- build-aux/Makefile.once.head/11-gnustandards.mk | 181 ++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 build-aux/Makefile.once.head/11-gnustandards.mk (limited to 'build-aux') diff --git a/build-aux/Makefile.once.head/11-gnustandards.mk b/build-aux/Makefile.once.head/11-gnustandards.mk new file mode 100644 index 0000000..5520b9b --- /dev/null +++ b/build-aux/Makefile.once.head/11-gnustandards.mk @@ -0,0 +1,181 @@ +# This file is based on §7.2 "Makefile Conventions" of the release of +# the GNU Coding Standards dated April 13, 2016. + +# 7.2.1: General Conventions for Makefiles +# ---------------------------------------- + +# The standards claim that every Makefile should contain +# +# SHELL = /bin/sh` +# +# but note that this is unnescesary with GNU Make. + +# 7.2.2: Utilities in Makefiles +# ----------------------------- + +# It's ok to hard-code these commands in rules, but who wants to +# memorize the list of what's ok? +AWK ?= awk +CAT ?= cat +CMP ?= cmp +CP ?= cp +DIFF ?= diff +ECHO ?= echo +EGREP ?= egrep +EXPR ?= expr +FALSE ?= false +GREP ?= grep +INSTALL_INFO ?= install-info +LN ?= ln +LS ?= ls +MKDIR ?= mkdir +MV ?= mv +PRINTF ?= printf +PWD ?= pwd +RM ?= rm +RMDIR ?= rmdir +SED ?= sed +SLEEP ?= sleep +SORT ?= sort +TAR ?= tar +TEST ?= test +TOUCH ?= touch +TR ?= tr +TRUE ?= true + +# Beyond those, define them yourself. + +# 7.2.3 Variables for Specifying Commands +# --------------------------------------- + +INSTALL ?= install +INSTALL_PROGRAM ?= $(INSTALL) +INSTALL_DATA ?= ${INSTALL} -m 644 + +# 7.2.4 DESTDIR: Support for Staged Installs +# ------------------------------------------ + +# This is done for us by the std module. + +# 7.2.5 Variables for Installation Directories +# -------------------------------------------- + +# Root for the installation +prefix ?= /usr/local +exec_prefix ?= $(prefix) +# Executable programs +bindir ?= $(exec_prefix)/bin +sbindir ?= $(exec_prefix)/sbin +libexecdir ?= $(exec_prefix)/libexec +gnu.program_dirs += $(bindir) $(sbindir) $(libexecdir) +# Data files +datarootdir ?= $(prefix)/share +datadir ?= $(datarootdir) +sysconfdir ?= $(prefix)/etc +sharedstatedir ?= $(prefix)/com +localstatedir ?= $(prefix)/var +runstatedir ?= $(localstatedir)/run +gnu.data_dirs += $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) +# Specific types of files +includedir ?= $(prefix)/include +oldincludedir ?= /usr/include +docdir ?= $(datarootdir)/doc/$(PACKAGE) +infodir ?= $(datarootdir)/info +htmldir ?= $(docdir) +dvidir ?= $(docdir) +pdfdir ?= $(docdir) +psdir ?= $(docdir) +libdir ?= $(exec_prefix)/lib +lispdir ?= $(datarootdir)/emacs/site-lisp +localedir ?= $(datarootdir)/locale +gnu.data_dirs += $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) + +mandir ?= $(datarootdir)/man +man1dir ?= $(mandir)/man1 +man2dir ?= $(mandir)/man2 +man3dir ?= $(mandir)/man3 +man4dir ?= $(mandir)/man4 +man5dir ?= $(mandir)/man5 +man6dir ?= $(mandir)/man6 +man7dir ?= $(mandir)/man7 +man8dir ?= $(mandir)/man8 +gnu.data_dirs += $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) + +manext ?= .1 +man1ext ?= .1 +man2ext ?= .2 +man3ext ?= .3 +man4ext ?= .4 +man5ext ?= .5 +man6ext ?= .6 +man7ext ?= .7 +man8ext ?= .8 + +# srcdir is handled for us by the core + +define _gnu.install_program +$$($1)/%: $$(outdir)/$$($1) + $$(NORMAL_INSTALL) + $$(INSTALL_PROGRAM) +$$($1)/%: $$(srcdir)/$$($1) + $$(NORMAL_INSTALL) + $$(INSTALL_PROGRAM) +endef +$(foreach d,$(gnu.program_dirs),$(eval $(call _gnu.install_program,$d))) + +define _gnu.install_data +$$($1)/%: $$(outdir)/$$($1) + $$(NORMAL_INSTALL) + $$(INSTALL_DATA) +$$($1)/%: $$(srcdir)/$$($1) + $$(NORMAL_INSTALL) + $$(INSTALL_DATA) +endef +$(foreach d,$(gnu.data_dirs),$(eval $(call _gnu.install_data,$d))) + +gnu.dirs += $(gnu.program_dirs) $(gnu.data_dirs) +$(gnu.dirs): + $(MKDIR_P) $@ + +# 7.2.6: Standard Targets for Users +# --------------------------------- + +gnu.info_docs ?= +std.sys_files += $(foreach f,$(gnu.info_docs), $(infodir)/$f.info ) + +#all: std +#install: std +$(outdir)/install-html: $(foreach f,$(gnu.info_docs), $(DESTDIR)$(htmldir)/$f.html ) +$(outdir)/install-dvi : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) +$(outdir)/install-pdf : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) +$(outdir)/install-ps : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(psdir)/$f.ps ) +#uninstall: std +$(outdir)/install-strip: install + $(STRIP $(filter $(bindir)/% $(sbindir)/% $(libexecdir)/%,$(std.sys_files/$(@D))) +#clean: std +#distclean: std +#mostlyclean: std +#maintainer-clean: std +TAGS: TODO +$(outdir)/info: $(addsuffix .info,$(gnu.info_docs)) +$(outdir)/dvi : $(addsuffix .dvi ,$(gnu.info_docs)) +$(outdir)/html: $(addsuffix .html,$(gnu.info_docs)) +$(outdir)/pdf : $(addsuffix .pdf ,$(gnu.info_docs)) +$(outdir)/ps : $(addsuffix .ps ,$(gnu.info_docs)) +#dist:dist +check: TODO +installcheck: TODO +#installdirs: std + +$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< + + + +#installdirs: std + +# 7.2.7: Standard Targets for Users +# --------------------------------- -- cgit v1.2.2 From d98870ac5acfe42d410383dfe7f2af18923510c4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- build-aux/Makefile.once.head/00-write-ifchanged.mk | 1 + build-aux/write-ifchanged | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 build-aux/Makefile.once.head/00-write-ifchanged.mk create mode 100755 build-aux/write-ifchanged (limited to 'build-aux') diff --git a/build-aux/Makefile.once.head/00-write-ifchanged.mk b/build-aux/Makefile.once.head/00-write-ifchanged.mk new file mode 100644 index 0000000..79ef1c4 --- /dev/null +++ b/build-aux/Makefile.once.head/00-write-ifchanged.mk @@ -0,0 +1 @@ +WRITE_IFCHANGED = $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/write-ifchanged b/build-aux/write-ifchanged new file mode 100755 index 0000000..185ceb0 --- /dev/null +++ b/build-aux/write-ifchanged @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Copyright (C) 2015 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +outfile=$1 +tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}" + +cat > "$tmpfile" || exit $? +if cmp -s "$tmpfile" "$outfile"; then + rm -f "$tmpfile" || : +else + mv -f "$tmpfile" "$outfile" +fi -- cgit v1.2.2 From 8441649be887b54222d52fb9e69247c9012acff2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 16:09:27 -0400 Subject: Remove everything but the core --- build-aux/Makefile.each.head/.gitignore | 0 build-aux/Makefile.each.tail/.gitignore | 0 build-aux/Makefile.once.head/.gitignore | 0 build-aux/Makefile.once.tail/.gitignore | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 build-aux/Makefile.each.head/.gitignore create mode 100644 build-aux/Makefile.each.tail/.gitignore create mode 100644 build-aux/Makefile.once.head/.gitignore create mode 100644 build-aux/Makefile.once.tail/.gitignore (limited to 'build-aux') diff --git a/build-aux/Makefile.each.head/.gitignore b/build-aux/Makefile.each.head/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/build-aux/Makefile.each.tail/.gitignore b/build-aux/Makefile.each.tail/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/build-aux/Makefile.once.head/.gitignore b/build-aux/Makefile.once.head/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/build-aux/Makefile.once.tail/.gitignore b/build-aux/Makefile.once.tail/.gitignore new file mode 100644 index 0000000..e69de29 -- cgit v1.2.2 From 85c37c0e6f8ebf9d816f984a3499d856a2e708b1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 17:05:41 -0400 Subject: tidy up --- build-aux/Makefile.each.tail/10-std.mk | 2 +- build-aux/Makefile.once.head/10-std.mk | 12 +++++++++--- build-aux/Makefile.once.tail/10-std.mk | 16 ---------------- 3 files changed, 10 insertions(+), 20 deletions(-) delete mode 100644 build-aux/Makefile.once.tail/10-std.mk (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index 4d36cc5..8cebc7f 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -38,4 +38,4 @@ _std.distclean/$(outdir) := $(filter-out _std.maintainer-clean/$(outdir) := $(filter-out $(_std.src_files),$(_std.clean_files)) $(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): $(RM) -- $(sort $(_std.$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) + $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk index b3d7c4a..3e058ec 100644 --- a/build-aux/Makefile.once.head/10-std.mk +++ b/build-aux/Makefile.once.head/10-std.mk @@ -15,9 +15,7 @@ # Declare the default target all: build -.PHONY: all - -DESTDIR ?= +.PHONY: all noop # Standard creative PHONY targets at.phony += build install installdirs @@ -31,3 +29,11 @@ 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.tail/10-std.mk b/build-aux/Makefile.once.tail/10-std.mk deleted file mode 100644 index 56c4f2c..0000000 --- a/build-aux/Makefile.once.tail/10-std.mk +++ /dev/null @@ -1,16 +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 . - -.PHONY: noop -- cgit v1.2.2 From cbe8694c76ea68d56073ffe3e74359a5db4d997a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 17:29:02 -0400 Subject: tidy --- build-aux/Makefile.each.tail/00-dist.mk | 4 +++- build-aux/Makefile.once.head/00-dist.mk | 36 +++++++++++++++++++++++++++++++++ build-aux/Makefile.once.tail/00-dist.mk | 26 +++++------------------- 3 files changed, 44 insertions(+), 22 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk index 1ab7568..6e6a5cb 100644 --- a/build-aux/Makefile.each.tail/00-dist.mk +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -14,5 +14,7 @@ # along with this program. If not, see . ifeq ($(outdir),$(topoutdir)) -std.clean_files += $(addprefix $(PACKAGE)-*,$(dist.exts) /) +std.clean_files += $(addprefix $(PACKAGE)-*,$(dist.exts) .tar /) endif + +$(outdir)/dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$(dist.exts)) diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk index 314f7f8..98fc6b3 100644 --- a/build-aux/Makefile.once.head/00-dist.mk +++ b/build-aux/Makefile.once.head/00-dist.mk @@ -1 +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 . + +# Developer configuration + dist.exts ?= .tar.gz +PACKAGE ?= YOUR_PACKAGE_NAME +VERSION ?= 0.0.1 + +# 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.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index d8fa226..ef3ecb1 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -13,32 +13,16 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -# Add the `dist` target -.PHONY: dist -dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$($(_am)distexts) - -_am_copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 -_am_addfile = $(call _am_copyfile,$3,$2/$(call _am_relto,$1,$3)) -$(topoutdir)/$(PACKAGE)-$(VERSION): $(_am_src_files/$(topoutdir)) $(_am_gen_files/$(topoutdir)) +_dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 +_dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3)) +$(topoutdir)/$(PACKAGE)-$(VERSION): $(std.src_files/$(topoutdir)) $(std.gen_files/$(topoutdir)) $(RM) -r $@ @PS4='' && set -x && \ $(MKDIR) $(@D)/tmp.$(@F).$$$$ && \ - $(foreach f,$^,$(call _am_addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ + $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ $(MV) $(@D)/tmp.$(@F).$$$$ $@ || $(RM) -r $(@D)/tmp.$(@F).$$$$ $(topoutdir)/$(PACKAGE)-$(VERSION).tar: $(topoutdir)/$(PACKAGE)-$(VERSION) $(TAR) cf $@ -C $( $@ - -CP ?= cp -GZIP ?= gzip -MKDIR ?= mkdir -MKDIR_P ?= mkdir -p -MV ?= mv -RM ?= rm -f -RMDIR_P ?= rmdir -p -TAR ?= tar -TRUE ?= true - -GZIP_ENV ?= --best + $(GZIP) $(GZIPFLAGS) < $< > $@ -- cgit v1.2.2 From 37b88c702ebe46611435f528b087d82c53dfcc77 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 17:37:41 -0400 Subject: rename PACKAGE->dist.name VERSION->dist.version --- build-aux/Makefile.each.tail/00-dist.mk | 4 ++-- build-aux/Makefile.once.head/00-dist.mk | 11 +++++++++-- build-aux/Makefile.once.tail/00-dist.mk | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk index 6e6a5cb..d85ecc0 100644 --- a/build-aux/Makefile.each.tail/00-dist.mk +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -14,7 +14,7 @@ # along with this program. If not, see . ifeq ($(outdir),$(topoutdir)) -std.clean_files += $(addprefix $(PACKAGE)-*,$(dist.exts) .tar /) +std.clean_files += $(addprefix $(dist.name)-*,$(dist.exts) .tar /) endif -$(outdir)/dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$(dist.exts)) +$(outdir)/dist: $(addprefix $(topoutdir)/$(dist.name)-$(dist.version),$(dist.exts)) diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk index 98fc6b3..6a54b7d 100644 --- a/build-aux/Makefile.once.head/00-dist.mk +++ b/build-aux/Makefile.once.head/00-dist.mk @@ -16,8 +16,15 @@ # Developer configuration dist.exts ?= .tar.gz -PACKAGE ?= YOUR_PACKAGE_NAME -VERSION ?= 0.0.1 +dist.name ?= $(PACKAGE) +dist.version ?= $(VERSION) + +ifeq ($(dist.name),) +$(error dist.name must be set) +endif +ifeq ($(dist.version),) +$(error dist.name must be set) +endif # User configuration diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index ef3ecb1..ee28fac 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -15,14 +15,14 @@ _dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 _dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3)) -$(topoutdir)/$(PACKAGE)-$(VERSION): $(std.src_files/$(topoutdir)) $(std.gen_files/$(topoutdir)) +$(topoutdir)/$(dist.name)-$(dist.version): $(std.src_files/$(topoutdir)) $(std.gen_files/$(topoutdir)) $(RM) -r $@ @PS4='' && set -x && \ $(MKDIR) $(@D)/tmp.$(@F).$$$$ && \ $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ $(MV) $(@D)/tmp.$(@F).$$$$ $@ || $(RM) -r $(@D)/tmp.$(@F).$$$$ -$(topoutdir)/$(PACKAGE)-$(VERSION).tar: $(topoutdir)/$(PACKAGE)-$(VERSION) +$(topoutdir)/$(dist.name)-$(dist.version).tar: $(topoutdir)/$(dist.name)-$(dist.version) $(TAR) cf $@ -C $( $@ -- cgit v1.2.2 From c53ae3285fb85d3b70870692a0206ab0c6521796 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 18:38:08 -0400 Subject: oops --- build-aux/Makefile.once.head/00-dist.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk index 6a54b7d..2f1da66 100644 --- a/build-aux/Makefile.once.head/00-dist.mk +++ b/build-aux/Makefile.once.head/00-dist.mk @@ -23,7 +23,7 @@ ifeq ($(dist.name),) $(error dist.name must be set) endif ifeq ($(dist.version),) -$(error dist.name must be set) +$(error dist.version must be set) endif # User configuration -- cgit v1.2.2 From 68affbbe3a2258510f48c62400cc95ad042c959d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 18:38:23 -0400 Subject: Rename dist.name -> dist.pkgname --- build-aux/Makefile.each.tail/00-dist.mk | 4 ++-- build-aux/Makefile.once.head/00-dist.mk | 6 +++--- build-aux/Makefile.once.tail/00-dist.mk | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk index d85ecc0..a094305 100644 --- a/build-aux/Makefile.each.tail/00-dist.mk +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -14,7 +14,7 @@ # along with this program. If not, see . ifeq ($(outdir),$(topoutdir)) -std.clean_files += $(addprefix $(dist.name)-*,$(dist.exts) .tar /) +std.clean_files += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /) endif -$(outdir)/dist: $(addprefix $(topoutdir)/$(dist.name)-$(dist.version),$(dist.exts)) +$(outdir)/dist: $(addprefix $(topoutdir)/$(dist.pkgname)-$(dist.version),$(dist.exts)) diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk index 2f1da66..d5bfcd3 100644 --- a/build-aux/Makefile.once.head/00-dist.mk +++ b/build-aux/Makefile.once.head/00-dist.mk @@ -16,11 +16,11 @@ # Developer configuration dist.exts ?= .tar.gz -dist.name ?= $(PACKAGE) +dist.pkgname ?= $(PACKAGE) dist.version ?= $(VERSION) -ifeq ($(dist.name),) -$(error dist.name must be set) +ifeq ($(dist.pkgname),) +$(error dist.pkgname must be set) endif ifeq ($(dist.version),) $(error dist.version must be set) diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index ee28fac..3990f57 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -15,14 +15,14 @@ _dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 _dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3)) -$(topoutdir)/$(dist.name)-$(dist.version): $(std.src_files/$(topoutdir)) $(std.gen_files/$(topoutdir)) +$(topoutdir)/$(dist.pkgname)-$(dist.version): $(std.src_files/$(topoutdir)) $(std.gen_files/$(topoutdir)) $(RM) -r $@ @PS4='' && set -x && \ $(MKDIR) $(@D)/tmp.$(@F).$$$$ && \ $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ $(MV) $(@D)/tmp.$(@F).$$$$ $@ || $(RM) -r $(@D)/tmp.$(@F).$$$$ -$(topoutdir)/$(dist.name)-$(dist.version).tar: $(topoutdir)/$(dist.name)-$(dist.version) +$(topoutdir)/$(dist.pkgname)-$(dist.version).tar: $(topoutdir)/$(dist.pkgname)-$(dist.version) $(TAR) cf $@ -C $( $@ -- cgit v1.2.2 From 0b3959406003cb61c9d10e2f1d45c755ec700392 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 18:39:41 -0400 Subject: add checks that top{src,out}dir are set --- build-aux/Makefile.head.mk | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'build-aux') diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index e5ef379..c680f41 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -16,6 +16,13 @@ # This bit only gets evaluated once, at the very beginning ifeq ($(_at.NO_ONCE),) +ifeq ($(topsrcdir),) +$(error topsrcdir must be set before including Makefile.head.mk) +endif +ifeq ($(topoutdir),) +$(error topoutdir must be set before including Makefile.head.mk) +endif + _at.noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) # These are all $(call _at.func,parent,child) #_at.relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -- cgit v1.2.2 From ac719e8d3e8795059752451c859af9071a1303f4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 19:15:05 -0400 Subject: tidy --- build-aux/Makefile.each.tail/11-gnu.mk | 59 ++++++++ build-aux/Makefile.once.head/11-gnu.mk | 143 +++++++++++++++++++ build-aux/Makefile.once.head/11-gnustandards.mk | 181 ------------------------ build-aux/Makefile.once.tail/11-gnu.mk | 17 +++ 4 files changed, 219 insertions(+), 181 deletions(-) create mode 100644 build-aux/Makefile.each.tail/11-gnu.mk create mode 100644 build-aux/Makefile.once.head/11-gnu.mk delete mode 100644 build-aux/Makefile.once.head/11-gnustandards.mk create mode 100644 build-aux/Makefile.once.tail/11-gnu.mk (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/11-gnu.mk b/build-aux/Makefile.each.tail/11-gnu.mk new file mode 100644 index 0000000..c7cb1cb --- /dev/null +++ b/build-aux/Makefile.each.tail/11-gnu.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,$(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.once.head/11-gnu.mk b/build-aux/Makefile.once.head/11-gnu.mk new file mode 100644 index 0000000..b704a57 --- /dev/null +++ b/build-aux/Makefile.once.head/11-gnu.mk @@ -0,0 +1,143 @@ +# 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-gnustandards.mk b/build-aux/Makefile.once.head/11-gnustandards.mk deleted file mode 100644 index 5520b9b..0000000 --- a/build-aux/Makefile.once.head/11-gnustandards.mk +++ /dev/null @@ -1,181 +0,0 @@ -# This file is based on §7.2 "Makefile Conventions" of the release of -# the GNU Coding Standards dated April 13, 2016. - -# 7.2.1: General Conventions for Makefiles -# ---------------------------------------- - -# The standards claim that every Makefile should contain -# -# SHELL = /bin/sh` -# -# but note that this is unnescesary with GNU Make. - -# 7.2.2: Utilities in Makefiles -# ----------------------------- - -# It's ok to hard-code these commands in rules, but who wants to -# memorize the list of what's ok? -AWK ?= awk -CAT ?= cat -CMP ?= cmp -CP ?= cp -DIFF ?= diff -ECHO ?= echo -EGREP ?= egrep -EXPR ?= expr -FALSE ?= false -GREP ?= grep -INSTALL_INFO ?= install-info -LN ?= ln -LS ?= ls -MKDIR ?= mkdir -MV ?= mv -PRINTF ?= printf -PWD ?= pwd -RM ?= rm -RMDIR ?= rmdir -SED ?= sed -SLEEP ?= sleep -SORT ?= sort -TAR ?= tar -TEST ?= test -TOUCH ?= touch -TR ?= tr -TRUE ?= true - -# Beyond those, define them yourself. - -# 7.2.3 Variables for Specifying Commands -# --------------------------------------- - -INSTALL ?= install -INSTALL_PROGRAM ?= $(INSTALL) -INSTALL_DATA ?= ${INSTALL} -m 644 - -# 7.2.4 DESTDIR: Support for Staged Installs -# ------------------------------------------ - -# This is done for us by the std module. - -# 7.2.5 Variables for Installation Directories -# -------------------------------------------- - -# Root for the installation -prefix ?= /usr/local -exec_prefix ?= $(prefix) -# Executable programs -bindir ?= $(exec_prefix)/bin -sbindir ?= $(exec_prefix)/sbin -libexecdir ?= $(exec_prefix)/libexec -gnu.program_dirs += $(bindir) $(sbindir) $(libexecdir) -# Data files -datarootdir ?= $(prefix)/share -datadir ?= $(datarootdir) -sysconfdir ?= $(prefix)/etc -sharedstatedir ?= $(prefix)/com -localstatedir ?= $(prefix)/var -runstatedir ?= $(localstatedir)/run -gnu.data_dirs += $(datarootdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(runstatedir) -# Specific types of files -includedir ?= $(prefix)/include -oldincludedir ?= /usr/include -docdir ?= $(datarootdir)/doc/$(PACKAGE) -infodir ?= $(datarootdir)/info -htmldir ?= $(docdir) -dvidir ?= $(docdir) -pdfdir ?= $(docdir) -psdir ?= $(docdir) -libdir ?= $(exec_prefix)/lib -lispdir ?= $(datarootdir)/emacs/site-lisp -localedir ?= $(datarootdir)/locale -gnu.data_dirs += $(includedir) $(oldincludedir) $(docdir) $(infodir) $(htmldir) $(dvidir) $(pdfdir) $(psdir) $(libdir) $(lispdir) $(localedir) - -mandir ?= $(datarootdir)/man -man1dir ?= $(mandir)/man1 -man2dir ?= $(mandir)/man2 -man3dir ?= $(mandir)/man3 -man4dir ?= $(mandir)/man4 -man5dir ?= $(mandir)/man5 -man6dir ?= $(mandir)/man6 -man7dir ?= $(mandir)/man7 -man8dir ?= $(mandir)/man8 -gnu.data_dirs += $(mandir) $(man1dir) $(man2dir) $(man3dir) $(man4dir) $(man5dir) $(man6dir) $(man7dir) $(man8dir) - -manext ?= .1 -man1ext ?= .1 -man2ext ?= .2 -man3ext ?= .3 -man4ext ?= .4 -man5ext ?= .5 -man6ext ?= .6 -man7ext ?= .7 -man8ext ?= .8 - -# srcdir is handled for us by the core - -define _gnu.install_program -$$($1)/%: $$(outdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_PROGRAM) -$$($1)/%: $$(srcdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_PROGRAM) -endef -$(foreach d,$(gnu.program_dirs),$(eval $(call _gnu.install_program,$d))) - -define _gnu.install_data -$$($1)/%: $$(outdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_DATA) -$$($1)/%: $$(srcdir)/$$($1) - $$(NORMAL_INSTALL) - $$(INSTALL_DATA) -endef -$(foreach d,$(gnu.data_dirs),$(eval $(call _gnu.install_data,$d))) - -gnu.dirs += $(gnu.program_dirs) $(gnu.data_dirs) -$(gnu.dirs): - $(MKDIR_P) $@ - -# 7.2.6: Standard Targets for Users -# --------------------------------- - -gnu.info_docs ?= -std.sys_files += $(foreach f,$(gnu.info_docs), $(infodir)/$f.info ) - -#all: std -#install: std -$(outdir)/install-html: $(foreach f,$(gnu.info_docs), $(DESTDIR)$(htmldir)/$f.html ) -$(outdir)/install-dvi : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(dvidir)/$f.dvi ) -$(outdir)/install-pdf : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(pdfdir)/$f.pdf ) -$(outdir)/install-ps : $(foreach f,$(gnu.info_docs), $(DESTDIR)$(psdir)/$f.ps ) -#uninstall: std -$(outdir)/install-strip: install - $(STRIP $(filter $(bindir)/% $(sbindir)/% $(libexecdir)/%,$(std.sys_files/$(@D))) -#clean: std -#distclean: std -#mostlyclean: std -#maintainer-clean: std -TAGS: TODO -$(outdir)/info: $(addsuffix .info,$(gnu.info_docs)) -$(outdir)/dvi : $(addsuffix .dvi ,$(gnu.info_docs)) -$(outdir)/html: $(addsuffix .html,$(gnu.info_docs)) -$(outdir)/pdf : $(addsuffix .pdf ,$(gnu.info_docs)) -$(outdir)/ps : $(addsuffix .ps ,$(gnu.info_docs)) -#dist:dist -check: TODO -installcheck: TODO -#installdirs: std - -$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< -$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< -$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< -$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< -$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< - - - -#installdirs: std - -# 7.2.7: Standard Targets for Users -# --------------------------------- diff --git a/build-aux/Makefile.once.tail/11-gnu.mk b/build-aux/Makefile.once.tail/11-gnu.mk new file mode 100644 index 0000000..df5f192 --- /dev/null +++ b/build-aux/Makefile.once.tail/11-gnu.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.2 From e521304e16879d394a677232264f4d5c836c3cbb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 19:21:26 -0400 Subject: use :: on destructive targets to allow them to be extended --- build-aux/Makefile.each.tail/10-std.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index 8cebc7f..bff3b63 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -36,6 +36,6 @@ _std.mostlyclean/$(outdir) := $(filter-out $(_std.slow_files) $(_std.cfg_fi _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): +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: $(RM) -- $(sort $(_std.$(@F)/$(@D))) $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) -- cgit v1.2.2 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 (limited to 'build-aux') 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.2 From 303009fbfd0f491ad91e939dbb3a07849add2005 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 01:25:10 -0400 Subject: Make a separate 00-gnuconf --- build-aux/Makefile.each.tail/11-gnu.mk | 59 ------------ build-aux/Makefile.once.head/00-gnuconf.mk | 149 +++++++++++++++++++++++++++++ build-aux/Makefile.once.head/11-gnu.mk | 143 --------------------------- build-aux/Makefile.once.tail/11-gnu.mk | 17 ---- 4 files changed, 149 insertions(+), 219 deletions(-) delete mode 100644 build-aux/Makefile.each.tail/11-gnu.mk create mode 100644 build-aux/Makefile.once.head/00-gnuconf.mk delete mode 100644 build-aux/Makefile.once.head/11-gnu.mk delete mode 100644 build-aux/Makefile.once.tail/11-gnu.mk (limited to 'build-aux') 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.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/00-gnuconf.mk new file mode 100644 index 0000000..79ecc34 --- /dev/null +++ b/build-aux/Makefile.once.head/00-gnuconf.mk @@ -0,0 +1,149 @@ +# 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 ?= $(PACKAGE) +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 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.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) $@ -- cgit v1.2.2 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(-) (limited to 'build-aux') 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.2 From b910b85b2d7d732ccfeaf69ab7ec79140a4a7802 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 23:58:38 -0400 Subject: fix - Make at.relto public, as mod-dist needs it - Include the correct files in .head.mk - Sort the head includes forwards - Sort the tail includes backwards - Correctly prefix at.{sub,dep}dirs with $(outdir) - Undefine variables after they have been namespaced. - Don't try to access at.{sub,dep}dirs after they have been undefined --- build-aux/Makefile.head.mk | 12 ++++++++---- build-aux/Makefile.tail.mk | 16 ++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index c680f41..63a3462 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -25,23 +25,27 @@ endif _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.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 = $(foreach p,$1,$(call _at.relto,.,$p)) +at.path = $(call at.relto,.,$1) define at.nl endef +_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 -include $(topsrcdir)/common.once.head.mk +include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk)) endif # _at.NO_ONCE @@ -56,4 +60,4 @@ _at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/Mak $(foreach v,$(at.dirlocal),$(eval $v=)) -include $(topsrcdir)/common.each.head.mk +include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.head/*.mk)) diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index bb197dc..f7d42b9 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -15,10 +15,14 @@ # This bit gets evaluated for each Makefile processed -include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk) +include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -# Make the namespaced versions of all of the dirlocal variables -$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) = $($v))) +at.subdirs := $(addprefix $(outdir)/,$(at.subdirs)) +at.depdirs := $(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)) # Remember that this is a directory that we've visited _at.outdirs := $(_at.outdirs) $(outdir) @@ -27,11 +31,11 @@ _at.outdirs := $(_at.outdirs) $(outdir) # mark them phony .PHONY: $(addprefix $(outdir)/,$(at.phony)) # have them depend on subdirs -$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) +$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outdir))))) # Include Makefiles from other directories $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$(at.subdirs) $(at.depdirs))),\ + $(foreach makefile,$(call at.path,$(addsuffix /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 @@ -42,6 +46,6 @@ srcdir = /bogus $(foreach v,$(at.dirlocal),$(eval $v=)) -include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk) +include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk))) endif # _at.NO_ONCE -- cgit v1.2.2 From 395ed7ee8b871d7cd6c8e14a67a73ee03efa18f2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 23:58:57 -0400 Subject: the README is still outdated, but fix some paths in it --- build-aux/Makefile.README.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt index 935af5f..e06ba52 100644 --- a/build-aux/Makefile.README.txt +++ b/build-aux/Makefile.README.txt @@ -43,11 +43,11 @@ you were writing for plain GNU Make, with topoutdir ?= ... topsrcdir ?= ... - include $(topsrcdir)/automake.head.mk + include $(topsrcdir)/build-aux/Makefile.head.mk # your makefile - include $(topsrcdir)/automake.tail.mk + include $(topsrcdir)/build-aux/Makefile.tail.mk And in the top-level source directory, Write your own helper makefiles that get included: -- cgit v1.2.2 From 48731211106413607a067aa26f80d8b308e58eda Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:02:08 -0400 Subject: fix - 'fix' the values of the _files variables before adjusting them - in the clean variables, std.*_files are public - support suffixing std.clean_files with / to rm -r it. - using double-colon rules breaks automatic dependencies from core - subdirs belongs to core, not this module - sort the dependencies of 'installdirs', for brevity --- build-aux/Makefile.each.tail/10-std.mk | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index bff3b63..d32ec9b 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -15,7 +15,10 @@ # Add some more defaults to the *_files variables std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) -# Make each of the standard variables relative to the correct directory +# 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 := $(addprefix $(srcdir)/,$(std.src_files)) std.gen_files := $(addprefix $(srcdir)/,$(std.gen_files)) std.cfg_files := $(addprefix $(outdir)/,$(std.cfg_files)) @@ -23,19 +26,21 @@ std.out_files := $(addprefix $(outdir)/,$(std.out_files)) std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) std.clean_files := $(addprefix $(outdir)/,$(std.clean_files)) std.slow_files := $(addprefix $(outdir)/,$(std.slow_files)) -std.subdirs := $(addprefix $(outdir)/,$(std.subdirs)) # Creative targets -$(outdir)/build : $(std.out_files) -$(outdir)/install : $(std.sys_files) -$(outdir)/installdirs: $(dir $(std.sys_files)) +$(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):: - $(RM) -- $(sort $(_std.$(@F)/$(@D))) +_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) -- cgit v1.2.2 From db898def01041ab564c78331a31aea99165c8d36 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:03:19 -0400 Subject: fix: We must set std.clean_files before std reads it! --- build-aux/Makefile.each.head/00-dist.mk | 20 ++++++++++++++++++++ build-aux/Makefile.each.tail/00-dist.mk | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 build-aux/Makefile.each.head/00-dist.mk delete mode 100644 build-aux/Makefile.each.tail/00-dist.mk (limited to 'build-aux') diff --git a/build-aux/Makefile.each.head/00-dist.mk b/build-aux/Makefile.each.head/00-dist.mk new file mode 100644 index 0000000..a094305 --- /dev/null +++ b/build-aux/Makefile.each.head/00-dist.mk @@ -0,0 +1,20 @@ +# 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 . + +ifeq ($(outdir),$(topoutdir)) +std.clean_files += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /) +endif + +$(outdir)/dist: $(addprefix $(topoutdir)/$(dist.pkgname)-$(dist.version),$(dist.exts)) diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk deleted file mode 100644 index a094305..0000000 --- a/build-aux/Makefile.each.tail/00-dist.mk +++ /dev/null @@ -1,20 +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 . - -ifeq ($(outdir),$(topoutdir)) -std.clean_files += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /) -endif - -$(outdir)/dist: $(addprefix $(topoutdir)/$(dist.pkgname)-$(dist.version),$(dist.exts)) -- cgit v1.2.2 From ffc4e50464d3e73efb7ac29bc77cdba6ea33d3ea Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:13:11 -0400 Subject: fix: values no longer percolate up --- build-aux/Makefile.once.tail/00-dist.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index 3990f57..f4fce92 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): $(std.src_files/$(topoutdir)) $(std.gen_files/$(topoutdir)) +$(topoutdir)/$(dist.pkgname)-$(dist.version): $(foreach v,$(filter std.src_files/% std.gen_files/%,$(.VARIABLES)),$($v)) $(RM) -r $@ @PS4='' && set -x && \ $(MKDIR) $(@D)/tmp.$(@F).$$$$ && \ -- cgit v1.2.2 From 00eedbd6178cd92409be08d62b395f92680858ef Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:54:10 -0400 Subject: avoid prefixing things with ./ --- build-aux/Makefile.tail.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index f7d42b9..dfbad5a 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 := $(addprefix $(outdir)/,$(at.subdirs)) -at.depdirs := $(addprefix $(outdir)/,$(at.depdirs)) +at.subdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.subdirs))) +at.depdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.depdirs))) # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) -- cgit v1.2.2 From d331934d1fcdaea5474a1da3605907447f7ef6ee Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:54:43 -0400 Subject: Avoid prefixing things with ./ --- build-aux/Makefile.each.tail/10-std.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index d32ec9b..5150a71 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 := $(addprefix $(srcdir)/,$(std.src_files)) -std.gen_files := $(addprefix $(srcdir)/,$(std.gen_files)) -std.cfg_files := $(addprefix $(outdir)/,$(std.cfg_files)) -std.out_files := $(addprefix $(outdir)/,$(std.out_files)) -std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) -std.clean_files := $(addprefix $(outdir)/,$(std.clean_files)) -std.slow_files := $(addprefix $(outdir)/,$(std.slow_files)) +std.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))) # Creative targets $(outdir)/build : $(std.out_files) -- cgit v1.2.2 From 0d5b278b76a9ada9060dce10d5a86d6d460f7863 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 01:25:09 -0400 Subject: Drop the $$$$ suffix, and drop the magic needed to support it --- build-aux/Makefile.once.tail/00-dist.mk | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index f4fce92..b8b7733 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -16,11 +16,10 @@ _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 $@ - @PS4='' && set -x && \ - $(MKDIR) $(@D)/tmp.$(@F).$$$$ && \ - $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ - $(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) $(TAR) cf $@ -C $( Date: Fri, 17 Jun 2016 16:02:13 -0400 Subject: fixup --- build-aux/Makefile.each.tail/10-std.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index 5150a71..693f39d 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -12,6 +12,7 @@ # # 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) @@ -38,7 +39,13 @@ _std.mostlyclean/$(outdir) := $(filter-out $(std.slow_files) $(std.cfg_file _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 +$(addprefix $(outdir)/,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) +# separate uninstall to support GNU Coding Standards' NORMAL_UNINSTALL +$(addprefix $(outdir)/,uninstall): %: %-hook + $(NORMAL_UNINSTALL) $(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) -- cgit v1.2.2 From 8b45c2af3c6f9654d133bfbb62969367a65d38ad Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 17 Jun 2016 16:02:51 -0400 Subject: fixup --- build-aux/Makefile.once.head/00-gnuconf.mk | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'build-aux') diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/00-gnuconf.mk index 79ecc34..83cb110 100644 --- a/build-aux/Makefile.once.head/00-gnuconf.mk +++ b/build-aux/Makefile.once.head/00-gnuconf.mk @@ -16,7 +16,7 @@ # This file is based on §7.2 "Makefile Conventions" of the release of # the GNU Coding Standards dated April 13, 2016. -gnuconf.pkgname ?= $(PACKAGE) +gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) ifeq ($(gnuconf.pkgname),) $(error gnuconf.pkgname must be set) endif @@ -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.2