From 610d801297fe7e46c319e6da4e6571aaded630dd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 17 Aug 2016 01:33:02 -0400 Subject: more --- build-aux/Makefile.once.head/00-quote.mk | 23 +++++++++++++++++++++++ build-aux/Makefile.once.head/10-lt.mk | 19 ++++++++++++------- build-aux/Makefile.once.head/30-am.mk | 26 ++++++++++++++------------ build-aux/Makefile.once.head/zz-mod.mk | 8 +------- 4 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 build-aux/Makefile.once.head/00-quote.mk (limited to 'build-aux/Makefile.once.head') diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk new file mode 100644 index 0000000000..23be6140d6 --- /dev/null +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -0,0 +1,23 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +mod.quote.description = Macros to quote tricky strings + +quote.pattern = $(subst %,\%,$(subst \,\\,$1)) +quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_mod.tmp))) + +# I put this as the last line in the file because it confuses Emacs syntax +# highlighting and makes the remainder of the file difficult to edit. +quote.shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk index b014a0f2a4..3c6bea4222 100644 --- a/build-aux/Makefile.once.head/10-lt.mk +++ b/build-aux/Makefile.once.head/10-lt.mk @@ -1,12 +1,17 @@ mod.lt.description = (systemd) Easy handling of libtool dependencies -mod.lt.deps += files +mod.lt.deps += files quote -_lt.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l))) _lt.patsubst-all = $(if $1,$(call _lt.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3) _lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(notdir $(_lt.tmp))),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(notdir $(_lt.tmp))),$(_lt.tmp))) +_lt.rest = $(wordlist 2,$(words $1),$1) +_lt.dedup = $(if $1,$(if $(filter $(firstword $1),$(call _lt.rest,$1)),,$(firstword $1) )$(call _lt.dedup,$(call _lt.rest,$1))) +_lt.static_dependency_libs = $(foreach _lt.tmp,$1,$(_lt.tmp)$(if $(filter %.la,$(_lt.tmp)), $(shell . $(_lt.tmp); echo $$static_dependency_libs))) -# The semantics for the de-dup bit are a bit weird. My head hurts thinking -# about them. TODO: clarify/simplify/something -lt.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys)))) -_lt.link_files = $(filter %.o %.lo %.la -l%,$(call _lt.unLIBPATTERNS,$^)) -lt.link_files = $(filter-out $(call _lt.dups,$(_lt.link_files)),$(_lt.link_files)) +lt.lib.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys)))) +lt.lib.files.all = $(call _lt.dedup,$(filter %.lo %.la -l%,$(call _lt.static_dependency_libs,$(call _lt.unLIBPATTERNS,$^)))) +lt.lib.files.ld = $(filter %.lo -l% $(if $(lt.lib.rpath),%.la),$(lt.lib.files.all)) +lt.lib.files.la = $(filter %.la,$(lt.lib.files.all)) +lt.lib.post = $(if $(lt.lib.files.la),printf '\nstatic_dependency_libs="$(lt.lib.files.la)"\ndependency_libs="$$dependency_libs $$static_dependency_libs"\n' >> $@) + +lt.exe.files.all = $(call _lt.dedup,$(filter %.o %.la -l%,$(call _lt.static_dependency_libs,$(call _lt.unLIBPATTERNS,$^)))) +lt.exe.files.ld = $(lt.exe.files.all) diff --git a/build-aux/Makefile.once.head/30-am.mk b/build-aux/Makefile.once.head/30-am.mk index 37f16f8652..dcccca6da4 100644 --- a/build-aux/Makefile.once.head/30-am.mk +++ b/build-aux/Makefile.once.head/30-am.mk @@ -1,16 +1,16 @@ mod.am.description = (systemd) Automake-to-Autothing magic mod.am.depends += gnuconf -am.inst2noinst_DATA = \ - $(patsubst %.completion.bash,$(abspath $(srcdir))/%.completion.bash,\ - $(patsubst %.completion.zsh,$(abspath $(srcdir))/%.completion.zsh,\ +am.sys2out_DATA = \ $(notdir \ + $(patsubst $(pamconfdir)/%,%.pam,\ + $(patsubst $(tmpfilesdir)/%.conf,%.tmpfiles,\ $(patsubst $(sysusersdir)/%.conf,%.sysusers,\ $(patsubst $(sysctldir)/%.conf,%.sysctl,\ $(patsubst $(bashcompletiondir)/%,%.completion.bash,\ $(patsubst $(zshcompletiondir)/_%,%.completion.zsh,\ $1))))))) -am.inst2noinst_HEADERS = $(abspath $(addprefix $(srcdir)/include/,$(notdir $1))) +am.sys2out_HEADERS = $(abspath $(addprefix $(srcdir)/include/,$(notdir $1))) am.var_PROGRAMS = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LDADD am.var_LTLIBRARIES = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LIBADD @@ -26,11 +26,11 @@ am.LDFLAGS = # this list of primaries is based on the Automake 1.15 manual am.primaries ?= PROGRAMS LIBRARIES LTLIBRARIES LISP PYTHON JAVA SCRIPTS DATA HEADERS MANS TEXINFOS -$(eval $(foreach p,$(am.primaries),am.inst2noinst_$p ?= $$(notdir $$1)$(at.nl))) +$(eval $(foreach p,$(am.primaries),am.sys2out_$p ?= $$(notdir $$1)$(at.nl))) am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\ - $(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES)))) -am.inst2dirs = $(sort $(patsubst %/,%,$(dir $(foreach p,$(am.primaries),$(am.inst_$p))))) + $(patsubst nodist_%,%,$(patsubst dist_%,%,$(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES)))))) +am.sys2dirs = $(sort $(patsubst %/,%,$(dir $(foreach p,$(am.primaries),$(am.sys_$p))))) am.file2var = $(subst -,_,$(subst .,_,$1)) am.file2sources = $(addprefix $(srcdir)/,$(notdir $($(am.file2var)_SOURCES))) @@ -41,15 +41,17 @@ am.file2lib = $(foreach l, $($(am.file2var)_$2),$(if $(filter lib%.la,$l), $($ am.file2cpp = $(foreach l,$1 $($(am.file2var)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).CPPFLAGS) , )) define _am.per_primary +$(foreach d,$(call am.primary2dirs,$1),$d_$1 ?=$(at.nl)dist_$d_$1 ?=$(at.nl)nodist_$d_$1 ?=$(at.nl)) noinst_$1 ?= check_$1 ?= -am.inst_$1 := $$(foreach d,$$(call am.primary2dirs,$1),$$(addprefix $$($$ddir)/,$$(notdir $$($$d_$1)))) -am.noinst_$1 := $$(noinst_$1) +am.sys_$1 := $(foreach d,$(call am.primary2dirs,$1),$$(addprefix $$($ddir)/,$$(notdir $$($d_$1) $$(dist_$d_$1) $$(nodist_$d_$1)))) +am.out_$1 := $$(call am.sys2out_$1,$(foreach d,$(call am.primary2dirs,$1),$$(addprefix $$($ddir)/,$$(notdir $$($d_$1) $$(nodist_$d_$1) ))) $$(noinst_$1)) am.check_$1 := $$(check_$1) -$(foreach d,$(call am.primary2dirs,$1) noinst check,undefine $d_$1$(at.nl)) -$$(addprefix $$(DESTDIR),$$(am.inst_$1)): private am.INSTALL = $$(am.INSTALL_$1) -am.$1 = $$(am.check_$1) $$(am.noinst_$1) $$(call am.inst2noinst_$1,$$(am.inst_$1)) +$(foreach d,$(call am.primary2dirs,$1),undefine $d_$1$(at.nl)undefine dist_$d_$1$(at.nl)undefine nodist_$d_$1$(at.nl)) +undefine noinst_$1 +undefine check_$1 +$$(addprefix $$(DESTDIR),$$(am.sys_$1)): private am.INSTALL = $$(am.INSTALL_$1) endef ######################################################################## # TODO: I'm not in love with how _am.per_PROGRAM figures out am.subdirs diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk index 438f01e2ae..732f1e169d 100644 --- a/build-aux/Makefile.once.head/zz-mod.mk +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -14,6 +14,7 @@ # along with this program. If not, see . mod.mod.description = Display information about Autothing modules +mod.mod.depends += quote # The trickery that is _mod.empty/_mod.space is from ยง6.2 of the GNU Make # manual, "The Two Flavors of Variables". @@ -33,10 +34,3 @@ $(eval $(foreach _mod.tmp,$(_mod.modules),\ mod.$(_mod.tmp).description ?=$(at.nl)\ mod.$(_mod.tmp).depends ?=$(at.nl)\ mod.$(_mod.tmp).files ?=$(at.nl))) - -_mod.quote-pattern = $(subst %,\%,$(subst \,\\,$1)) -_mod.quote-shell-each = $(foreach _mod.tmp,$1,$(call _mod.quote-shell,$(_mod.tmp))) - -# I put this as the last line in the file because it confuses Emacs syntax -# highlighting and makes the remainder of the file difficult to edit. -_mod.quote-shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') -- cgit v1.2.3-54-g00ecf