From 37ef1295bf8885876df8de989569a2233f97583f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 4 Mar 2016 13:20:55 -0500 Subject: Have the caller be responsible for setting topoutdir --- automake.head.mk | 11 ++++------- automake.txt | 40 +++++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/automake.head.mk b/automake.head.mk index c79da83..37d3b07 100644 --- a/automake.head.mk +++ b/automake.head.mk @@ -30,13 +30,10 @@ am_path = $(foreach p,$1,$(call _am_relto,$p)) all: build .PHONY: all -## Set topoutdir, outdir, and srcdir (assumes that topsrcdir is -## already set, and that $(topoutdir)/config.mk has been included) -ifeq ($(topoutdir),) -topoutdir := $(call _am_path,$(dir $(lastword $(filter %/config.mk config.mk,$(MAKEFILE_LIST))))) -endif - outdir := $(call _am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) - srcdir := $(call _am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir))) +## 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) diff --git a/automake.txt b/automake.txt index c9834d3..935af5f 100644 --- a/automake.txt +++ b/automake.txt @@ -41,25 +41,14 @@ 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 - # adjust the number of `../` segments as appropriate - include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk + topoutdir ?= ... + topsrcdir ?= ... include $(topsrcdir)/automake.head.mk # your makefile include $(topsrcdir)/automake.tail.mk -And in the top-level output directory, you write a `config.mk` with: - - ifeq ($(topsrcdir),) - # have your ./configure script adjust topsrcdir if doing an - # out-of-tree build - topsrcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) - - # your configuration - - endif - 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 @@ -145,10 +134,27 @@ between directories: Tips, notes ----------- -If you have a `./configure` script, don't have it modify the -`Makefile`s; have everything you need modified be in -`$(topoutdir)/config.mk` and have it generate that; then have it copy -(or (sym?)link?) every `$(srcdir)/Makefile` into `$(outdir)/Makefile`. +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 -- cgit v1.2.3 From 7da2f4c04a4ef39d1eee541b71cbc4f9c10dfa3b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 27 May 2016 19:10:45 -0400 Subject: fix mistake in am_path --- automake.head.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automake.head.mk b/automake.head.mk index 37d3b07..431f14d 100644 --- a/automake.head.mk +++ b/automake.head.mk @@ -24,7 +24,7 @@ _am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(absp # Note that _am_is_subdir says that a directory is a subdirectory of # itself. _am_path = $(call _am_relto,.,$1) -am_path = $(foreach p,$1,$(call _am_relto,$p)) +am_path = $(foreach p,$1,$(call _am_relto,.,$p)) ## Declare the default target all: build -- cgit v1.2.3 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 --- automake.head.mk | 56 --------------- automake.tail.mk | 139 ----------------------------------- automake.txt | 164 ------------------------------------------ build-aux/Makefile.README.txt | 164 ++++++++++++++++++++++++++++++++++++++++++ build-aux/Makefile.head.mk | 49 +++++++++++++ build-aux/Makefile.tail.mk | 52 ++++++++++++++ 6 files changed, 265 insertions(+), 359 deletions(-) delete mode 100644 automake.head.mk delete mode 100644 automake.tail.mk delete mode 100644 automake.txt create mode 100644 build-aux/Makefile.README.txt create mode 100644 build-aux/Makefile.head.mk create mode 100644 build-aux/Makefile.tail.mk diff --git a/automake.head.mk b/automake.head.mk deleted file mode 100644 index 431f14d..0000000 --- a/automake.head.mk +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -_am = am_ - -_am_noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) -# These are all $(call _am_func,parent,child) -#_am_relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -_am_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_am_relto_helper = $(if $(call _am_is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _am_relto_helper,$(patsubst %/,%,$(dir $1)),$2))) -_am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(abspath $1)),$(call _am_noslash,$(abspath $2)))) -# Note that _am_is_subdir says that a directory is a subdirectory of -# itself. -_am_path = $(call _am_relto,.,$1) -am_path = $(foreach p,$1,$(call _am_relto,.,$p)) - -## Declare the default target -all: build -.PHONY: all - -## Set outdir and srcdir (assumes that topoutdir and topsrcdir are -## already set) -outdir := $(call _am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) -srcdir := $(call _am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir))) - -_am_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile) - -## Empty variables for use by each Makefile -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = - -$(_am)clean_files = -$(_am)slow_files = - -ifeq ($(_am_NO_ONCE),) -include $(topsrcdir)/common.once.head.mk -endif -include $(topsrcdir)/common.each.head.mk diff --git a/automake.tail.mk b/automake.tail.mk deleted file mode 100644 index a24820b..0000000 --- a/automake.tail.mk +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -include $(topsrcdir)/common.each.tail.mk - - -# Aggregate variables - -# Add some more defaults to the *_files variables -$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) - -# Now namespace the *_files variables -define _am_save_variables -_am_src_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)src_files)) -_am_gen_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)gen_files)) -_am_cfg_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)cfg_files)) -_am_out_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)out_files)) -_am_sys_files/$(outdir) = $(addprefix $(DESTDIR),$($(_am)sys_files)) -_am_clean_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)clean_files)) -_am_slow_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)slow_files)) -_am_subdirs/$(outdir) = $($(_am)subdirs) -endef -$(eval $(_am_save_variables)) - -# And add them to the $(parent)_*_files variables (if applicable) -define _am_add_subdir -_am_src_files/%(outdir) += $(_am_src_files/%(subdir)) -_am_gen_files/%(outdir) += $(_am_gen_files/%(subdir)) -_am_cfg_files/%(outdir) += $(_am_cfg_files/%(subdir)) -_am_out_files/%(outdir) += $(_am_out_files/%(subdir)) -_am_sys_files/%(outdir) += $(_am_sys_files/%(subdir)) -_am_clean_files/%(outdir) += $(_am_clean_files/%(subdir)) -_am_slow_files/%(outdir) += $(_am_slow_files/%(subdir)) -endef -$(foreach subdir,$(call _am_path,$(addprefix $(outdir)/,$($(_am)subdirs))),$(eval $(subst %(outdir),$(outdir),$(subst %(subdir),$(subdir),$(value _am_add_subdir))))) - -_am_outdirs := $(_am_outdirs) $(outdir) - - -# Do some per-directory magic - -_am_phony = build install uninstall mostlyclean clean distclean maintainer-clean check - -.PHONY: $(addprefix $(outdir)/,$(_am_phony)) - -$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: - $(RM) -- $(sort $(_am_$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) - -# 'build' and 'install' must be defined later, because the -# am_*_files/* variables might not be complete yet. - - -# Include Makefiles from other directories - -define _am_nl - - -endef - -$(foreach _am_NO_ONCE,y,\ - $(foreach makefile,$(foreach dir,$($(_am)subdirs) $($(_am)depdirs),$(call _am_path,$(outdir)/$(dir)/Makefile)),\ - $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) - - -# This only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_am_NO_ONCE),) -# Empty directory-level variables -outdir = /bogus -srcdir = /bogus - -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = -$(_am)clean_files = -$(_am)slow_files = - -_am_clean_files/$(topoutdir) += $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(addprefix $(topoutdir)/,mostlyclean clean distclean maintainer-clean) :: - $(RM) -r -- $(topoutdir)/$(PACKAGE)-$(VERSION) - -define _am_directory_rules -# Constructive phony targets -$(outdir)/build : $(_am_out_files/%(outdir)) -$(outdir)/install: $(_am_sys_files/%(outdir)) -# Destructive phony targets -_am_uninstall/%(outdir) = $(_am_sys_files/%(outdir)) -_am_mostlyclean/%(outdir) = $(filter-out $(_am_slow_files/%(outdir)) $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_clean/%(outdir) = $(filter-out $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_distclean/%(outdir) = $(filter-out $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_maintainer-clean/%(outdir) = $(filter-out $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -endef -$(foreach outdir,$(_am_outdirs),$(eval $(subst %(outdir),$(outdir),$(value _am_directory_rules)))) - -# Add the `dist` target -.PHONY: dist -dist: $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION) - $(TAR) czf $@ -C $(. + +# 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.3 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 --- automake.head.mk | 56 ----------- automake.tail.mk | 139 ---------------------------- automake.txt | 164 --------------------------------- 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 ++++ 6 files changed, 89 insertions(+), 359 deletions(-) delete mode 100644 automake.head.mk delete mode 100644 automake.tail.mk delete mode 100644 automake.txt create mode 100644 build-aux/Makefile.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 diff --git a/automake.head.mk b/automake.head.mk deleted file mode 100644 index 431f14d..0000000 --- a/automake.head.mk +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -_am = am_ - -_am_noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) -# These are all $(call _am_func,parent,child) -#_am_relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -_am_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_am_relto_helper = $(if $(call _am_is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _am_relto_helper,$(patsubst %/,%,$(dir $1)),$2))) -_am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(abspath $1)),$(call _am_noslash,$(abspath $2)))) -# Note that _am_is_subdir says that a directory is a subdirectory of -# itself. -_am_path = $(call _am_relto,.,$1) -am_path = $(foreach p,$1,$(call _am_relto,.,$p)) - -## Declare the default target -all: build -.PHONY: all - -## Set outdir and srcdir (assumes that topoutdir and topsrcdir are -## already set) -outdir := $(call _am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) -srcdir := $(call _am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir))) - -_am_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile) - -## Empty variables for use by each Makefile -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = - -$(_am)clean_files = -$(_am)slow_files = - -ifeq ($(_am_NO_ONCE),) -include $(topsrcdir)/common.once.head.mk -endif -include $(topsrcdir)/common.each.head.mk diff --git a/automake.tail.mk b/automake.tail.mk deleted file mode 100644 index a24820b..0000000 --- a/automake.tail.mk +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -include $(topsrcdir)/common.each.tail.mk - - -# Aggregate variables - -# Add some more defaults to the *_files variables -$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) - -# Now namespace the *_files variables -define _am_save_variables -_am_src_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)src_files)) -_am_gen_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)gen_files)) -_am_cfg_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)cfg_files)) -_am_out_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)out_files)) -_am_sys_files/$(outdir) = $(addprefix $(DESTDIR),$($(_am)sys_files)) -_am_clean_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)clean_files)) -_am_slow_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)slow_files)) -_am_subdirs/$(outdir) = $($(_am)subdirs) -endef -$(eval $(_am_save_variables)) - -# And add them to the $(parent)_*_files variables (if applicable) -define _am_add_subdir -_am_src_files/%(outdir) += $(_am_src_files/%(subdir)) -_am_gen_files/%(outdir) += $(_am_gen_files/%(subdir)) -_am_cfg_files/%(outdir) += $(_am_cfg_files/%(subdir)) -_am_out_files/%(outdir) += $(_am_out_files/%(subdir)) -_am_sys_files/%(outdir) += $(_am_sys_files/%(subdir)) -_am_clean_files/%(outdir) += $(_am_clean_files/%(subdir)) -_am_slow_files/%(outdir) += $(_am_slow_files/%(subdir)) -endef -$(foreach subdir,$(call _am_path,$(addprefix $(outdir)/,$($(_am)subdirs))),$(eval $(subst %(outdir),$(outdir),$(subst %(subdir),$(subdir),$(value _am_add_subdir))))) - -_am_outdirs := $(_am_outdirs) $(outdir) - - -# Do some per-directory magic - -_am_phony = build install uninstall mostlyclean clean distclean maintainer-clean check - -.PHONY: $(addprefix $(outdir)/,$(_am_phony)) - -$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: - $(RM) -- $(sort $(_am_$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) - -# 'build' and 'install' must be defined later, because the -# am_*_files/* variables might not be complete yet. - - -# Include Makefiles from other directories - -define _am_nl - - -endef - -$(foreach _am_NO_ONCE,y,\ - $(foreach makefile,$(foreach dir,$($(_am)subdirs) $($(_am)depdirs),$(call _am_path,$(outdir)/$(dir)/Makefile)),\ - $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) - - -# This only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_am_NO_ONCE),) -# Empty directory-level variables -outdir = /bogus -srcdir = /bogus - -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = -$(_am)clean_files = -$(_am)slow_files = - -_am_clean_files/$(topoutdir) += $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(addprefix $(topoutdir)/,mostlyclean clean distclean maintainer-clean) :: - $(RM) -r -- $(topoutdir)/$(PACKAGE)-$(VERSION) - -define _am_directory_rules -# Constructive phony targets -$(outdir)/build : $(_am_out_files/%(outdir)) -$(outdir)/install: $(_am_sys_files/%(outdir)) -# Destructive phony targets -_am_uninstall/%(outdir) = $(_am_sys_files/%(outdir)) -_am_mostlyclean/%(outdir) = $(filter-out $(_am_slow_files/%(outdir)) $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_clean/%(outdir) = $(filter-out $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_distclean/%(outdir) = $(filter-out $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_maintainer-clean/%(outdir) = $(filter-out $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -endef -$(foreach outdir,$(_am_outdirs),$(eval $(subst %(outdir),$(outdir),$(value _am_directory_rules)))) - -# Add the `dist` target -.PHONY: dist -dist: $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION) - $(TAR) czf $@ -C $(. + +# 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.3 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 --- automake.head.mk | 56 ----------- automake.tail.mk | 139 --------------------------- automake.txt | 164 -------------------------------- 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 ++++++++ 6 files changed, 74 insertions(+), 359 deletions(-) delete mode 100644 automake.head.mk delete mode 100644 automake.tail.mk delete mode 100644 automake.txt create mode 100644 build-aux/Makefile.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 diff --git a/automake.head.mk b/automake.head.mk deleted file mode 100644 index 431f14d..0000000 --- a/automake.head.mk +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -_am = am_ - -_am_noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) -# These are all $(call _am_func,parent,child) -#_am_relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -_am_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_am_relto_helper = $(if $(call _am_is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _am_relto_helper,$(patsubst %/,%,$(dir $1)),$2))) -_am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(abspath $1)),$(call _am_noslash,$(abspath $2)))) -# Note that _am_is_subdir says that a directory is a subdirectory of -# itself. -_am_path = $(call _am_relto,.,$1) -am_path = $(foreach p,$1,$(call _am_relto,.,$p)) - -## Declare the default target -all: build -.PHONY: all - -## Set outdir and srcdir (assumes that topoutdir and topsrcdir are -## already set) -outdir := $(call _am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) -srcdir := $(call _am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir))) - -_am_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile) - -## Empty variables for use by each Makefile -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = - -$(_am)clean_files = -$(_am)slow_files = - -ifeq ($(_am_NO_ONCE),) -include $(topsrcdir)/common.once.head.mk -endif -include $(topsrcdir)/common.each.head.mk diff --git a/automake.tail.mk b/automake.tail.mk deleted file mode 100644 index a24820b..0000000 --- a/automake.tail.mk +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -include $(topsrcdir)/common.each.tail.mk - - -# Aggregate variables - -# Add some more defaults to the *_files variables -$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) - -# Now namespace the *_files variables -define _am_save_variables -_am_src_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)src_files)) -_am_gen_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)gen_files)) -_am_cfg_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)cfg_files)) -_am_out_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)out_files)) -_am_sys_files/$(outdir) = $(addprefix $(DESTDIR),$($(_am)sys_files)) -_am_clean_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)clean_files)) -_am_slow_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)slow_files)) -_am_subdirs/$(outdir) = $($(_am)subdirs) -endef -$(eval $(_am_save_variables)) - -# And add them to the $(parent)_*_files variables (if applicable) -define _am_add_subdir -_am_src_files/%(outdir) += $(_am_src_files/%(subdir)) -_am_gen_files/%(outdir) += $(_am_gen_files/%(subdir)) -_am_cfg_files/%(outdir) += $(_am_cfg_files/%(subdir)) -_am_out_files/%(outdir) += $(_am_out_files/%(subdir)) -_am_sys_files/%(outdir) += $(_am_sys_files/%(subdir)) -_am_clean_files/%(outdir) += $(_am_clean_files/%(subdir)) -_am_slow_files/%(outdir) += $(_am_slow_files/%(subdir)) -endef -$(foreach subdir,$(call _am_path,$(addprefix $(outdir)/,$($(_am)subdirs))),$(eval $(subst %(outdir),$(outdir),$(subst %(subdir),$(subdir),$(value _am_add_subdir))))) - -_am_outdirs := $(_am_outdirs) $(outdir) - - -# Do some per-directory magic - -_am_phony = build install uninstall mostlyclean clean distclean maintainer-clean check - -.PHONY: $(addprefix $(outdir)/,$(_am_phony)) - -$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: - $(RM) -- $(sort $(_am_$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) - -# 'build' and 'install' must be defined later, because the -# am_*_files/* variables might not be complete yet. - - -# Include Makefiles from other directories - -define _am_nl - - -endef - -$(foreach _am_NO_ONCE,y,\ - $(foreach makefile,$(foreach dir,$($(_am)subdirs) $($(_am)depdirs),$(call _am_path,$(outdir)/$(dir)/Makefile)),\ - $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) - - -# This only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_am_NO_ONCE),) -# Empty directory-level variables -outdir = /bogus -srcdir = /bogus - -$(_am)subdirs = -$(_am)depdirs = - -$(_am)src_files = -$(_am)gen_files = -$(_am)cfg_files = -$(_am)out_files = -$(_am)sys_files = -$(_am)clean_files = -$(_am)slow_files = - -_am_clean_files/$(topoutdir) += $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(addprefix $(topoutdir)/,mostlyclean clean distclean maintainer-clean) :: - $(RM) -r -- $(topoutdir)/$(PACKAGE)-$(VERSION) - -define _am_directory_rules -# Constructive phony targets -$(outdir)/build : $(_am_out_files/%(outdir)) -$(outdir)/install: $(_am_sys_files/%(outdir)) -# Destructive phony targets -_am_uninstall/%(outdir) = $(_am_sys_files/%(outdir)) -_am_mostlyclean/%(outdir) = $(filter-out $(_am_slow_files/%(outdir)) $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_clean/%(outdir) = $(filter-out $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_distclean/%(outdir) = $(filter-out $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -_am_maintainer-clean/%(outdir) = $(filter-out $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir))) -endef -$(foreach outdir,$(_am_outdirs),$(eval $(subst %(outdir),$(outdir),$(value _am_directory_rules)))) - -# Add the `dist` target -.PHONY: dist -dist: $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz -$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION) - $(TAR) czf $@ -C $(. + +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(-) 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.3 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(-) 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.3 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(-) 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.3 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 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.3 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 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.3 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(-) 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.3 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(-) 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.3 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(-) 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.3 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(-) 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.3 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(+) 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.3 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(-) 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.3 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(-) 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.3 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(-) 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.3 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(-) 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.3 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 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.3 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(-) 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.3 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(-) 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.3 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(-) 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.3 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(-) 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 $(