From 2abe0f2d527c7b3f6b97bd6519bf0e35a266ea68 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 7 Aug 2016 21:03:44 -0400 Subject: stuff --- build-aux/Makefile.each.head/00-am.mk | 5 + build-aux/Makefile.each.head/00-dist.mk | 5 +- build-aux/Makefile.each.head/00-files.mk | 29 +++ build-aux/Makefile.each.head/00-nested.mk | 16 ++ build-aux/Makefile.each.head/00-sd.mk | 1 + build-aux/Makefile.each.head/zz-mod.mk | 1 + build-aux/Makefile.each.tail/10-files.mk | 55 ++++++ build-aux/Makefile.each.tail/10-nested.mk | 19 ++ build-aux/Makefile.each.tail/10-std.mk | 46 ----- build-aux/Makefile.each.tail/20-systemd.mk | 99 ---------- .../Makefile.each.tail/30-automake2autothing.mk | 36 ---- build-aux/Makefile.each.tail/30-directory-info.mk | 4 - build-aux/Makefile.each.tail/50-sd.mk | 85 ++++++++ build-aux/Makefile.each.tail/60-am.mk | 64 ++++++ build-aux/Makefile.head.mk | 101 +++++++--- build-aux/Makefile.once.head/00-dist.mk | 44 ----- build-aux/Makefile.once.head/00-gnuconf.mk | 160 --------------- build-aux/Makefile.once.head/00-write-ifchanged.mk | 1 - build-aux/Makefile.once.head/10-dist.mk | 42 ++++ build-aux/Makefile.once.head/10-files.mk | 37 ++++ build-aux/Makefile.once.head/10-gnuconf.mk | 188 ++++++++++++++++++ build-aux/Makefile.once.head/10-lt.mk | 12 ++ build-aux/Makefile.once.head/10-nested.mk | 18 ++ build-aux/Makefile.once.head/10-std.mk | 39 ---- build-aux/Makefile.once.head/10-write-ifchanged.mk | 3 + build-aux/Makefile.once.head/20-sd.mk | 217 ++++++++++++++++++++ build-aux/Makefile.once.head/20-systemd.mk | 220 --------------------- build-aux/Makefile.once.head/30-am.mk | 28 +++ .../Makefile.once.head/30-automake2autothing.mk | 11 -- build-aux/Makefile.once.head/zz-mod.mk | 24 +++ build-aux/Makefile.once.tail/00-dist.mk | 12 +- build-aux/Makefile.once.tail/00-mod.mk | 32 +++ build-aux/Makefile.once.tail/00-noop.mk | 2 + build-aux/Makefile.once.tail/10-sd.mk | 112 +++++++++++ build-aux/Makefile.once.tail/20-systemd.mk | 112 ----------- build-aux/Makefile.tail.mk | 40 ++-- build-aux/no-builtin-variables.mk | 15 -- 37 files changed, 1087 insertions(+), 848 deletions(-) create mode 100644 build-aux/Makefile.each.head/00-am.mk create mode 100644 build-aux/Makefile.each.head/00-files.mk create mode 100644 build-aux/Makefile.each.head/00-nested.mk create mode 100644 build-aux/Makefile.each.head/00-sd.mk create mode 100644 build-aux/Makefile.each.head/zz-mod.mk create mode 100644 build-aux/Makefile.each.tail/10-files.mk create mode 100644 build-aux/Makefile.each.tail/10-nested.mk delete mode 100644 build-aux/Makefile.each.tail/10-std.mk delete mode 100644 build-aux/Makefile.each.tail/20-systemd.mk delete mode 100644 build-aux/Makefile.each.tail/30-automake2autothing.mk delete mode 100644 build-aux/Makefile.each.tail/30-directory-info.mk create mode 100644 build-aux/Makefile.each.tail/50-sd.mk create mode 100644 build-aux/Makefile.each.tail/60-am.mk delete mode 100644 build-aux/Makefile.once.head/00-dist.mk delete mode 100644 build-aux/Makefile.once.head/00-gnuconf.mk delete mode 100644 build-aux/Makefile.once.head/00-write-ifchanged.mk create mode 100644 build-aux/Makefile.once.head/10-dist.mk create mode 100644 build-aux/Makefile.once.head/10-files.mk create mode 100644 build-aux/Makefile.once.head/10-gnuconf.mk create mode 100644 build-aux/Makefile.once.head/10-lt.mk create mode 100644 build-aux/Makefile.once.head/10-nested.mk delete mode 100644 build-aux/Makefile.once.head/10-std.mk create mode 100644 build-aux/Makefile.once.head/10-write-ifchanged.mk create mode 100644 build-aux/Makefile.once.head/20-sd.mk delete mode 100644 build-aux/Makefile.once.head/20-systemd.mk create mode 100644 build-aux/Makefile.once.head/30-am.mk delete mode 100644 build-aux/Makefile.once.head/30-automake2autothing.mk create mode 100644 build-aux/Makefile.once.head/zz-mod.mk create mode 100644 build-aux/Makefile.once.tail/00-mod.mk create mode 100644 build-aux/Makefile.once.tail/00-noop.mk create mode 100644 build-aux/Makefile.once.tail/10-sd.mk delete mode 100644 build-aux/Makefile.once.tail/20-systemd.mk delete mode 100644 build-aux/no-builtin-variables.mk (limited to 'build-aux') 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 . +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 . + +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 . + +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 . +# 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 . + +$(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 . -# 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 . - --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 . + +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 \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 $@ + +_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 . + +_at.MAKEFILE_LIST ?= +_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(abspath $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) # This bit only gets evaluated once, at the very beginning ifeq ($(origin _at.NO_ONCE),undefined) +# Internal functions ################################################### + +# These 4 functions are all $(call _at.func,parent,child) +_at.is_strict_subdir = $(filter $(abspath $1)/%,$(abspath $2)) +_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) +_at.relbase = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ + $(abspath $2))) +_at.relto = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst $(abspath $1)/%,%,$(abspath $2)/.), \ + ../$(call _at.relto,$(dir $1),$2))) + +# These 3 functions only take one operand; we define public multi-operand +# versions below. +_at.path = $(strip \ + $(if $(call _at.is_subdir,$(topoutdir),$1), \ + $(patsubst %/.,%,$(topoutdir)/$(call _at.relto,.,$1)), \ + $(if $(call _at.is_subdir,$(topsrcdir),$1), \ + $(patsubst %/.,%,$(topsrcdir)/$(call _at.relto,$(topsrcdir),$1)), \ + $(abspath $1)))) +_at.out2src = $(call _at.path,$(if $(call _at.is_subdir,$(topoutdir),$1),$(topsrcdir)/$(call _at.path,$1),$1)) +_at.addprefix = $(call _at.path,$(if $(filter-out /%,$2),$1/$2,$2)) + +_at.rest = $(wordlist 2,$(words $1),$1) +_at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) + +# Sanity checking ###################################################### +ifeq ($(filter undefine,$(.FEATURES)),) +$(error Autothing: We need a version of Make that supports 'undefine') +endif ifeq ($(topsrcdir),) -$(error topsrcdir must be set before including Makefile.head.mk) +$(error Autothing: topsrcdir must be set (and non-empty) before including Makefile.head.mk) endif ifeq ($(topoutdir),) -$(error topoutdir must be set before including Makefile.head.mk) +$(error Autothing: topoutdir must be set (and non-empty) before including Makefile.head.mk) endif +ifneq ($(call _at.is_strict_subdir,$(topoutdir),$(topsrcdir)),) +$(error Autothing: topsrcdir=$(topsrcdir) must not be a subdirectory of topoutdir=$(topoutdir)) +endif + +# Internal setup ####################################################### -_at.noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) -# These are all $(call _at.func,parent,child) -#at.relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_at.relto_helper = $(if $(call _at.is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _at.relto_helper,$(patsubst %/,%,$(dir $1)),$2))) -_at.relto = $(call _at.noslash,$(call _at.relto_helper,$(call _at.noslash,$(abspath $1)),$(call _at.noslash,$(abspath $2)))) -at.relto = $(foreach p,$2,$(call _at.relto,$1,$p)) -# Note that _at.is_subdir says that a directory is a subdirectory of -# itself. -at.path = $(call at.relto,.,$1) +# External provisions ################################################## -_at.addprefix = $(if $(filter /%,$2),$2,$1/$2) -at.addprefix = $(foreach f,$2, $(addsuffix $(if $(filter %/,$f),/),$(call at.path,$(call _at.addprefix,$1,$f)) )) +# These 4 functions are all $(call _at.func,parent,child) +at.is_subdir = $(_at.is_subdir) +at.is_strict_subdir = $(_at.is_strict_subdir) +#at.relbase = $(if $2,$(shell realpath -sm --relative-base=$1 -- $2)) +at.relbase = $(foreach _at.tmp,$2,$(call _at.relbase,$1,$(_at.tmp))) +#at.relto = $(if $2,$(shell realpath -sm --relative-to=$1 -- $2)) +at.relto = $(foreach _at.tmp,$2,$(call _at.relto,$1,$(_at.tmp))) + +at.path = $(foreach _at.tmp,$1,$(call _at.path,$(_at.tmp))) +at.out2src = $(foreach _at.tmp,$1,$(call _at.out2src,$(_at.tmp))) +at.addprefix = $(foreach _at.tmp,$2,$(call _at.addprefix,$1,$(_at.tmp))) define at.nl endef +# External configuration ############################################### at.Makefile ?= Makefile -_at.rest = $(wordlist 2,$(words $1),$1) -_at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) - -at.dirlocal += at.subdirs -at.dirlocal += at.depdirs - -_at.outdirs ?= -_at.included_makefiles ?= - +# Include modules ###################################################### include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk)) +_at.tmp_targets = +_at.tmp_subdirs = +_at.VARIABLES = +_at.VARIABLES := $(.VARIABLES) endif # _at.NO_ONCE # This bit gets evaluated for each Makefile -## Set outdir and srcdir (assumes that topoutdir and topsrcdir are -## already set) -outdir := $(call at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) -srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir))) +outdir := $(call _at.path,$(dir $(lastword $(_at.MAKEFILE_LIST)))) +ifeq ($(call _at.is_subdir,$(topoutdir),$(outdir)),) +$(error Autothing: not a subdirectory of topoutdir=$(topoutdir): $(outdir)) +endif -_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/$(at.Makefile)) +# Don't use at.out2src because we *know* that $(outdir) is inside $(topoutdir), +# and has already had $(_at.path) called on it. +srcdir := $(call _at.path,$(topsrcdir)/$(outdir)) +ifeq ($(call _at.is_subdir,$(topsrcdir),$(srcdir)),) +$(error Autothing: not a subdirectory of topsrcdir=$(topsrcdir): $(srcdir)) +endif -$(foreach v,$(at.dirlocal),$(eval $v=)) +at.subdirs = +at.targets = include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.head/*.mk)) diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk deleted file mode 100644 index 4326cde72a..0000000000 --- a/build-aux/Makefile.once.head/00-dist.mk +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -# Developer configuration - -dist.exts ?= .tar.gz -dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) -dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION)) - -ifeq ($(dist.pkgname),) -$(error dist.pkgname must be set) -endif -ifeq ($(dist.version),) -$(error dist.version must be set) -endif - -# User configuration - -CP ?= cp -GZIP ?= gzip -MKDIR ?= mkdir -MKDIR_P ?= mkdir -p -MV ?= mv -RM ?= rm -f -TAR ?= tar - -GZIPFLAGS ?= $(GZIP_ENV) -GZIP_ENV ?= --best - -# Implementation - -at.phony += dist diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/00-gnuconf.mk deleted file mode 100644 index 83cb110c59..0000000000 --- a/build-aux/Makefile.once.head/00-gnuconf.mk +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright (C) 2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -# This file is based on §7.2 "Makefile Conventions" of the release of -# the GNU Coding Standards dated April 13, 2016. - -gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) -ifeq ($(gnuconf.pkgname),) -$(error gnuconf.pkgname must be set) -endif - -# 7.2.2: Utilities in Makefiles -# ----------------------------- - -# It's ok to hard-code these commands in rules, but who wants to -# memorize the list of what's ok? -AWK ?= awk -CAT ?= cat -CMP ?= cmp -CP ?= cp -DIFF ?= diff -ECHO ?= echo -EGREP ?= egrep -EXPR ?= expr -FALSE ?= false -GREP ?= grep -INSTALL_INFO ?= install-info -LN ?= ln -LS ?= ls -MKDIR ?= mkdir -MV ?= mv -PRINTF ?= printf -PWD ?= pwd -RM ?= rm -RMDIR ?= rmdir -SED ?= sed -SLEEP ?= sleep -SORT ?= sort -TAR ?= tar -TEST ?= test -TOUCH ?= touch -TR ?= tr -TRUE ?= true - -# These must be user-configurable -AR ?= ar -ARFLAGS ?= -BISON ?= bison -BISONFLAGS ?= -CC ?= cc -CCFLAGS ?= $(CFLAGS) -FLEX ?= flex -FLEXFLAGS ?= -INSTALL ?= install -#INSTALLFLAGS ?= -LD ?= ld -LDFLAGS ?= -LDCONFIG ?= ldconfig #TODO -LDCONFIGFLAGS ?= -LEX ?= lex -LEXFLAGS ?= $(LFLAGS) -#MAKE -MAKEINFO ?= makeinfo -MAKEINFOFLAGS ?= -RANLIB ?= ranlib #TODO -RANLIBFLAGS ?= -TEXI2DVI ?= texi2dvi -TEXI2DVIFLAGS ?= -YACC ?= yacc -YACCFLAGS ?= $(YFLAGS) - -CFLAGS ?= -LFLAGS ?= -YFLAGS ?= - -LN_S ?= ln -s #TODO - -CHGRP ?= chgrp -CHMOD ?= chmod -CHOWN ?= chown -MKNOD ?= mknod - -# 7.2.3: Variables for Specifying Commands -# ---------------------------------------- - -INSTALL_PROGRAM ?= $(INSTALL) -INSTALL_DATA ?= ${INSTALL} -m 644 - -# 7.2.5: Variables for Installation Directories -# --------------------------------------------- - -# Root for the installation -prefix ?= /usr/local -exec_prefix ?= $(prefix) -# Executable programs -bindir ?= $(exec_prefix)/bin -sbindir ?= $(exec_prefix)/sbin -libexecdir ?= $(exec_prefix)/libexec -# Data files -datarootdir ?= $(prefix)/share -datadir ?= $(datarootdir) -sysconfdir ?= $(prefix)/etc -sharedstatedir ?= $(prefix)/com -localstatedir ?= $(prefix)/var -runstatedir ?= $(localstatedir)/run -# Specific types of files -includedir ?= $(prefix)/include -oldincludedir ?= /usr/include -docdir ?= $(datarootdir)/doc/$(gnuconf.pkgname) -infodir ?= $(datarootdir)/info -htmldir ?= $(docdir) -dvidir ?= $(docdir) -pdfdir ?= $(docdir) -psdir ?= $(docdir) -libdir ?= $(exec_prefix)/lib -lispdir ?= $(datarootdir)/emacs/site-lisp -localedir ?= $(datarootdir)/locale - -mandir ?= $(datarootdir)/man -man1dir ?= $(mandir)/man1 -man2dir ?= $(mandir)/man2 -man3dir ?= $(mandir)/man3 -man4dir ?= $(mandir)/man4 -man5dir ?= $(mandir)/man5 -man6dir ?= $(mandir)/man6 -man7dir ?= $(mandir)/man7 -man8dir ?= $(mandir)/man8 - -manext ?= .1 -man1ext ?= .1 -man2ext ?= .2 -man3ext ?= .3 -man4ext ?= .4 -man5ext ?= .5 -man6ext ?= .6 -man7ext ?= .7 -man8ext ?= .8 - -# 7.2.7: Install Command Categories -# --------------------------------- - -PRE_INSTALL ?= -POST_INSTALL ?= -NORMAL_INSTALL ?= - -PRE_UNINSTALL ?= -POST_UNINSTALL ?= -NORMAL_UNINSTALL ?= diff --git a/build-aux/Makefile.once.head/00-write-ifchanged.mk b/build-aux/Makefile.once.head/00-write-ifchanged.mk deleted file mode 100644 index 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/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk new file mode 100644 index 0000000000..0e13ea2e28 --- /dev/null +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -0,0 +1,42 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +mod.dist.description = Make distribution tarballs + +# Developer configuration + +dist.exts ?= .tar.gz +dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) +dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION)) + +ifeq ($(dist.pkgname),) +$(error Autothing module: dist: dist.pkgname must be set) +endif +ifeq ($(dist.version),) +$(error Autothing module: dist: dist.version must be set) +endif + +# User configuration + +CP ?= cp +GZIP ?= gzip +MKDIR ?= mkdir +MKDIR_P ?= mkdir -p +MV ?= mv +RM ?= rm -f +TAR ?= tar + +GZIPFLAGS ?= $(GZIP_ENV) +GZIP_ENV ?= --best diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk new file mode 100644 index 0000000000..56e06acc34 --- /dev/null +++ b/build-aux/Makefile.once.head/10-files.mk @@ -0,0 +1,37 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +mod.files.description = Keeping track of groups of files +mod.files.depends += nested + +files.groups ?= all +files.default ?= all +files.vcsclean ?= files.vcsclean +files.generate ?= files.generate + +.DEFAULT_GOAL = $(files.default_group) + +# Standard creative PHONY targets +nested.targets += $(foreach g,$(files.groups), $g install-$g install-$gdirs) +# Standard destructive PHONY targets +nested.targets += uninstall mostlyclean clean distclean maintainer-clean + +# User configuration + +DESTDIR ?= + +RM ?= rm -f +RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty +TRUE ?= true diff --git a/build-aux/Makefile.once.head/10-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk new file mode 100644 index 0000000000..c07cfb5cf3 --- /dev/null +++ b/build-aux/Makefile.once.head/10-gnuconf.mk @@ -0,0 +1,188 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# This file is based on §7.2 "Makefile Conventions" of the release of +# the GNU Coding Standards dated July 25, 2016. + +mod.gnuconf.description = GNU standard configuration variables + +gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME)) +ifeq ($(gnuconf.pkgname),) +$(error Autothing module: gnuconf: gnuconf.pkgname must be set) +endif + +# 7.2.2: Utilities in Makefiles +# ----------------------------- + +# It's ok to hard-code these commands in rules, but who wants to +# memorize the list of what's ok? +AWK ?= awk +CAT ?= cat +CMP ?= cmp +CP ?= cp +DIFF ?= diff +ECHO ?= echo +EGREP ?= egrep +EXPR ?= expr +FALSE ?= false +GREP ?= grep +INSTALL_INFO ?= install-info +LN ?= ln +LS ?= ls +MKDIR ?= mkdir +MV ?= mv +PRINTF ?= printf +PWD ?= pwd +RM ?= rm +RMDIR ?= rmdir +SED ?= sed +SLEEP ?= sleep +SORT ?= sort +TAR ?= tar +TEST ?= test +TOUCH ?= touch +TR ?= tr +TRUE ?= true + +# 7.2.2: Utilities in Makefiles/7.2.3: Variables for Specifying Commands +# ---------------------------------------------------------------------- + +# Standard user-configurable programs. +# +# The list of programs here is specified in §7.2.2, but the associated FLAGS +# variables are specified in §7.2.3. I found it cleaner to list them together. +AR ?= ar +ARFLAGS ?= +BISON ?= bison +BISONFLAGS ?= +CC ?= cc +CFLAGS ?= # CFLAGS instead of CCFLAGS +FLEX ?= flex +FLEXFLAGS ?= +INSTALL ?= install +# There is no INSTALLFLAGS[0] +LD ?= ld +LDFLAGS ?= +LDCONFIG ?= ldconfig # TODO[1] +LDCONFIGFLAGS ?= +LEX ?= lex +LFLAGS ?= # LFLAGS instead of LEXFLAGS +#MAKE +MAKEINFO ?= makeinfo +MAKEINFOFLAGS ?= +RANLIB ?= ranlib # TODO[1] +RANLIBFLAGS ?= +TEXI2DVI ?= texi2dvi +TEXI2DVIFLAGS ?= +YACC ?= yacc +YFLAGS ?= # YFLAGS instead of YACCFLAGS + +LN_S ?= ln -s # TODO[2] + +CHGRP ?= chgrp +CHGRPFLAGS ?= +CHMOD ?= chmod +CHMODFLAGS ?= +CHOWN ?= chown +CHOWNFLAGS ?= +MKNOD ?= mknod +MKNODFLAGS ?= + +# [0]: There is no INSTALLFLAGS because it would be inconsistent with how the +# standards otherwise recommend using $(INSTALL); with INSTALL_PROGRAM and +# INSTALL_DATA; which are specified in a way precluding the use of +# INSTALLFLAGS. To have the variable, but to ignore it in the common case +# would be confusing. +# +# [1]: The RANLIB and LDCONFIG variables need some extra smarts; §7.2.2 says: +# +# > When you use ranlib or ldconfig, you should make sure nothing bad +# > happens if the system does not have the program in question. Arrange +# > to ignore an error from that command, and print a message before the +# > command to tell the user that failure of this command does not mean a +# > problem. (The Autoconf ‘AC_PROG_RANLIB’ macro can help with this.) +# +# [2]: The LN_S variable isn't standard, but we have it here as an (incomplete) +# stub to help support this bit of §7.2.2: +# +# > If you use symbolic links, you should implement a fallback for +# > systems that don’t have symbolic links. + +# 7.2.3: Variables for Specifying Commands +# ---------------------------------------- + +INSTALL_PROGRAM ?= $(INSTALL) +INSTALL_DATA ?= ${INSTALL} -m 644 + +# 7.2.5: Variables for Installation Directories +# --------------------------------------------- + +# Root for the installation +prefix ?= /usr/local +exec_prefix ?= $(prefix) +# Executable programs +bindir ?= $(exec_prefix)/bin +sbindir ?= $(exec_prefix)/sbin +libexecdir ?= $(exec_prefix)/libexec +# Data files +datarootdir ?= $(prefix)/share +datadir ?= $(datarootdir) +sysconfdir ?= $(prefix)/etc +sharedstatedir ?= $(prefix)/com +localstatedir ?= $(prefix)/var +runstatedir ?= $(localstatedir)/run +# Specific types of files +includedir ?= $(prefix)/include +oldincludedir ?= /usr/include +docdir ?= $(datarootdir)/doc/$(gnuconf.pkgname) +infodir ?= $(datarootdir)/info +htmldir ?= $(docdir) +dvidir ?= $(docdir) +pdfdir ?= $(docdir) +psdir ?= $(docdir) +libdir ?= $(exec_prefix)/lib +lispdir ?= $(datarootdir)/emacs/site-lisp +localedir ?= $(datarootdir)/locale + +mandir ?= $(datarootdir)/man +man1dir ?= $(mandir)/man1 +man2dir ?= $(mandir)/man2 +man3dir ?= $(mandir)/man3 +man4dir ?= $(mandir)/man4 +man5dir ?= $(mandir)/man5 +man6dir ?= $(mandir)/man6 +man7dir ?= $(mandir)/man7 +man8dir ?= $(mandir)/man8 + +manext ?= .1 +man1ext ?= .1 +man2ext ?= .2 +man3ext ?= .3 +man4ext ?= .4 +man5ext ?= .5 +man6ext ?= .6 +man7ext ?= .7 +man8ext ?= .8 + +# 7.2.7: Install Command Categories +# --------------------------------- + +PRE_INSTALL ?= +POST_INSTALL ?= +NORMAL_INSTALL ?= + +PRE_UNINSTALL ?= +POST_UNINSTALL ?= +NORMAL_UNINSTALL ?= diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk new file mode 100644 index 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 . + +mod.nested.description = Easy nested .PHONY targets + +nested.targets ?= diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk deleted file mode 100644 index 3e058eca57..0000000000 --- a/build-aux/Makefile.once.head/10-std.mk +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -# Declare the default target -all: build -.PHONY: all noop - -# Standard creative PHONY targets -at.phony += build install installdirs -# Standard destructive PHONY targets -at.phony += uninstall mostlyclean clean distclean maintainer-clean - -at.dirlocal += std.src_files -at.dirlocal += std.gen_files -at.dirlocal += std.cfg_files -at.dirlocal += std.out_files -at.dirlocal += std.sys_files -at.dirlocal += std.clean_files -at.dirlocal += std.slow_files - -# User configuration - -DESTDIR ?= - -RM ?= rm -f -RMDIR_P ?= rmdir -p -TRUE ?= true diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk new file mode 100644 index 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 . + +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 $( $@ 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 . - -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 $( $@ - -# 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 \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> $@ - $(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 . + +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 $( $@ 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 . + +$(_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/10-sd.mk b/build-aux/Makefile.once.tail/10-sd.mk new file mode 100644 index 0000000000..228d4d0db7 --- /dev/null +++ b/build-aux/Makefile.once.tail/10-sd.mk @@ -0,0 +1,112 @@ +# -*- 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 . + +_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 +config_headers = config.h +config_commands = depfiles libtool po/stamp-it +$(topoutdir)/config.status: $(topsrcdir)/configure + cd $(topoutdir) && ./config.status --recheck +$(addprefix $(topoutdir)/,$(config_files)): $(topoutdir)/%: $(topoutdir)/config.status $(topsrcdir)/%.in + cd $(topoutdir) && ./config.status --file=$* +$(addprefix $(topoutdir)/,$(config_headers)): $(topoutdir)/%: $(topoutdir)/%.stamp +$(foreach f,$(config_headers),$(topoutdir)/$f.stamp): $(topoutdir)/%.stamp: $(topoutdir)/config.status $(topsrcdir)/%.in + cd $(topoutdir) && ./config.status --header=$* + test -f $(topoutdir)/$* + touch $@ + +# Let's run all tests of the test suite, but under valgrind. Let's +# exclude perl/python/shell scripts we have in there +.PHONY: valgrind-tests +valgrind-tests: $(TESTS) + $(AM_V_GEN)for f in $(filter-out %.pl %.py, $^); do \ + if file $$f | grep -q shell; then \ + echo -e "$${x}Skipping non-binary $$f"; else \ + echo -e "$${x}Running $$f"; \ + $(LIBTOOL) --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \ + 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 + +OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES)) +ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v))) + +undefined defined: $(ALL_OBJECTS) + $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \ + $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \ + done | cut -c 20- | cut -d @ -f 1 | sort -u > $@ + +CLEANFILES += \ + defined \ + undefined + +.PHONY: check-api-unused +check-api-unused: defined undefined exported + ( cat exported undefined ) | sort -u | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2- + +.PHONY: check-includes +check-includes: $(top_srcdir)/tools/check-includes.pl + $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \ + | xargs $(top_srcdir)/tools/check-includes.pl + +EXTRA_DIST += \ + $(top_srcdir)/tools/check-includes.pl + +.PHONY: cppcheck +cppcheck: + cppcheck --enable=all -q $(top_srcdir) + +# Used to extract compile flags for YCM. +print-%: + @echo $($*) + +git-contrib: + @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | awk '{ print $$0 "," }' | sort -u + +EXTRA_DIST += \ + tools/gdb-sd_dump_hashmaps.py + +list-keys: + gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys + +add-key: + gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import - diff --git a/build-aux/Makefile.once.tail/20-systemd.mk b/build-aux/Makefile.once.tail/20-systemd.mk deleted file mode 100644 index d4b63baad1..0000000000 --- a/build-aux/Makefile.once.tail/20-systemd.mk +++ /dev/null @@ -1,112 +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 . - -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 - cd $(topsrcdir) && ./autogen.sh - -config_files = config.mk automake.mk autoconf.mk gnustandards.mk po/Makefile.in -config_headers = config.h -config_commands = depfiles libtool po/stamp-it -$(topoutdir)/config.status: $(topsrcdir)/configure - cd $(topoutdir) && ./config.status --recheck -$(addprefix $(topoutdir)/,$(config_files)): $(topoutdir)/%: $(topoutdir)/config.status $(topsrcdir)/%.in - cd $(topoutdir) && ./config.status --file=$* -$(addprefix $(topoutdir)/,$(config_headers)): $(topoutdir)/%: $(topoutdir)/%.stamp -$(foreach f,$(config_headers),$(topoutdir)/$f.stamp): $(topoutdir)/%.stamp: $(topoutdir)/config.status $(topsrcdir)/%.in - cd $(topoutdir) && ./config.status --header=$* - test -f $(topoutdir)/$* - touch $@ - -# Let's run all tests of the test suite, but under valgrind. Let's -# exclude perl/python/shell scripts we have in there -.PHONY: valgrind-tests -valgrind-tests: $(TESTS) - $(AM_V_GEN)for f in $(filter-out %.pl %.py, $^); do \ - if file $$f | grep -q shell; then \ - echo -e "$${x}Skipping non-binary $$f"; else \ - echo -e "$${x}Running $$f"; \ - $(LIBTOOL) --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \ - 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 - -OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES)) -ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v))) - -undefined defined: $(ALL_OBJECTS) - $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \ - $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \ - done | cut -c 20- | cut -d @ -f 1 | sort -u > $@ - -CLEANFILES += \ - defined \ - undefined - -.PHONY: check-api-unused -check-api-unused: defined undefined exported - ( cat exported undefined ) | sort -u | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2- - -.PHONY: check-includes -check-includes: $(top_srcdir)/tools/check-includes.pl - $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \ - | xargs $(top_srcdir)/tools/check-includes.pl - -EXTRA_DIST += \ - $(top_srcdir)/tools/check-includes.pl - -.PHONY: cppcheck -cppcheck: - cppcheck --enable=all -q $(top_srcdir) - -# Used to extract compile flags for YCM. -print-%: - @echo $($*) - -git-contrib: - @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | awk '{ print $$0 "," }' | sort -u - -EXTRA_DIST += \ - tools/gdb-sd_dump_hashmaps.py - -list-keys: - gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys - -add-key: - gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import - 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 ?= -- cgit v1.2.3-54-g00ecf