diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-08-07 21:03:44 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-08-07 21:03:44 -0400 |
commit | 2abe0f2d527c7b3f6b97bd6519bf0e35a266ea68 (patch) | |
tree | 02eb54ce46d51f11defb2c6481cd23ee006d39c0 /build-aux | |
parent | 09010ac6999db43e39cde92200fc4a10858f5c51 (diff) |
stuff
Diffstat (limited to 'build-aux')
33 files changed, 784 insertions, 545 deletions
diff --git a/build-aux/Makefile.each.head/00-am.mk b/build-aux/Makefile.each.head/00-am.mk new file mode 100644 index 0000000000..f8c20b7706 --- /dev/null +++ b/build-aux/Makefile.each.head/00-am.mk @@ -0,0 +1,5 @@ +$(foreach v,$(foreach p,$(am.primaries),am.inst_$p am.noinst_$p am.check_$p),\ + $(eval $v ?=)) +am.CFLAGS ?= +am.CPPFLAGS ?= +am.subdirs ?= diff --git a/build-aux/Makefile.each.head/00-dist.mk b/build-aux/Makefile.each.head/00-dist.mk index a0943059ba..924d79aa7c 100644 --- a/build-aux/Makefile.each.head/00-dist.mk +++ b/build-aux/Makefile.each.head/00-dist.mk @@ -13,8 +13,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +mod.dist.depends += files + ifeq ($(outdir),$(topoutdir)) -std.clean_files += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /) +files.out.int += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /) .tmp.$(dist.pkgname)-*/ endif $(outdir)/dist: $(addprefix $(topoutdir)/$(dist.pkgname)-$(dist.version),$(dist.exts)) +.PHONY: $(outdir)/dist diff --git a/build-aux/Makefile.each.head/00-files.mk b/build-aux/Makefile.each.head/00-files.mk new file mode 100644 index 0000000000..7bf323e0c7 --- /dev/null +++ b/build-aux/Makefile.each.head/00-files.mk @@ -0,0 +1,29 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +files.src.src ?= +files.src.int ?= +files.src.cfg ?= +files.src.gen ?= +files.src = $(sort $(foreach _files.v,$(filter files.src.%,$(.VARIABLES)),$($(_files.v)))) + +files.out.slow ?= +files.out.int ?= +files.out.cfg ?= +$(foreach t,$(files.groups),$(eval files.out.$t ?=)) +files.out = $(sort $(foreach _files.v,$(filter files.out.%,$(.VARIABLES)),$($(_files.v)))) + +$(foreach t,$(files.groups),$(eval files.sys.$t ?=)) +files.sys = $(sort $(foreach _files.v,$(filter files.sys.%,$(.VARIABLES)),$($(_files.v)))) diff --git a/build-aux/Makefile.each.head/00-nested.mk b/build-aux/Makefile.each.head/00-nested.mk new file mode 100644 index 0000000000..4325825353 --- /dev/null +++ b/build-aux/Makefile.each.head/00-nested.mk @@ -0,0 +1,16 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +nested.subdirs ?= diff --git a/build-aux/Makefile.each.head/00-sd.mk b/build-aux/Makefile.each.head/00-sd.mk new file mode 100644 index 0000000000..0dccebc138 --- /dev/null +++ b/build-aux/Makefile.each.head/00-sd.mk @@ -0,0 +1 @@ +sd.sed_files ?= diff --git a/build-aux/Makefile.each.head/zz-mod.mk b/build-aux/Makefile.each.head/zz-mod.mk new file mode 100644 index 0000000000..b83c2235a2 --- /dev/null +++ b/build-aux/Makefile.each.head/zz-mod.mk @@ -0,0 +1 @@ +_mod.each := $(sort $(_mod.each) $(filter-out $(_mod.once),$(_mod.vars))) diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk new file mode 100644 index 0000000000..4607c433d0 --- /dev/null +++ b/build-aux/Makefile.each.tail/10-files.mk @@ -0,0 +1,55 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# Add some more defaults to the *_files variables + +$(foreach _files.var,$(patsubst files.%,%,files.src $(filter files.src.%,$(.VARIABLES))),\ + $(eval _files.$(_files.var) = $$(call at.addprefix,$$(srcdir),$$(files.$(_files.var))))) +$(foreach _files.var,$(patsubst files.%,%,files.out $(filter files.out.%,$(.VARIABLES))),\ + $(eval _files.$(_files.var) = $$(call at.addprefix,$$(outdir),$$(files.$(_files.var))))) +$(foreach _files.var,$(patsubst files.%,%,files.sys $(filter files.sys.%,$(.VARIABLES))),\ + $(eval _files.$(_files.var) = $$(addprefix $$(DESTDIR),$$(files.$(_files.var))))) + +_files.all = $(_files.src) $(_files.out) $(_files.sys) + +at.targets += $(subst *,%,$(_files.all)) + +# Creative targets +$(outdir)/$(files.generate): $(_files.src.gen) $(_files.src.cfg) +$(outdir)/install: $(_files.sys.$(files.default)) +$(outdir)/installdirs: $(sort $(dir $(_files.sys))) +$(foreach _files.g,$(files.groups),\ + $(eval $$(outdir)/$(_files.g): $$(_files.out.$(_files.g)))) +$(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ + $(eval $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g)))) + +# Destructive targets +_files.uninstall = $(_files.sys) +_files.mostlyclean = $(filter-out $(_files.out.slow) $(_files.out.cfg),$(_files.out)) +_files.clean = $(filter-out $(_files.out.cfg),$(_files.out)) +_files.distclean = $(_files.out) +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean): %: %-hook + $(RM) -- $(sort $(filter-out %/,$(_files.$(@F)))) + $(RM) -r -- $(sort $(filter %/,$(_files.$(@F)))) + $(RMDIR_P) -- $(sort $(dir $(_files.$(@F)))) +_files.maintainer-clean = $(filter-out $(_files.src.cfg) $(_files.src.src),$(_files.src)) +_files.$(files.vcsclean) = $(filter-out $(_files.src.src),$(_files.src)) +$(addprefix $(outdir)/,maintainer-clean $(files.vcsclean)): $(outdir)/%: $(outdir)/distclean $(outdir)/%-hook + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + $(RM) -- $(sort $(filter-out %/,$(_files.$(@F)))) + $(RM) -r -- $(sort $(filter %/,$(_files.$(@F)))) + $(RMDIR_P) -- $(sort $(dir $(_files.$(@F)))) +$(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook):: +.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook) diff --git a/build-aux/Makefile.each.tail/10-nested.mk b/build-aux/Makefile.each.tail/10-nested.mk new file mode 100644 index 0000000000..e9d02ca5b0 --- /dev/null +++ b/build-aux/Makefile.each.tail/10-nested.mk @@ -0,0 +1,19 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +$(addprefix $(outdir)/,$(nested.targets)): $(outdir)/%: $(addsuffix /%,$(call at.addprefix,$(outdir),$(nested.subdirs))) +.PHONY: $(addprefix $(outdir)/,$(nested.targets)) + +at.subdirs += $(nested.subdirs) diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk deleted file mode 100644 index ca78f3cf8c..0000000000 --- a/build-aux/Makefile.each.tail/10-std.mk +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# Add some more defaults to the *_files variables -std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) - -# Fix each variable at its current value to avoid any weirdness -$(foreach c,src gen cfg out sys clean slow,$(eval std.$c_files := $$(std.$c_files))) - -# Make each of the standard variables relative to the correct directory -std.src_files := $(call at.addprefix,$(srcdir)/,$(std.src_files)) -std.gen_files := $(call at.addprefix,$(srcdir)/,$(std.gen_files)) -std.cfg_files := $(call at.addprefix,$(outdir)/,$(std.cfg_files)) -std.out_files := $(call at.addprefix,$(outdir)/,$(std.out_files)) -std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) -std.clean_files := $(call at.addprefix,$(outdir)/,$(std.clean_files)) -std.slow_files := $(call at.addprefix,$(outdir)/,$(std.slow_files)) - -# Creative targets -$(outdir)/build : $(std.out_files) -$(outdir)/install : $(std.sys_files) -$(outdir)/installdirs: $(sort $(dir $(std.sys_files))) - -# Destructive targets -_std.uninstall/$(outdir) := $(std.sys_files) -_std.mostlyclean/$(outdir) := $(filter-out $(std.slow_files) $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files)) -_std.clean/$(outdir) := $(filter-out $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files)) -_std.distclean/$(outdir) := $(filter-out $(std.gen_files) $(std.src_files),$(std.clean_files)) -_std.maintainer-clean/$(outdir) := $(filter-out $(std.src_files),$(std.clean_files)) -$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): %: %-hook - $(RM) -- $(sort $(filter-out %/,$(_std.$(@F)/$(@D)))) - $(RM) -r -- $(sort $(filter %/,$(_std.$(@F)/$(@D)))) - $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) -$(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook):: -.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook) diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk deleted file mode 100644 index 1a65c000e2..0000000000 --- a/build-aux/Makefile.each.tail/20-systemd.mk +++ /dev/null @@ -1,99 +0,0 @@ -# -*- Mode: makefile; indent-tabs-mode: t -*- -# -# This file is part of systemd. -# -# Copyright 2010-2012 Lennart Poettering -# Copyright 2010-2012 Kay Sievers -# Copyright 2013 Zbigniew Jędrzejewski-Szmek -# Copyright 2013 David Strauss -# Copyright 2016 Luke Shumaker -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. -# -# systemd 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with systemd; If not, see <http://www.gnu.org/licenses/>. - --include $(wildcard $(outdir)/$(DEPDIR)/*.P*) - -std.clean_files += *.o *.lo *.so .deps/ .libs/ -std.clean_files += *-list.txt -std.clean_files += *-from-name.gperf -std.clean_files += *-from-name.h -std.clean_files += *-to-name.h -std.clean_files += *-gperf.c - -$(outdir)/%.o : $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(COMPILE) -c -o $@ $< -$(outdir)/%.o : $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(COMPILE) -c -o $@ $< -$(outdir)/%.lo: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< -$(outdir)/%.lo: $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< - -$(outdir)/.deps: - $(AM_V_at)$(MKDIR_P) $@ - -_systemd.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l))) -_systemd.patsubst-all = $(if $1,$(call _systemd.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3) -_systemd.lt_libs = $(foreach l,$(filter %.la,$1), $l $(call _systemd.lt_libs,$($(notdir $l).DEPENDS))) -_systemd.lt_filter = $(filter-out $(call _systemd.dups,$(call _systemd.lt_libs,$1)),$1) - -_systemd.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(std.sys_files/$(@D))))) -_systemd.link_files = $(call _systemd.lt_filter,$(filter %.o %.lo %.la,$^)) $(call _systemd.patsubst-all,$(.LIBPATTERNS),-l%,$(filter $(.LIBPATTERNS),$(notdir $^))) -$(outdir)/%.la: - @if test $(words $^) = 0; then echo 'Cannot link library with no dependencies: $@' >&2; exit 1; fi - $(AM_V_CCLD)$(LINK) $(if $(_systemd.rpath),-rpath $(_systemd.rpath)) $(_systemd.link_files) -$(addprefix $(outdir)/,$(foreach d,$(am.bindirs),$($d_PROGRAMS))): $(outdir)/%: - @if test $(words $^) = 0; then echo 'Cannot link executable with no dependencies: $@' >&2; exit 1; fi - $(AM_V_CCLD)$(LINK) $(_systemd.link_files) - -_systemd.in_destdir = $(foreach f,$(std.sys_files),$(if $(filter $1,$(patsubst %/,%,$(dir $f))),$(DESTDIR)$f)) - -define install_bindir -$(call _systemd.in_destdir,$(bindir)): $(DESTDIR)$(bindir)/%: $(outdir)/% - @$(NORMAL_INSTALL) - $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(SYS_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@ -endef -$(foreach bindir,$(sort $(foreach d,$(am.bindirs),$($ddir))),$(eval $(value install_bindir))) - -define install_libdir -$(call _systemd.in_destdir,$(libdir)): $(DESTDIR)$(libdir)/%.la: $(outdir)/%.la - @$(NORMAL_INSTALL) - $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(SYS_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@ -endef -$(foreach libdir,$(sort $(foreach d,lib rootlib,$($ddir))),$(eval $(value install_libdir))) - -define install_datadir -$(call _systemd.in_destdir,$(datadir)): $(DESTDIR)$(datadir)/%: $(outdir)/% - @$(NORMAL_INSTALL) - $(AM_V_DATA)$(INSTALL_DATA) $< $@ -endef -$(foreach datadir,$(sort $(foreach d,pkgconfigdata pkgconfiglib bootlib,$($ddir))),$(eval $(value install_datadir))) - -$(outdir)/%-from-name.gperf: $(outdir)/%-list.txt - $(AM_V_at)$(MKDIR_P) $(dir $@) - $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@ - -$(outdir)/%-from-name.h: $(outdir)/%-from-name.gperf - $(AM_V_at)$(MKDIR_P) $(dir $@) - $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@ - -$(addprefix $(outdir)/,$(systemd.sed_files)): $(outdir)/%: $(srcdir)/%.in - $(SED_PROCESS) - -#$(outdir)/%.sh: $(srcdir)/%.sh.in -# $(SED_PROCESS) -# $(AM_V_GEN)chmod +x $@ - -$(outdir)/%.c: $(srcdir)/%.gperf - $(AM_V_GPERF)$(GPERF) < $< > $@ -$(outdir)/%.c: $(outdir)/%.gperf - $(AM_V_GPERF)$(GPERF) < $< > $@ - -$(outdir)/%: $(srcdir)/%.m4 $(top_builddir)/config.status - $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@ diff --git a/build-aux/Makefile.each.tail/30-automake2autothing.mk b/build-aux/Makefile.each.tail/30-automake2autothing.mk deleted file mode 100644 index cd5cc4300d..0000000000 --- a/build-aux/Makefile.each.tail/30-automake2autothing.mk +++ /dev/null @@ -1,36 +0,0 @@ -std.out_files += $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES) -std.sys_files += $(addprefix $(libdir)/,$(lib_LTLIBRARIES)) - -_programs = -$(foreach d,$(am.bindirs), \ - $(eval _programs += $($d_PROGRAMS) )\ - $(eval std.sys_files += $(addprefix $($(d)dir)/,$($d_PROGRAMS)) )) -_programs += $(noinst_PROGRAMS) -std.out_files += $(_programs) - -std.out_files += $(notdir $(pkgconfiglib_DATA)) -std.sys_files += $(addprefix $(pkgconfiglibdir)/,$(notdir $(pkgconfiglib_DATA))) - -$(foreach n,$(call automake_name,$(std.out_files)),\ - $(eval $n_SOURCES ?=)\ - $(eval nodist_$n_SOURCES ?=)\ - $(eval $n_CFLAGS ?=)\ - $(eval $n_CPPFLAGS ?=)\ - $(eval $n_LDFLAGS ?=)\ - $(eval $n_LIBADD ?=)\ - $(eval $n_LDADD ?=)) -$(foreach t,$(filter %.la,$(std.out_files)), \ - $(eval $t.DEPENDS += $(call at.path,$(call automake_lo,$t) $(call automake_lib,$t,LIBADD)) )\ - $(eval am.CPPFLAGS += $($(call automake_name,$t)_CPPFLAGS) $(call automake_cpp,$t,LIBADD) )\ - $(eval am.CFLAGS += $($(call automake_name,$t)_CFLAGS) )\ - $(eval $t: private ALL_LDFLAGS += $($(call automake_name,$t)_LDFLAGS) )\ - $(eval $(outdir)/$t: $($t.DEPENDS) )\ - $(eval at.depdirs += $(abspath $(sort $(dir $(filter-out -l% /%,$($t.DEPENDS))))) )) -$(foreach t,$(_programs), \ - $(eval $t.DEPENDS += $(call at.path,$(call automake_o,$t) $(call automake_lib,$t,LDADD)) )\ - $(eval am.CPPFLAGS += $($(call automake_name,$t)_CPPFLAGS) $(call automake_cpp,$t,LDADD) )\ - $(eval am.CFLAGS += $($(call automake_name,$t)_CFLAGS) )\ - $(eval $t: private ALL_LDFLAGS += $($(call automake_name,$t)_LDFLAGS) )\ - $(eval $(outdir)/$t: $($t.DEPENDS) )\ - $(eval at.depdirs += $(sort $(filter-out $(abspath $(srcdir)), \ - $(abspath $(dir $(filter-out -l% /%,$($t.DEPENDS)))))) )) diff --git a/build-aux/Makefile.each.tail/30-directory-info.mk b/build-aux/Makefile.each.tail/30-directory-info.mk deleted file mode 100644 index 80f5e68c29..0000000000 --- a/build-aux/Makefile.each.tail/30-directory-info.mk +++ /dev/null @@ -1,4 +0,0 @@ -dir_variables = $(foreach v,$(filter-out _%,$(patsubst %/$(@D),%,$(filter %/$(@D),$(.VARIABLES)))),$(if $(findstring /,$v),, $v)) -$(outdir)/directory-info: - $(AM_V_at)printf '%s = «%s»\n' $(foreach v,$(dir_variables),$(if $($v/$(@D)),'$v' '$($v/$(@D))')) | sort | column -s= -o= -t -.PHONY: $(outdir)/module-info diff --git a/build-aux/Makefile.each.tail/50-sd.mk b/build-aux/Makefile.each.tail/50-sd.mk new file mode 100644 index 0000000000..832247ef72 --- /dev/null +++ b/build-aux/Makefile.each.tail/50-sd.mk @@ -0,0 +1,85 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. + +mod.sd.depends += files am lt + +-include $(wildcard $(outdir)/$(DEPDIR)/*.P*) + +files.out.int += *.o *.lo *.so .deps/ .libs/ +files.out.int += *-list.txt +files.out.int += *-from-name.gperf +files.out.int += *-from-name.h +files.out.int += *-to-name.h +files.out.int += *-gperf.c + +$(outdir)/%.o : $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.COMPILE) -c -o $@ $< +$(outdir)/%.o : $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.COMPILE) -c -o $@ $< +$(outdir)/%.lo: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.LTCOMPILE) -c -o $@ $< +$(outdir)/%.lo: $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.LTCOMPILE) -c -o $@ $< + +$(outdir)/$(DEPDIR): + $(AM_V_at)$(MKDIR_P) $@ + +$(outdir)/%.la: + @if test $(words $(lt.link_files)) = 0; then echo 'Cannot link library with no dependencies: $@' >&2; exit 1; fi + $(AM_V_CCLD)$(sd.LINK) $(if $(lt.rpath),-rpath $(lt.rpath)) $(lt.link_files) +$(addprefix $(outdir)/,$(am.PROGRAMS)): $(outdir)/%: + @if test $(words $(lt.link_files)) = 0; then echo 'Cannot link executable with no dependencies: $@' >&2; exit 1; fi + $(AM_V_CCLD)$(sd.LINK) $(lt.link_files) + +# Stupid test that everything purported to be exported really is +$(outdir)/test-lib%-sym.c: lib%.sym + $(AM_V_GEN){\ + printf '#include <stdio.h>\n' && \ + printf '#include "%s"\n' $(notdir $(filter %.h, $^)) && \ + printf 'void* functions[] = {\n' && \ + sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< && \ + printf '};\nint main(void) {\n' && \ + printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' && \ + printf 'return 0; }\n' && \ + :; } > $@ + +_sd.files_in = $(foreach f,$(files.sys),$(if $(filter $1,$(patsubst %/,%,$(dir $f))),$(DESTDIR)$f)) + +$(outdir)/%-from-name.gperf: $(outdir)/%-list.txt + $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@ + +$(outdir)/%-from-name.h: $(outdir)/%-from-name.gperf + $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@ + +ifneq ($(sd.sed_files),) +$(addprefix $(outdir)/,$(sd.sed_files)): $(outdir)/%: $(srcdir)/%.in + $(sd.SED_PROCESS) +endif + +#$(outdir)/%.sh: $(srcdir)/%.sh.in +# $(SED_PROCESS) +# $(AM_V_GEN)chmod +x $@ + +$(outdir)/%.c: $(srcdir)/%.gperf + $(AM_V_GPERF)$(GPERF) < $< > $@ +$(outdir)/%.c: $(outdir)/%.gperf + $(AM_V_GPERF)$(GPERF) < $< > $@ + +$(outdir)/%: $(srcdir)/%.m4 $(top_builddir)/config.status + $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@ diff --git a/build-aux/Makefile.each.tail/60-am.mk b/build-aux/Makefile.each.tail/60-am.mk new file mode 100644 index 0000000000..ac8785d6ee --- /dev/null +++ b/build-aux/Makefile.each.tail/60-am.mk @@ -0,0 +1,64 @@ +mod.am.depends += files + +######################################################################## +_am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\ + $(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES)))) +define _am.per_primary +noinst_$p ?= +check_$p ?= + +am.inst_$p := $$(foreach d,$$(call _am.primary2dirs,$p),$$($$d_$p)) +am.noinst_$p := $$(noinst_$p) +am.check_$p := $$(check_$p) +$(foreach d,$(call _am.primary2dirs,$p) nointt check,undefine $d_$p$(at.nl)) +ifneq ($$(am.inst_$p),) +$$(am.inst_$p): private am.INSTALL = $$(am.INSTALL_$p) +endif +am.$p = $$(am.check_$p) $$(am.noinst_$p) $$(call am.inst2noinst_$p,$$(am.inst_$p)) +endef +$(foreach p,$(am.primaries),$(eval $(_am.per_primary))) +######################################################################## +files.sys.all += $(foreach p,$(am.primaries),$(am.inst_$p)) +files.out.all += $(foreach p,$(am.primaries),$(am.noinst_$p)) +files.out.all += $(foreach p,$(am.primaries),$(call am.inst2noinst_$p,$(am.inst_$p))) +files.out.check += $(foreach p,$(am.primaries),$(am.check_$p)) +######################################################################## +# TODO: I'm not in love with how _am.per_PROGRAM figures out at.subdirs +define _am.per_PROGRAM +$$(foreach var,_am.depends $$(call am.var_PROGRAMS,$v),$$(eval $$(var) ?=)) +_am.depends += $$(call at.path,$$(call am.file2.o,$f) $$(call am.file2lib,$f,LDADD)) +am.CPPFLAGS += $$($v_CPPFLAGS) $$(call am.file2cpp,$f,LDADD) +am.CFLAGS += $$($v_CFLAGS) +$$(outdir)/$f: private ALL_LDFLAGS += $$($v_LDFLAGS) +$$(outdir)/$f: $$(_am.depends) +am.subdirs := $$(sort $$(am.subdirs)\ + $$(filter-out $$(abspath $$(srcdir)),\ + $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) +$$(foreach var,_am.depends $$(call am.var_PROGRAMS,$v),$$(eval undefine $$(var))) +endef +$(foreach f,$(am.PROGRAMS),$(foreach v,$(call am.file2var,$f),$(eval $(_am.per_PROGRAM)))) +######################################################################## +# TODO: I'm not in love with how _am.per_LTLIBRARY figures out at.subdirs +define _am.per_LTLIBRARY +$$(foreach var,_am.depends $$(call am.var_LTLIBRARIES,$v),$$(eval $$(var) ?=)) +_am.depends += $$(call at.path,$$(call am.file2.lo,$f) $$(call am.file2lib,$f,LIBADD)) +am.CPPFLAGS += $$($v_CPPFLAGS) $$(call am.file2cpp,$f,LIBADD) +am.CFLAGS += $$($v_CFLAGS) +$$(outdir)/$f: private ALL_LDFLAGS += $$($v_LDFLAGS) +$$(outdir)/$f: $$(_am.depends) +am.subdirs := $$(sort $$(am.subdirs)\ + $$(filter-out $$(abspath $$(srcdir)),\ + $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) +$$(foreach var,_am.depends $$(call am.var_LTLIBRARIES,$v),$$(eval undefine $$(var))) +endef +$(foreach f,$(am.LTLIBRARIES),$(foreach v,$(call am.file2var,$f),$(eval $(_am.per_LTLIBRARY)))) +######################################################################## +define _am.per_directory +$$(DESTDIR)$d/%: $$(outdir)/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +$$(DESTDIR)$d/%: $$(srcdir)/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +endef +$(foreach d,$(sort $(dir $(foreach p,$(am.primaries),$(am.inst_$p)))),$(eval $(_am.per_directory))) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 36c2c0a2e8..8213043c79 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -12,60 +12,103 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. + +_at.MAKEFILE_LIST ?= +_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(abspath $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) # This bit only gets evaluated once, at the very beginning ifeq ($(origin _at.NO_ONCE),undefined) +# Internal functions ################################################### + +# These 4 functions are all $(call _at.func,parent,child) +_at.is_strict_subdir = $(filter $(abspath $1)/%,$(abspath $2)) +_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) +_at.relbase = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ + $(abspath $2))) +_at.relto = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ + ../$(call _at.relto,$(dir $1),$2))) + +# These 3 functions only take one operand; we define public multi-operand +# versions below. +_at.path = $(strip \ + $(if $(call _at.is_subdir,$(topoutdir),$1), \ + $(patsubst %/.,%,$(topoutdir)/$(call _at.relto,.,$1)), \ + $(if $(call _at.is_subdir,$(topsrcdir),$1), \ + $(patsubst %/.,%,$(topsrcdir)/$(call _at.relto,$(topsrcdir),$1)), \ + $(abspath $1)))) +_at.out2src = $(call _at.path,$(if $(call _at.is_subdir,$(topoutdir),$1),$(topsrcdir)/$(call _at.path,$1),$1)) +_at.addprefix = $(call _at.path,$(if $(filter-out /%,$2),$1/$2,$2)) + +_at.rest = $(wordlist 2,$(words $1),$1) +_at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) + +# Sanity checking ###################################################### +ifeq ($(filter undefine,$(.FEATURES)),) +$(error Autothing: We need a version of Make that supports 'undefine') +endif ifeq ($(topsrcdir),) -$(error topsrcdir must be set before including Makefile.head.mk) +$(error Autothing: topsrcdir must be set (and non-empty) before including Makefile.head.mk) endif ifeq ($(topoutdir),) -$(error topoutdir must be set before including Makefile.head.mk) +$(error Autothing: topoutdir must be set (and non-empty) before including Makefile.head.mk) endif +ifneq ($(call _at.is_strict_subdir,$(topoutdir),$(topsrcdir)),) +$(error Autothing: topsrcdir=$(topsrcdir) must not be a subdirectory of topoutdir=$(topoutdir)) +endif + +# Internal setup ####################################################### -_at.noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) -# These are all $(call _at.func,parent,child) -#at.relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_at.relto_helper = $(if $(call _at.is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _at.relto_helper,$(patsubst %/,%,$(dir $1)),$2))) -_at.relto = $(call _at.noslash,$(call _at.relto_helper,$(call _at.noslash,$(abspath $1)),$(call _at.noslash,$(abspath $2)))) -at.relto = $(foreach p,$2,$(call _at.relto,$1,$p)) -# Note that _at.is_subdir says that a directory is a subdirectory of -# itself. -at.path = $(call at.relto,.,$1) +# External provisions ################################################## -_at.addprefix = $(if $(filter /%,$2),$2,$1/$2) -at.addprefix = $(foreach f,$2, $(addsuffix $(if $(filter %/,$f),/),$(call at.path,$(call _at.addprefix,$1,$f)) )) +# These 4 functions are all $(call _at.func,parent,child) +at.is_subdir = $(_at.is_subdir) +at.is_strict_subdir = $(_at.is_strict_subdir) +#at.relbase = $(if $2,$(shell realpath -sm --relative-base=$1 -- $2)) +at.relbase = $(foreach _at.tmp,$2,$(call _at.relbase,$1,$(_at.tmp))) +#at.relto = $(if $2,$(shell realpath -sm --relative-to=$1 -- $2)) +at.relto = $(foreach _at.tmp,$2,$(call _at.relto,$1,$(_at.tmp))) + +at.path = $(foreach _at.tmp,$1,$(call _at.path,$(_at.tmp))) +at.out2src = $(foreach _at.tmp,$1,$(call _at.out2src,$(_at.tmp))) +at.addprefix = $(foreach _at.tmp,$2,$(call _at.addprefix,$1,$(_at.tmp))) define at.nl endef +# External configuration ############################################### at.Makefile ?= Makefile -_at.rest = $(wordlist 2,$(words $1),$1) -_at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) - -at.dirlocal += at.subdirs -at.dirlocal += at.depdirs - -_at.outdirs ?= -_at.included_makefiles ?= - +# Include modules ###################################################### include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk)) +_at.tmp_targets = +_at.tmp_subdirs = +_at.VARIABLES = +_at.VARIABLES := $(.VARIABLES) endif # _at.NO_ONCE # This bit gets evaluated for each Makefile -## Set outdir and srcdir (assumes that topoutdir and topsrcdir are -## already set) -outdir := $(call at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) -srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir))) +outdir := $(call _at.path,$(dir $(lastword $(_at.MAKEFILE_LIST)))) +ifeq ($(call _at.is_subdir,$(topoutdir),$(outdir)),) +$(error Autothing: not a subdirectory of topoutdir=$(topoutdir): $(outdir)) +endif -_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/$(at.Makefile)) +# Don't use at.out2src because we *know* that $(outdir) is inside $(topoutdir), +# and has already had $(_at.path) called on it. +srcdir := $(call _at.path,$(topsrcdir)/$(outdir)) +ifeq ($(call _at.is_subdir,$(topsrcdir),$(srcdir)),) +$(error Autothing: not a subdirectory of topsrcdir=$(topsrcdir): $(srcdir)) +endif -$(foreach v,$(at.dirlocal),$(eval $v=)) +at.subdirs = +at.targets = include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.head/*.mk)) diff --git a/build-aux/Makefile.once.head/00-write-ifchanged.mk b/build-aux/Makefile.once.head/00-write-ifchanged.mk deleted file mode 100644 index 79ef1c419c..0000000000 --- a/build-aux/Makefile.once.head/00-write-ifchanged.mk +++ /dev/null @@ -1 +0,0 @@ -WRITE_IFCHANGED = $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/10-dist.mk index 4326cde72a..0e13ea2e28 100644 --- a/build-aux/Makefile.once.head/00-dist.mk +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -13,6 +13,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +mod.dist.description = Make distribution tarballs + # Developer configuration dist.exts ?= .tar.gz @@ -20,10 +22,10 @@ dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION)) ifeq ($(dist.pkgname),) -$(error dist.pkgname must be set) +$(error Autothing module: dist: dist.pkgname must be set) endif ifeq ($(dist.version),) -$(error dist.version must be set) +$(error Autothing module: dist: dist.version must be set) endif # User configuration @@ -38,7 +40,3 @@ TAR ?= tar GZIPFLAGS ?= $(GZIP_ENV) GZIP_ENV ?= --best - -# Implementation - -at.phony += dist diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-files.mk index 3e058eca57..56e06acc34 100644 --- a/build-aux/Makefile.once.head/10-std.mk +++ b/build-aux/Makefile.once.head/10-files.mk @@ -13,27 +13,25 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Declare the default target -all: build -.PHONY: all noop +mod.files.description = Keeping track of groups of files +mod.files.depends += nested + +files.groups ?= all +files.default ?= all +files.vcsclean ?= files.vcsclean +files.generate ?= files.generate + +.DEFAULT_GOAL = $(files.default_group) # Standard creative PHONY targets -at.phony += build install installdirs +nested.targets += $(foreach g,$(files.groups), $g install-$g install-$gdirs) # Standard destructive PHONY targets -at.phony += uninstall mostlyclean clean distclean maintainer-clean - -at.dirlocal += std.src_files -at.dirlocal += std.gen_files -at.dirlocal += std.cfg_files -at.dirlocal += std.out_files -at.dirlocal += std.sys_files -at.dirlocal += std.clean_files -at.dirlocal += std.slow_files +nested.targets += uninstall mostlyclean clean distclean maintainer-clean # User configuration DESTDIR ?= RM ?= rm -f -RMDIR_P ?= rmdir -p +RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty TRUE ?= true diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk index 83cb110c59..c07cfb5cf3 100644 --- a/build-aux/Makefile.once.head/00-gnuconf.mk +++ b/build-aux/Makefile.once.head/10-gnuconf.mk @@ -14,11 +14,13 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # This file is based on §7.2 "Makefile Conventions" of the release of -# the GNU Coding Standards dated April 13, 2016. +# the GNU Coding Standards dated July 25, 2016. + +mod.gnuconf.description = GNU standard configuration variables gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) ifeq ($(gnuconf.pkgname),) -$(error gnuconf.pkgname must be set) +$(error Autothing module: gnuconf: gnuconf.pkgname must be set) endif # 7.2.2: Utilities in Makefiles @@ -54,43 +56,69 @@ TOUCH ?= touch TR ?= tr TRUE ?= true -# These must be user-configurable +# 7.2.2: Utilities in Makefiles/7.2.3: Variables for Specifying Commands +# ---------------------------------------------------------------------- + +# Standard user-configurable programs. +# +# The list of programs here is specified in §7.2.2, but the associated FLAGS +# variables are specified in §7.2.3. I found it cleaner to list them together. AR ?= ar ARFLAGS ?= BISON ?= bison BISONFLAGS ?= CC ?= cc -CCFLAGS ?= $(CFLAGS) +CFLAGS ?= # CFLAGS instead of CCFLAGS FLEX ?= flex FLEXFLAGS ?= INSTALL ?= install -#INSTALLFLAGS ?= +# There is no INSTALLFLAGS[0] LD ?= ld LDFLAGS ?= -LDCONFIG ?= ldconfig #TODO +LDCONFIG ?= ldconfig # TODO[1] LDCONFIGFLAGS ?= LEX ?= lex -LEXFLAGS ?= $(LFLAGS) +LFLAGS ?= # LFLAGS instead of LEXFLAGS #MAKE MAKEINFO ?= makeinfo MAKEINFOFLAGS ?= -RANLIB ?= ranlib #TODO +RANLIB ?= ranlib # TODO[1] RANLIBFLAGS ?= TEXI2DVI ?= texi2dvi TEXI2DVIFLAGS ?= YACC ?= yacc -YACCFLAGS ?= $(YFLAGS) +YFLAGS ?= # YFLAGS instead of YACCFLAGS -CFLAGS ?= -LFLAGS ?= -YFLAGS ?= - -LN_S ?= ln -s #TODO +LN_S ?= ln -s # TODO[2] CHGRP ?= chgrp +CHGRPFLAGS ?= CHMOD ?= chmod +CHMODFLAGS ?= CHOWN ?= chown +CHOWNFLAGS ?= MKNOD ?= mknod +MKNODFLAGS ?= + +# [0]: There is no INSTALLFLAGS because it would be inconsistent with how the +# standards otherwise recommend using $(INSTALL); with INSTALL_PROGRAM and +# INSTALL_DATA; which are specified in a way precluding the use of +# INSTALLFLAGS. To have the variable, but to ignore it in the common case +# would be confusing. +# +# [1]: The RANLIB and LDCONFIG variables need some extra smarts; §7.2.2 says: +# +# > When you use ranlib or ldconfig, you should make sure nothing bad +# > happens if the system does not have the program in question. Arrange +# > to ignore an error from that command, and print a message before the +# > command to tell the user that failure of this command does not mean a +# > problem. (The Autoconf ‘AC_PROG_RANLIB’ macro can help with this.) +# +# [2]: The LN_S variable isn't standard, but we have it here as an (incomplete) +# stub to help support this bit of §7.2.2: +# +# > If you use symbolic links, you should implement a fallback for +# > systems that don’t have symbolic links. # 7.2.3: Variables for Specifying Commands # ---------------------------------------- diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk new file mode 100644 index 0000000000..c8410d4e38 --- /dev/null +++ b/build-aux/Makefile.once.head/10-lt.mk @@ -0,0 +1,12 @@ +mod.lt.description = Easy handling of libtool dependencies +mod.lt.deps += files + +_lt.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l))) +_lt.patsubst-all = $(if $1,$(call _sd.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3) +_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(_lt.tmp)),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(_lt.tmp)),$(_lt.tmp))) + +# The semantics for the de-dup bit are a bit weird. My head hurts thinking +# about them. TODO: clarify/simplify/something +lt.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys)))) +_lt.link_files = $(filter %.o %.lo %.la -l%,$(call _lt.unLIBPATTERNS$,$^)) +lt.link_files = $(filter-out $(call _lt.dups,$(_lt.link_files)),$(_lt.link_files)) diff --git a/build-aux/Makefile.once.head/10-nested.mk b/build-aux/Makefile.once.head/10-nested.mk new file mode 100644 index 0000000000..af9fdf7d8a --- /dev/null +++ b/build-aux/Makefile.once.head/10-nested.mk @@ -0,0 +1,18 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +mod.nested.description = Easy nested .PHONY targets + +nested.targets ?= diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk new file mode 100644 index 0000000000..7917201159 --- /dev/null +++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk @@ -0,0 +1,3 @@ +mod.write-ifchanged.description = build-aux/write-ifchanged helper script + +WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/20-sd.mk b/build-aux/Makefile.once.head/20-sd.mk new file mode 100644 index 0000000000..c8462f285c --- /dev/null +++ b/build-aux/Makefile.once.head/20-sd.mk @@ -0,0 +1,217 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. + +mod.sd.description = systemd build rules +mod.sd.depends += am + +TESTS ?= + +# Make behavior +SHELL = bash -o pipefail + +.DELETE_ON_ERROR: +.SECONDARY: + +# Autoconf +OUR_CPPFLAGS += -MT $@ -MD -MP -MF $(@D)/$(DEPDIR)/$(basename $(@F)).P$(patsubst .%,%,$(suffix $(@F))) +OUR_CPPFLAGS += -include $(topoutdir)/config.h +OUR_CPPFLAGS += $(sort -I$(@D) $(if $(<D),-I$(<D) -I$(call at.out2src,$(<D)))) + +# +sd.ALL_CFLAGS = $(OUR_CFLAGS) $(am.CFLAGS) $(sd.CFLAGS) $(CFLAGS) +sd.ALL_CPPFLAGS = $(OUR_CPPFLAGS) $(am.CPPFLAGS) $(sd.CPPFLAGS) $(CPPFLAGS) +sd.ALL_LDFLAGS = $(OUR_LDFLAGS) $(am.LDFLAGS) $(sd.LDFLAGS) $(LDFLAGS) +sd.ALL_LIBTOOLFLAGS = $(OUR_LIBTOOLFLAGS) $(am.LIBTOOLFLAGS) $(sd.LIBTOOLFLAGS) $(LIBTOOLFLAGS) + +sd.COMPILE = $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS) +sd.LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=compile $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS) +sd.LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=link $(CCLD) $(sd.ALL_CFLAGS) $(sd.ALL_LDFLAGS) -o $@ + +am.INSTALL_PROGRAM = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@ +am.INSTALL_SCRIPT = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@ +am.INSTALL_LTLIBRARY = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@ +am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@ + +CC ?= c99 +CCLD ?= c99 +LIBTOOL ?= libtool + +V ?= + +AM_V_M4 ?= $(AM_V_M4_$(V)) +AM_V_M4_ ?= $(AM_V_M4_$(AM_DEFAULT_VERBOSITY)) +AM_V_M4_0 ?= @echo " M4 " $@; +AM_V_M4_1 ?= + +AM_V_XSLT ?= $(AM_V_XSLT_$(V)) +AM_V_XSLT_ ?= $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY)) +AM_V_XSLT_0 ?= @echo " XSLT " $@; +AM_V_XSLT_1 ?= + +AM_V_GPERF ?= $(AM_V_GPERF_$(V)) +AM_V_GPERF_ ?= $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY)) +AM_V_GPERF_0 ?= @echo " GPERF " $@; +AM_V_GPERF_1 ?= + +AM_V_LN ?= $(AM_V_LN_$(V)) +AM_V_LN_ ?= $(AM_V_LN_$(AM_DEFAULT_VERBOSITY)) +AM_V_LN_0 ?= @echo " LN " $@; +AM_V_LN_1 ?= + +AM_V_RM ?= $(AM_V_RM_$(V)) +AM_V_RM_ ?= $(AM_V_RM_$(AM_DEFAULT_VERBOSITY)) +AM_V_RM_0 ?= @echo " RM " $@; +AM_V_RM_1 ?= + +AM_V_CC ?= $(AM_V_CC_$(V)) +AM_V_CC_ ?= $(AM_V_CC_$(AM_DEFAULT_VERBOSITY)) +AM_V_CC_0 ?= @echo " CC " $@; +AM_V_CC_1 ?= + +AM_V_CCLD ?= $(AM_V_CCLD_$(V)) +AM_V_CCLD_ ?= $(AM_V_CCLD_$(AM_DEFAULT_VERBOSITY)) +AM_V_CCLD_0 ?= @echo " CCLD " $@; +AM_V_CCLD_1 ?= + +AM_V_EFI_CC ?= $(AM_V_EFI_CC_$(V)) +AM_V_EFI_CC_ ?= $(AM_V_EFI_CC_$(AM_DEFAULT_VERBOSITY)) +AM_V_EFI_CC_0 ?= @echo " EFI_CC " $@; +AM_V_EFI_CC_1 ?= + +AM_V_EFI_CCLD ?= $(AM_V_EFI_CCLD_$(V)) +AM_V_EFI_CCLD_ ?= $(AM_V_EFI_CCLD_$(AM_DEFAULT_VERBOSITY)) +AM_V_EFI_CCLD_0 ?= @echo " EFI_CCLD" $@; +AM_V_EFI_CCLD_1 ?= + +AM_V_P ?= $(AM_V_P_$(V)) +AM_V_P_ ?= $(AM_V_P_$(AM_DEFAULT_VERBOSITY)) +AM_V_P_0 ?= false +AM_V_P_1 ?= : + +AM_V_GEN ?= $(AM_V_GEN_$(V)) +AM_V_GEN_ ?= $(AM_V_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN_0 ?= @echo " GEN " $@; +AM_V_GEN_1 ?= + +AM_V_DATA ?= $(AM_V_DATA_$(V)) +AM_V_DATA_ ?= $(AM_V_DATA_$(AM_DEFAULT_VERBOSITY)) +AM_V_DATA_0 ?= @echo " DATA " $@; +AM_V_DATA_1 ?= + +AM_V_PROG ?= $(AM_V_PROG_$(V)) +AM_V_PROG_ ?= $(AM_V_PROG_$(AM_DEFAULT_VERBOSITY)) +AM_V_PROG_0 ?= @echo " PROG " $@; +AM_V_PROG_1 ?= + +AM_V_SCRIPT ?= $(AM_V_SCRIPT_$(V)) +AM_V_SCRIPT_ ?= $(AM_V_SCRIPT_$(AM_DEFAULT_VERBOSITY)) +AM_V_SCRIPT_0 ?= @echo " SCRIPT " $@; +AM_V_SCRIPT_1 ?= + +AM_V_LIB ?= $(AM_V_LIB_$(V)) +AM_V_LIB_ ?= $(AM_V_LIB_$(AM_DEFAULT_VERBOSITY)) +AM_V_LIB_0 ?= @echo " LIB " $@; +AM_V_LIB_1 ?= + +AM_V_at ?= $(AM_V_at_$(V)) +AM_V_at_ ?= $(AM_V_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at_0 ?= @ +AM_V_at_1 ?= + +AM_V_lt ?= $(AM_V_lt_$(V)) +AM_V_lt_ ?= $(AM_V_lt_$(AM_DEFAULT_VERBOSITY)) +AM_V_lt_0 ?= --silent +AM_V_lt_1 ?= + +INTLTOOL_V_MERGE ?= $(INTLTOOL_V_MERGE_$(V)) +INTLTOOL_V_MERGE_OPTIONS ?= $(intltool_v_merge_options_$(V)) +INTLTOOL_V_MERGE_ ?= $(INTLTOOL_V_MERGE_$(AM_DEFAULT_VERBOSITY)) +INTLTOOL_V_MERGE_0 ?= @echo " ITMRG " $@; +INTLTOOL_V_MERGE_1 ?= + +sd.substitutions = \ + '|rootlibexecdir=$(rootlibexecdir)|' \ + '|rootbindir=$(rootbindir)|' \ + '|bindir=$(bindir)|' \ + '|SYSTEMCTL=$(rootbindir)/systemctl|' \ + '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ + '|pkgsysconfdir=$(pkgsysconfdir)|' \ + '|SYSTEM_CONFIG_UNIT_PATH=$(pkgsysconfdir)/system|' \ + '|USER_CONFIG_UNIT_PATH=$(pkgsysconfdir)/user|' \ + '|pkgdatadir=$(pkgdatadir)|' \ + '|systemunitdir=$(systemunitdir)|' \ + '|userunitdir=$(userunitdir)|' \ + '|systempresetdir=$(systempresetdir)|' \ + '|userpresetdir=$(userpresetdir)|' \ + '|udevhwdbdir=$(udevhwdbdir)|' \ + '|udevrulesdir=$(udevrulesdir)|' \ + '|catalogdir=$(catalogdir)|' \ + '|tmpfilesdir=$(tmpfilesdir)|' \ + '|sysusersdir=$(sysusersdir)|' \ + '|sysctldir=$(sysctldir)|' \ + '|systemgeneratordir=$(systemgeneratordir)|' \ + '|usergeneratordir=$(usergeneratordir)|' \ + '|CERTIFICATEROOT=$(CERTIFICATEROOT)|' \ + '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \ + '|PACKAGE_NAME=$(PACKAGE_NAME)|' \ + '|PACKAGE_URL=$(PACKAGE_URL)|' \ + '|RANDOM_SEED_DIR=$(localstatedir)/lib/systemd/|' \ + '|RANDOM_SEED=$(localstatedir)/lib/systemd/random-seed|' \ + '|prefix=$(prefix)|' \ + '|exec_prefix=$(exec_prefix)|' \ + '|libdir=$(libdir)|' \ + '|includedir=$(includedir)|' \ + '|VERSION=$(VERSION)|' \ + '|rootprefix=$(rootprefix)|' \ + '|udevlibexecdir=$(udevlibexecdir)|' \ + '|SUSHELL=$(SUSHELL)|' \ + '|SULOGIN=$(SULOGIN)|' \ + '|DEBUGTTY=$(DEBUGTTY)|' \ + '|KILL=$(KILL)|' \ + '|KMOD=$(KMOD)|' \ + '|MOUNT_PATH=$(MOUNT_PATH)|' \ + '|UMOUNT_PATH=$(UMOUNT_PATH)|' \ + '|MKDIR_P=$(MKDIR_P)|' \ + '|QUOTAON=$(QUOTAON)|' \ + '|QUOTACHECK=$(QUOTACHECK)|' \ + '|SYSTEM_SYSVINIT_PATH=$(sysvinitdir)|' \ + '|VARLOGDIR=$(varlogdir)|' \ + '|RC_LOCAL_SCRIPT_PATH_START=$(RC_LOCAL_SCRIPT_PATH_START)|' \ + '|RC_LOCAL_SCRIPT_PATH_STOP=$(RC_LOCAL_SCRIPT_PATH_STOP)|' \ + '|PYTHON=$(PYTHON)|' \ + '|NTP_SERVERS=$(NTP_SERVERS)|' \ + '|DNS_SERVERS=$(DNS_SERVERS)|' \ + '|DEFAULT_DNSSEC_MODE=$(DEFAULT_DNSSEC_MODE)|' \ + '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \ + '|systemuidmax=$(SYSTEM_UID_MAX)|' \ + '|systemgidmax=$(SYSTEM_GID_MAX)|' \ + '|TTY_GID=$(TTY_GID)|' \ + '|systemsleepdir=$(systemsleepdir)|' \ + '|systemshutdowndir=$(systemshutdowndir)|' \ + '|binfmtdir=$(binfmtdir)|' \ + '|modulesloaddir=$(modulesloaddir)|' + +sd.SED_PROCESS = \ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ + $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(sd.substitutions)))) \ + < $< > $@ diff --git a/build-aux/Makefile.once.head/20-systemd.mk b/build-aux/Makefile.once.head/20-systemd.mk deleted file mode 100644 index 04627a9497..0000000000 --- a/build-aux/Makefile.once.head/20-systemd.mk +++ /dev/null @@ -1,220 +0,0 @@ -# -*- Mode: makefile; indent-tabs-mode: t -*- -# -# This file is part of systemd. -# -# Copyright 2010-2012 Lennart Poettering -# Copyright 2010-2012 Kay Sievers -# Copyright 2013 Zbigniew Jędrzejewski-Szmek -# Copyright 2013 David Strauss -# Copyright 2016 Luke Shumaker -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. -# -# systemd 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with systemd; If not, see <http://www.gnu.org/licenses/>. - -TESTS ?= - - -SHELL = bash -o pipefail - -OUR_CPPFLAGS += -MT $@ -MD -MP -MF $(@D)/$(DEPDIR)/$(basename $(@F)).P$(patsubst .%,%,$(suffix $(@F))) -OUR_CPPFLAGS += -include $(topoutdir)/config.h -OUR_CPPFLAGS += $(sort $(if $(<D),-I$(<D)) \ - $(if $(filter $(abspath $(topoutdir))/%,$(abspath $<)),-I$(call at.path,$(dir $(patsubst $(abspath $(topoutdir))/%,$(abspath $(topsrcdir))/%,$(abspath $<))))) \ - -I$(@D) ) - -at.dirlocal += systemd.CFLAGS systemd.CPPFLAGS systemd.LDFLAGS systemd.LIBTOOLFLAGS -ALL_CFLAGS = $(OUR_CFLAGS) $(am.CFLAGS/$(@D)) $(systemd.CFLAGS/$(@D)) $(CFLAGS) -ALL_CPPFLAGS = $(OUR_CPPFLAGS) $(am.CPPFLAGS/$(@D)) $(systemd.CPPFLAGS/$(@D)) $(CPPFLAGS) -ALL_LDFLAGS = $(OUR_LDFLAGS) $(am.LDFLAGS/$(@D)) $(systemd.LDFLAGS/$(@D)) $(LDFLAGS) -ALL_LIBTOOLFLAGS = $(OUR_LIBTOOLFLAGS) $(am.LIBTOOLFLAGS/$(@D)) $(systemd.LIBTOOLFLAGS/$(@D)) $(LIBTOOLFLAGS) - -SYS_CFLAGS = $(OUR_CFLAGS) $(am.CFLAGS/$(<D)) $(systemd.CFLAGS/$(<D)) $(CFLAGS) -SYS_CPPFLAGS = $(OUR_CPPFLAGS) $(am.CPPFLAGS/$(<D)) $(systemd.CPPFLAGS/$(<D)) $(CPPFLAGS) -SYS_LDFLAGS = $(OUR_LDFLAGS) $(am.LDFLAGS/$(<D)) $(systemd.LDFLAGS/$(<D)) $(LDFLAGS) -SYS_LIBTOOLFLAGS = $(OUR_LIBTOOLFLAGS) $(am.LIBTOOLFLAGS/$(<D)) $(systemd.LIBTOOLFLAGS/$(<D)) $(LIBTOOLFLAGS) - -COMPILE = $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(ALL_LIBTOOLFLAGS) --mode=compile $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(ALL_LIBTOOLFLAGS) --mode=link $(CCLD) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ - -.DELETE_ON_ERROR: -.SECONDARY: - -V ?= - -AM_V_M4 = $(AM_V_M4_$(V)) -AM_V_M4_ = $(AM_V_M4_$(AM_DEFAULT_VERBOSITY)) -AM_V_M4_0 = @echo " M4 " $@; -AM_V_M4_1 = - -AM_V_XSLT = $(AM_V_XSLT_$(V)) -AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY)) -AM_V_XSLT_0 = @echo " XSLT " $@; -AM_V_XSLT_1 = - -AM_V_GPERF = $(AM_V_GPERF_$(V)) -AM_V_GPERF_ = $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY)) -AM_V_GPERF_0 = @echo " GPERF " $@; -AM_V_GPERF_1 = - -AM_V_LN = $(AM_V_LN_$(V)) -AM_V_LN_ = $(AM_V_LN_$(AM_DEFAULT_VERBOSITY)) -AM_V_LN_0 = @echo " LN " $@; -AM_V_LN_1 = - -AM_V_RM = $(AM_V_RM_$(V)) -AM_V_RM_ = $(AM_V_RM_$(AM_DEFAULT_VERBOSITY)) -AM_V_RM_0 = @echo " RM " $@; -AM_V_RM_1 = - -AM_V_CC = $(AM_V_CC_$(V)) -AM_V_CC_ = $(AM_V_CC_$(AM_DEFAULT_VERBOSITY)) -AM_V_CC_0 = @echo " CC " $@; -AM_V_CC_1 = - -AM_V_CCLD = $(AM_V_CCLD_$(V)) -AM_V_CCLD_ = $(AM_V_CCLD_$(AM_DEFAULT_VERBOSITY)) -AM_V_CCLD_0 = @echo " CCLD " $@; -AM_V_CCLD_1 = - -AM_V_EFI_CC = $(AM_V_EFI_CC_$(V)) -AM_V_EFI_CC_ = $(AM_V_EFI_CC_$(AM_DEFAULT_VERBOSITY)) -AM_V_EFI_CC_0 = @echo " EFI_CC " $@; -AM_V_EFI_CC_1 = - -AM_V_EFI_CCLD = $(AM_V_EFI_CCLD_$(V)) -AM_V_EFI_CCLD_ = $(AM_V_EFI_CCLD_$(AM_DEFAULT_VERBOSITY)) -AM_V_EFI_CCLD_0 = @echo " EFI_CCLD" $@; -AM_V_EFI_CCLD_1 = - -AM_V_P = $(AM_V_P_$(V)) -AM_V_P_ = $(AM_V_P_$(AM_DEFAULT_VERBOSITY)) -AM_V_P_0 = false -AM_V_P_1 = : - -AM_V_GEN = $(AM_V_GEN_$(V)) -AM_V_GEN_ = $(AM_V_GEN_$(AM_DEFAULT_VERBOSITY)) -AM_V_GEN_0 = @echo " GEN " $@; -AM_V_GEN_1 = - -AM_V_DATA = $(AM_V_DATA_$(V)) -AM_V_DATA_ = $(AM_V_DATA_$(AM_DEFAULT_VERBOSITY)) -AM_V_DATA_0 = @echo " DATA " $@; -AM_V_DATA_1 = - -AM_V_PROG = $(AM_V_PROG_$(V)) -AM_V_PROG_ = $(AM_V_PROG_$(AM_DEFAULT_VERBOSITY)) -AM_V_PROG_0 = @echo " PROG " $@; -AM_V_PROG_1 = - -AM_V_LIB = $(AM_V_LIB_$(V)) -AM_V_LIB_ = $(AM_V_LIB_$(AM_DEFAULT_VERBOSITY)) -AM_V_LIB_0 = @echo " LIB " $@; -AM_V_LIB_1 = - -AM_V_at = $(AM_V_at_$(V)) -AM_V_at_ = $(AM_V_at_$(AM_DEFAULT_VERBOSITY)) -AM_V_at_0 = @ -AM_V_at_1 = - -AM_V_lt = $(AM_V_lt_$(V)) -AM_V_lt_ = $(AM_V_lt_$(AM_DEFAULT_VERBOSITY)) -AM_V_lt_0 = --silent -AM_V_lt_1 = - -INTLTOOL_V_MERGE = $(INTLTOOL_V_MERGE_$(V)) -INTLTOOL_V_MERGE_OPTIONS = $(intltool_v_merge_options_$(V)) -INTLTOOL_V_MERGE_ = $(INTLTOOL_V_MERGE_$(AM_DEFAULT_VERBOSITY)) -INTLTOOL_V_MERGE_0 = @echo " ITMRG " $@; -INTLTOOL_V_MERGE_1 = - -substitutions = \ - '|rootlibexecdir=$(rootlibexecdir)|' \ - '|rootbindir=$(rootbindir)|' \ - '|bindir=$(bindir)|' \ - '|SYSTEMCTL=$(rootbindir)/systemctl|' \ - '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ - '|pkgsysconfdir=$(pkgsysconfdir)|' \ - '|SYSTEM_CONFIG_UNIT_PATH=$(pkgsysconfdir)/system|' \ - '|USER_CONFIG_UNIT_PATH=$(pkgsysconfdir)/user|' \ - '|pkgdatadir=$(pkgdatadir)|' \ - '|systemunitdir=$(systemunitdir)|' \ - '|userunitdir=$(userunitdir)|' \ - '|systempresetdir=$(systempresetdir)|' \ - '|userpresetdir=$(userpresetdir)|' \ - '|udevhwdbdir=$(udevhwdbdir)|' \ - '|udevrulesdir=$(udevrulesdir)|' \ - '|catalogdir=$(catalogdir)|' \ - '|tmpfilesdir=$(tmpfilesdir)|' \ - '|sysusersdir=$(sysusersdir)|' \ - '|sysctldir=$(sysctldir)|' \ - '|systemgeneratordir=$(systemgeneratordir)|' \ - '|usergeneratordir=$(usergeneratordir)|' \ - '|CERTIFICATEROOT=$(CERTIFICATEROOT)|' \ - '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \ - '|PACKAGE_NAME=$(PACKAGE_NAME)|' \ - '|PACKAGE_URL=$(PACKAGE_URL)|' \ - '|RANDOM_SEED_DIR=$(localstatedir)/lib/systemd/|' \ - '|RANDOM_SEED=$(localstatedir)/lib/systemd/random-seed|' \ - '|prefix=$(prefix)|' \ - '|exec_prefix=$(exec_prefix)|' \ - '|libdir=$(libdir)|' \ - '|includedir=$(includedir)|' \ - '|VERSION=$(VERSION)|' \ - '|rootprefix=$(rootprefix)|' \ - '|udevlibexecdir=$(udevlibexecdir)|' \ - '|SUSHELL=$(SUSHELL)|' \ - '|SULOGIN=$(SULOGIN)|' \ - '|DEBUGTTY=$(DEBUGTTY)|' \ - '|KILL=$(KILL)|' \ - '|KMOD=$(KMOD)|' \ - '|MOUNT_PATH=$(MOUNT_PATH)|' \ - '|UMOUNT_PATH=$(UMOUNT_PATH)|' \ - '|MKDIR_P=$(MKDIR_P)|' \ - '|QUOTAON=$(QUOTAON)|' \ - '|QUOTACHECK=$(QUOTACHECK)|' \ - '|SYSTEM_SYSVINIT_PATH=$(sysvinitdir)|' \ - '|VARLOGDIR=$(varlogdir)|' \ - '|RC_LOCAL_SCRIPT_PATH_START=$(RC_LOCAL_SCRIPT_PATH_START)|' \ - '|RC_LOCAL_SCRIPT_PATH_STOP=$(RC_LOCAL_SCRIPT_PATH_STOP)|' \ - '|PYTHON=$(PYTHON)|' \ - '|NTP_SERVERS=$(NTP_SERVERS)|' \ - '|DNS_SERVERS=$(DNS_SERVERS)|' \ - '|DEFAULT_DNSSEC_MODE=$(DEFAULT_DNSSEC_MODE)|' \ - '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \ - '|systemuidmax=$(SYSTEM_UID_MAX)|' \ - '|systemgidmax=$(SYSTEM_GID_MAX)|' \ - '|TTY_GID=$(TTY_GID)|' \ - '|systemsleepdir=$(systemsleepdir)|' \ - '|systemshutdowndir=$(systemshutdowndir)|' \ - '|binfmtdir=$(binfmtdir)|' \ - '|modulesloaddir=$(modulesloaddir)|' - -SED_PROCESS = \ - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ - $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \ - < $< > $@ - -# Stupid test that everything purported to be exported really is -define generate-sym-test - $(AM_V_at)$(MKDIR_P) $(dir $@) - $(AM_V_at)printf '#include <stdio.h>\n' > $@ - $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@ - $(AM_V_at)printf 'void* functions[] = {\n' >> $@ - $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@ - $(AM_V_at)printf '};\nint main(void) {\n' >> $@ - $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@ - $(AM_V_at)printf 'return 0; }\n' >> $@ -endef - -at.dirlocal += systemd.sed_files diff --git a/build-aux/Makefile.once.head/30-am.mk b/build-aux/Makefile.once.head/30-am.mk new file mode 100644 index 0000000000..9049f2c88a --- /dev/null +++ b/build-aux/Makefile.once.head/30-am.mk @@ -0,0 +1,28 @@ +mod.am.description = Support for Automake variables (systemd specific) +mod.am.depends += gnuconf + +am.inst2noinst_DATA = $(notdir \ + $(patsubst $(sysusersdir)/%.conf,%.sysusers,\ + $(patsubst $(sysctldir)/%.conf,%.sysctl,\ + $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 + +am.INSTALL_PROGRAM ?= $(INSTALL_PROGRAM) $< $@ +am.INSTALL_SCRIPT ?= $(INSTALL) $< $@ +am.INSTALL_LTLIBRARY ?= $(INSTALL) $< $@ +am.INSTALL_DATA ?= $(INSTALL_DATA) $< $@ + +################################################################################ + +# 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 +$(foreach p,$(am.primaries),$(eval am.inst2noinst_$p ?= $$(notdir $$1))) + +am.file2var = $(subst -,_,$(subst .,_,$1)) +am.file2sources = $(addprefix $(srcdir)/,$(notdir $($(am.file2var)_SOURCES))) +am.file2sources += $(addprefix $(outdir)/,$(notdir $(nodist_$(am.file2var)_SOURCES))) +am.file2.o = $(patsubst $(srcdir)/%,$(outdir)/%,$(patsubst %.c,%.o ,$(filter %.c,$(am.file2sources)))) +am.file2.lo = $(patsubst %.o,%.lo,$(am.file2.o)) +am.file2lib = $(foreach l, $($(am.file2var)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).DEPENDS) , $l )) +am.file2cpp = $(foreach l,$1 $($(am.file2var)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).CPPFLAGS) , )) diff --git a/build-aux/Makefile.once.head/30-automake2autothing.mk b/build-aux/Makefile.once.head/30-automake2autothing.mk deleted file mode 100644 index ee21fba45a..0000000000 --- a/build-aux/Makefile.once.head/30-automake2autothing.mk +++ /dev/null @@ -1,11 +0,0 @@ -am.bindirs = bin rootbin libexec rootlibexec systemgenerator udevlibexec -at.dirlocal += am.CFLAGS am.CPPFLAGS am.LDFLAGS am.LIBTOOLFLAGS -at.dirlocal += noinst_LTLIBRARIES lib_LTLIBRARIES -at.dirlocal += $(addsuffix _PROGRAMS,noinst $(am.bindirs)) -at.dirlocal += pkgconfiglib_DATA -automake_name = $(subst -,_,$(subst .,_,$1)) -automake_sources = $(addprefix $(outdir)/,$(notdir $($(automake_name)_SOURCES) $(nodist_$(automake_name)_SOURCES))) -automake_lo = $(patsubst %.c,%.lo,$(filter %.c,$(automake_sources))) -automake_o = $(patsubst %.c,%.o,$(filter %.c,$(automake_sources))) -automake_lib = $(foreach l, $($(automake_name)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).DEPENDS) , $l )) -automake_cpp = $(foreach l,$1 $($(automake_name)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).CPPFLAGS) , )) diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk new file mode 100644 index 0000000000..3bf6398e13 --- /dev/null +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -0,0 +1,24 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +mod.mod.description = Print information about Autothing modules + +_mod.target = at-mod-info +_mod.modules := $(sort $(patsubst %.mk,%,$(filter %.mk,$(subst -, ,$(notdir $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk)))))) +_mod.quote = '$(subst ','\'',$1)' + +_mod.vars = $(filter $(addsuffix .%,$(_mod.modules)),$(.VARIABLES)) +_mod.once := $(_mod.vars) +_mod.each := diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk index b8b7733319..6c6aaedbce 100644 --- a/build-aux/Makefile.once.tail/00-dist.mk +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -16,12 +16,12 @@ _dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2 _dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3)) $(topoutdir)/$(dist.pkgname)-$(dist.version): $(foreach v,$(filter std.src_files/% std.gen_files/%,$(.VARIABLES)),$($v)) - $(RM) -r $@ $(@D)/tmp.$(@F) - $(MKDIR) $(@D)/tmp.$(@F) - $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F),$f)$(at.nl)) - $(MV) $(@D)/tmp.$(@F) $@ || $(RM) -r $(@D)/tmp.$(@F) + $(RM) -r $@ $(@D)/.tmp.$(@F) + $(MKDIR) $(@D)/.tmp.$(@F) + $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/.tmp.$(@F),$f)$(at.nl)) + $(MV) $(@D)/.tmp.$(@F) $@ || $(RM) -r $(@D)/.tmp.$(@F) -$(topoutdir)/$(dist.pkgname)-$(dist.version).tar: $(topoutdir)/$(dist.pkgname)-$(dist.version) +$(topoutdir)/$(dist.pkgname)-$(dist.version).tar: %.tar: % $(TAR) cf $@ -C $(<D) $(<F) -$(topoutdir)/$(dist.pkgname)-$(dist.version).tar.gz: $(topoutdir)/$(dist.pkgname)-$(dist.version).tar +$(topoutdir)/$(dist.pkgname)-$(dist.version).tar.gz: %.gz: % $(GZIP) $(GZIPFLAGS) < $< > $@ diff --git a/build-aux/Makefile.once.tail/00-mod.mk b/build-aux/Makefile.once.tail/00-mod.mk new file mode 100644 index 0000000000..68350f09ea --- /dev/null +++ b/build-aux/Makefile.once.tail/00-mod.mk @@ -0,0 +1,32 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +$(_mod.target): + @printf 'Autothing modules used in this project:\n' + @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call _mod.quote,$(_mod.tmp))) +$(addprefix $(_mod.target)/,$(_mod.modules)): $(_mod.target)/%: + @printf 'Module : %s ' $(call _mod.quote,$*) + @$(if $(at.mod.$*.description),printf ' - %s' $(call _mod.quote,mod.$*.description)) + @echo + @echo Depends on : $(mod.$*.depends) + @echo User configuration: + @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep -v -e ^'_' -e ^'$*' | column -t -s: |sed 's|^| |' + @echo Developer global inputs: + @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' + @echo Developer per-directory inputs: + @egrep '^\s*[^:#]+\s*\?=' $(topsrcdir)/build-aux/Makefile.each.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' + @echo Developer outputs: + @egrep '^\s*[^:#]+\s*(|:|::)=' $(topsrcdir)/build-aux/Makefile.once.head/??-$*.mk 2>/dev/null | sed 's|^\s*||;s|?=|:' | grep ^'$*\.' | column -t -s: |sed 's|^| |' +.PHONY: $(addprefix mod/,$(_mod.modules)) diff --git a/build-aux/Makefile.once.tail/00-noop.mk b/build-aux/Makefile.once.tail/00-noop.mk new file mode 100644 index 0000000000..bac2ec11dd --- /dev/null +++ b/build-aux/Makefile.once.tail/00-noop.mk @@ -0,0 +1,2 @@ +noop: +.PHONY: noop diff --git a/build-aux/Makefile.once.tail/20-systemd.mk b/build-aux/Makefile.once.tail/10-sd.mk index d4b63baad1..228d4d0db7 100644 --- a/build-aux/Makefile.once.tail/20-systemd.mk +++ b/build-aux/Makefile.once.tail/10-sd.mk @@ -21,9 +21,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. -autogen_files = aclocal.m4 automake.mk.in config.h.in configure po/Makefile.in.in -# $*=% had better be $(topsrcdir), but we can't enforce that -$(addprefix %/,$(autogen_files)): %/configure.ac %/autogen.sh +_sd.autogen_files = aclocal.m4 automake.mk.in config.h.in configure po/Makefile.in.in +# `$*`/`%` had better be $(topsrcdir), but we can't enforce that +$(addprefix %/,$(_sd.autogen_files)): %/configure.ac %/autogen.sh cd $(topsrcdir) && ./autogen.sh config_files = config.mk automake.mk autoconf.mk gnustandards.mk po/Makefile.in @@ -51,21 +51,21 @@ valgrind-tests: $(TESTS) x="\n\n"; \ done -exported-%: % - $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@ - -exported: $(addprefix exported-, $(lib_LTLIBRARIES)) - $(AM_V_GEN)sort -u $^ > $@ - -.PHONY: check-api-docs -check-api-docs: exported man - $(AM_V_GEN)for symbol in `cat exported` ; do \ - if test -f $(builddir)/man/$$symbol.html ; then \ - echo " Symbol $$symbol() is documented." ; \ - else \ - echo "‣ Symbol $$symbol() lacks documentation." ; \ - fi ; \ - done +# exported-%: % +# $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@ + +# exported: $(addprefix exported-, $(lib_LTLIBRARIES)) +# $(AM_V_GEN)sort -u $^ > $@ + +# .PHONY: check-api-docs +# check-api-docs: exported man +# $(AM_V_GEN)for symbol in `cat exported` ; do \ +# if test -f $(builddir)/man/$$symbol.html ; then \ +# echo " Symbol $$symbol() is documented." ; \ +# else \ +# echo "‣ Symbol $$symbol() lacks documentation." ; \ +# fi ; \ +# done OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES)) ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v))) diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index a8b3d8938f..136e483837 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,36 +17,26 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -# Move all of the dirlocal variables to their namespaced version -$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) -$(foreach v,$(at.dirlocal),$(eval undefine $v)) - -# Adjust subdirs and depdirs to be relative to $(outdir) -at.subdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.subdirs/$(outdir))))) -at.depdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.depdirs/$(outdir))))) - -# Remember that this is a directory that we've visited -_at.outdirs := $(_at.outdirs) $(outdir) - -# Generic phony target declarations: -# mark them phony -.PHONY: $(addprefix $(outdir)/,$(at.phony)) -# have them depend on subdirs -$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outdir))))) - -# Include Makefiles from other directories +_at.tmp_targets := $(at.targets) +_at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) + +# Clean the environment +$(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)), \ + $(foreach _at.tmp_target,$(_at.tmp_targets), \ + $(if $(filter recursive,$(flavor $(_at.tmp_variable))), \ + $(eval $(_at.tmp_target): private $(_at.tmp_variable) = $(subst $(at.nl),$$(at.nl),$(value $(_at.tmp_variable)))), \ + $(eval $(_at.tmp_target): private $(_at.tmp_variable) := $$($(_at.tmp_variable))))) \ + $(eval undefine $(_at.tmp_variable))) + +# Recurse $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call at.path,$(addsuffix /$(at.Makefile),$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ - $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) + $(foreach _at.tmp,$(call at.path,$(addsuffix /$(at.Makefile),$(_at.tmp_subdirs))),\ + $(if $(filter-out $(_at.MAKEFILE_LIST),$(abspath $(_at.tmp))),\ + $(eval include $(_at.tmp))))) # This bit only gets evaluated once, after all of the other Makefiles are read ifeq ($(origin _at.NO_ONCE),undefined) -outdir = /bogus -srcdir = /bogus - -$(foreach v,$(at.dirlocal),$(eval $v=)) - include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk))) endif # _at.NO_ONCE diff --git a/build-aux/no-builtin-variables.mk b/build-aux/no-builtin-variables.mk deleted file mode 100644 index c3aef5874f..0000000000 --- a/build-aux/no-builtin-variables.mk +++ /dev/null @@ -1,15 +0,0 @@ -MAKEFLAGS += --no-builtin-variables - -# This version is more correct, but is slower: -# $(foreach v,$(shell bash -c 'comm -23 <(env -i $(MAKE) -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort) <(env -i $(MAKE) -R -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort)'), -# $(if $(filter default,$(origin $v)),$(eval undefine $v))) - -_default_variables = $(foreach v,$(.VARIABLES),$(if $(filter default,$(origin $v)),$v)) -$(foreach v,$(filter-out .% MAKE% SUFFIXES,$(_default_variables))\ - $(filter .LIBPATTERNS MAKEINFO,$(_default_variables)),\ - $(eval undefine $v)) -undefine _default_variables - -# Because Make uses .LIBPATTERNS internally, it should always be -# defined in case --warn-undefined-variables -.LIBPATTERNS ?= |