diff options
Diffstat (limited to 'build-aux/Makefile.once.head')
-rw-r--r-- | build-aux/Makefile.once.head/00-gitfiles.mk | 32 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/00-quote.mk | 29 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/00-var.mk | 18 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/10-dist.mk | 44 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/10-files.mk | 40 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/10-gnuconf.mk | 188 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/10-lt.mk | 21 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/10-nested.mk | 18 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/10-write-atomic.mk | 4 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/10-write-ifchanged.mk | 4 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/20-sd.mk | 233 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/30-am.mk | 113 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/zz-mod.mk | 36 |
13 files changed, 691 insertions, 89 deletions
diff --git a/build-aux/Makefile.once.head/00-gitfiles.mk b/build-aux/Makefile.once.head/00-gitfiles.mk new file mode 100644 index 0000000000..b17b63aa09 --- /dev/null +++ b/build-aux/Makefile.once.head/00-gitfiles.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.gitfiles.description = Automatically populate files.src.src from git +mod.gitfiles.depends += files nested write-ifchanged quote + +gitfiles.file ?= gitfiles.mk + +_gitfiles.all = +-include $(topsrcdir)/$(gitfiles.file) + +ifneq ($(wildcard $(topsrcdir)/.git),) +$(topsrcdir)/$(gitfiles.file): _gitfiles.FORCE + @(cd $(@D) && git ls-files -z) | sed -z -e 's/\$$/\$$$$/g' -e 's/\n/$$(at.nl)/g' | xargs -r0 printf '_gitfiles.all+=%s\n' | $(WRITE_IFCHANGED) $@ +.PHONY: _gitfiles.FORCE +endif + +_gitfiles.dir = $(call at.relto,$(topsrcdir),$(srcdir)) +_gitfiles.dir.all = $(patsubst $(_gitfiles.dir)/%,%,$(filter $(_gitfiles.dir)/%,$(_gitfiles.all))) +_gitfiles.dir.src = $(filter-out $(addsuffix /%,$(nested.subdirs)),$(_gitfiles.dir.all)) diff --git a/build-aux/Makefile.once.head/00-quote.mk b/build-aux/Makefile.once.head/00-quote.mk new file mode 100644 index 0000000000..9fce401b94 --- /dev/null +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -0,0 +1,29 @@ +# 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.quote.description = Macros to quote tricky strings + +_quote.backslash = $(if $1,$(call _quote.backslash,$(wordlist 2,$(words $1),$1),$(subst $(firstword $1),\$(firstword $1),$2)),$2) + +quote.var = $(subst $(at.nl),\$(at.nl),$(subst $$,$$$$,$1)) +quote.pattern = $(call _quote.backslash, \ % ,$1) +quote.ere = $(call _quote.backslash, \ ^ . [ $$ ( ) | * + ? { ,$1) +quote.bre = $(call _quote.backslash, \ ^ . [ $$ * ,$1) + +quote.shell-each = $(foreach _quote.tmp,$1,$(call quote.shell,$(_quote.tmp))) + +# I put this as the last line in the file because it confuses Emacs syntax +# highlighting and makes the remainder of the file difficult to edit. +quote.shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)') diff --git a/build-aux/Makefile.once.head/00-var.mk b/build-aux/Makefile.once.head/00-var.mk new file mode 100644 index 0000000000..d1e537ef34 --- /dev/null +++ b/build-aux/Makefile.once.head/00-var.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.var.description = Depend on the values of variables + +.PHONY: _var.FORCE 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..e139096576 --- /dev/null +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -0,0 +1,44 @@ +# 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/>. + +mod.dist.description = `dist` target for 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 + +_dist.files = + +# 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..54417356ee --- /dev/null +++ b/build-aux/Makefile.once.head/10-files.mk @@ -0,0 +1,40 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +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) + +# Standard creative PHONY targets +nested.targets += $(files.generate) +nested.targets += install installdirs +nested.targets += $(foreach g,$(files.groups),$g) +nested.targets += $(foreach g,$(filter-out $(files.default),$(files.groups)),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 <http://www.gnu.org/licenses/>. + +# 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..355a5b4343 --- /dev/null +++ b/build-aux/Makefile.once.head/10-lt.mk @@ -0,0 +1,21 @@ +mod.lt.description = (systemd) Easy handling of libtool dependencies +mod.lt.deps += files quote + +_lt.patsubst-all = $(if $1,$(call _lt.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3) +_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(notdir $(_lt.tmp))),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(notdir $(_lt.tmp))),$(_lt.tmp))) +_lt.rest = $(wordlist 2,$(words $1),$1) +_lt.dedup = $(if $1,$(if $(filter $(firstword $1),$(call _lt.rest,$1)),,$(firstword $1) )$(call _lt.dedup,$(call _lt.rest,$1))) +_lt.dependency_libs = $(foreach _lt.tmp,$1,$(_lt.tmp)$(if $(filter %.la,$(_lt.tmp)), $(shell . $(_lt.tmp); echo $$dependency_libs))) + + lt.lib.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys)))) + lt.lib.files.all = $(filter %.lo %.la -l%,$(call _lt.unLIBPATTERNS,$^)) + lt.lib.files.ld = $(strip $(if $(lt.lib.rpath),\ + $(lt.lib.files.all),\ + $(filter-out %.la,$(lt.lib.files.all)))) +_lt.lib.files.dep = $(strip $(call _lt.dedup,$(filter %.la -l%,$(call _lt.dependency_libs,$(lt.lib.files.all))))) + lt.lib.post = $(strip $(if $(lt.lib.rpath),\ + true,\ + sed -i 's|^dependency_libs=.*|dependency_libs='\''$(_lt.lib.files.dep)'\''|' $@)) + +lt.exe.files.all = $(filter %.o %.la -l%,$(call _lt.unLIBPATTERNS,$^)) +lt.exe.files.ld = $(lt.exe.files.all) 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-atomic.mk b/build-aux/Makefile.once.head/10-write-atomic.mk new file mode 100644 index 0000000000..f099ae285f --- /dev/null +++ b/build-aux/Makefile.once.head/10-write-atomic.mk @@ -0,0 +1,4 @@ +mod.write-atomic.description = `write-atomic` auxiliary build script +mod.write-atomic.files += $(topsrcdir)/build-aux/write-atomic + +WRITE_ATOMIC ?= $(topsrcdir)/build-aux/write-atomic 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..b0a5ac478f --- /dev/null +++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk @@ -0,0 +1,4 @@ +mod.write-ifchanged.description = `write-ifchanged` auxiliary build script +mod.write-ifchanged.files += $(topsrcdir)/build-aux/write-ifchanged + +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 index 5aa4779463..3c4d6bfd5c 100644 --- a/build-aux/Makefile.once.head/20-sd.mk +++ b/build-aux/Makefile.once.head/20-sd.mk @@ -20,91 +20,148 @@ # # 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk -include $(topsrcdir)/build-aux/Makefile.head.mk -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -AM_MAKEFLAGS = --no-print-directory -AUTOMAKE_OPTIONS = color-tests parallel-tests +mod.sd.description = (systemd) shared build rules +mod.sd.depends += am -GCC_COLORS ?= 'ooh, shiny!' -export GCC_COLORS +TESTS ?= -SUBDIRS = . po +# Make behavior +SHELL = bash -o pipefail -# remove targets if the command fails .DELETE_ON_ERROR: - -# keep intermediate files .SECONDARY: -# Keep the test-suite.log -.PRECIOUS: $(TEST_SUITE_LOG) Makefile +# 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 = $(strip $(OUR_CFLAGS) $(am.CFLAGS) $(sd.CFLAGS) $(CFLAGS) ) +sd.ALL_CPPFLAGS = $(strip $(OUR_CPPFLAGS) $(am.CPPFLAGS) $(sd.CPPFLAGS) $(CPPFLAGS) ) +sd.ALL_LDFLAGS = $(strip $(OUR_LDFLAGS) $(am.LDFLAGS) $(sd.LDFLAGS) $(LDFLAGS) ) +sd.ALL_LIBTOOLFLAGS = $(strip $(OUR_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 $@ + +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_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_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 = \ +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_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 ?= + +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 ?= + +am.INSTALL_PROGRAMS = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@ +am.INSTALL_SCRIPTS = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@ +am.INSTALL_LTLIBRARIES = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@ +am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@ +am.INSTALL_HEADERS = $(AM_V_HEADER)$(INSTALL_DATA) $< $@ +am.INSTALL_MANS = $(AM_V_MAN)$(INSTALL_DATA) $< $@ + +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 ?= + +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_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_HEADER ?= $(AM_V_HEADER_$(V)) +AM_V_HEADER_ ?= $(AM_V_HEADER_$(AM_DEFAULT_VERBOSITY)) +AM_V_HEADER_0 ?= @echo " HEADER " $@; +AM_V_HEADER_1 ?= + +AM_V_MAN ?= $(AM_V_MAN_$(V)) +AM_V_MAN_ ?= $(AM_V_MAN_$(AM_DEFAULT_VERBOSITY)) +AM_V_MAN_0 ?= @echo " MAN " $@; +AM_V_MAN_1 ?= + +sd.substitutions = \ '|rootlibexecdir=$(rootlibexecdir)|' \ '|rootbindir=$(rootbindir)|' \ '|bindir=$(bindir)|' \ @@ -166,12 +223,14 @@ substitutions = \ '|binfmtdir=$(binfmtdir)|' \ '|modulesloaddir=$(modulesloaddir)|' -SED_PROCESS = \ +sd.substitution_keys := $(subst |,,$(shell printf '%s\n' $(sd.substitutions) | cut -d= -f1)) + +sd.SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ - $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \ + $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(sd.substitutions)))) \ < $< > $@ -XSLTPROC_FLAGS = \ +sd.XSLTPROC_FLAGS = \ --nonet \ --xinclude \ --stringparam man.output.quietly 1 \ @@ -179,18 +238,14 @@ XSLTPROC_FLAGS = \ --stringparam man.authors.section.enabled 0 \ --stringparam man.copyright.section.enabled 0 \ --stringparam systemd.version $(VERSION) \ - --path '$(builddir)/man:$(srcdir)/man' + --path '$(outdir):$(srcdir):$(topoutdir)/man:$(topsrcdir)/man' -XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc) -XSLTPROC_PROCESS_MAN = \ - $(AM_V_XSLT)$(XSLT) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $< +sd.XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc) +sd.XSLTPROC_PROCESS_MAN = \ + $(AM_V_XSLT)$(sd.XSLT) -o $@ $(sd.XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $< -XSLTPROC_PROCESS_HTML = \ - $(AM_V_XSLT)$(XSLT) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $< +sd.XSLTPROC_PROCESS_HTML = \ + $(AM_V_XSLT)$(sd.XSLT) -o $@ $(sd.XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $< -define html-alias +sd.html-alias = \ $(AM_V_LN)$(LN_S) -f $(notdir $<) $@ -endef - - -include $(topsrcdir)/build-aux/Makefile.tail.mk 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..3663e07093 --- /dev/null +++ b/build-aux/Makefile.once.head/30-am.mk @@ -0,0 +1,113 @@ +mod.am.description = (systemd) Automake-to-Autothing magic +mod.am.depends += gnuconf + +am.sys2out_DATA = \ + $(notdir \ + $(patsubst $(pamconfdir)/%,%.pam,\ + $(patsubst $(tmpfilesdir)/%.conf,%.tmpfiles,\ + $(patsubst $(sysusersdir)/%.conf,%.sysusers,\ + $(patsubst $(sysctldir)/%.conf,%.sysctl,\ + $(patsubst $(bashcompletiondir)/%,%.completion.bash,\ + $(patsubst $(zshcompletiondir)/_%,%.completion.zsh,\ + $1))))))) +am.sys2out_HEADERS = $(abspath $(addprefix $(srcdir)/include/,$(notdir $1))) + +am.var_PROGRAMS = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LDADD +am.var_LTLIBRARIES = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LIBADD + +# So these are reasonable defaults, to keep my sanity. They get overridden by +# `libtool`/`AM_V_*`-aware versions in `*-sd.mk` +am.INSTALL_PROGRAMS ?= $(INSTALL_PROGRAM) $< $@ +am.INSTALL_SCRIPTS ?= $(INSTALL) $< $@ +am.INSTALL_LTLIBRARIES ?= $(INSTALL) $< $@ +am.INSTALL_DATA ?= $(INSTALL_DATA) $< $@ +am.INSTALL_HEADERS ?= $(INSTALL_DATA) $< $@ +am.INSTALL_MANS ?= $(INSTALL_DATA) $< $@ + +am.LDFLAGS = + +######################################################################## + +# this list of primaries is based on the Automake 1.15 manual +am.primaries ?= PROGRAMS LIBRARIES LTLIBRARIES LISP PYTHON JAVA SCRIPTS DATA HEADERS MANS TEXINFOS +$(eval $(foreach p,$(am.primaries),am.sys2out_$p ?= $$(notdir $$1)$(at.nl))) + +am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\ + $(patsubst nodist_%,%,$(patsubst dist_%,%,$(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES)))))) +am.sys2dirs = $(sort $(patsubst %/,%,$(dir $(foreach p,$(am.primaries),$(am.sys_$p))))) + +am.file2var = $(subst -,_,$(subst .,_,$1)) +am.file2sources = $(addprefix $(srcdir)/,$(notdir $($(am.file2var)_SOURCES))) +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) , )) + +define _am.per_primary +$(foreach d,$(call am.primary2dirs,$1),$d_$1 ?=$(at.nl)dist_$d_$1 ?=$(at.nl)nodist_$d_$1 ?=$(at.nl)) +noinst_$1 ?= +check_$1 ?= + +am.sys_$1 := $(foreach d,$(call am.primary2dirs,$1),$$(addprefix $$($ddir)/,$$(notdir $$($d_$1) $$(dist_$d_$1) $$(nodist_$d_$1)))) +am.out_$1 := $$(call am.sys2out_$1,$(foreach d,$(call am.primary2dirs,$1),$$(addprefix $$($ddir)/,$$(notdir $$($d_$1) $$(nodist_$d_$1) ))) $$(noinst_$1)) +am.check_$1 := $$(check_$1) +$(foreach d,$(call am.primary2dirs,$1),undefine $d_$1$(at.nl)undefine dist_$d_$1$(at.nl)undefine nodist_$d_$1$(at.nl)) +undefine noinst_$1 +undefine check_$1 +$$(addprefix $$(DESTDIR),$$(am.sys_$1)): private am.INSTALL = $$(am.INSTALL_$1) +endef +######################################################################## +# TODO: I'm not in love with how _am.per_PROGRAM figures out am.subdirs +# $1 = filename +# $2 = varname +define _am.per_PROGRAM +$(foreach var,_am.depends $(call am.var_PROGRAMS,$2),$(var) ?=$(at.nl)) +_am.depends += $$(call at.path,$$(call am.file2.o,$1) $$(call am.file2lib,$1,LDADD)) +am.CPPFLAGS += $$($2_CPPFLAGS) $$(call am.file2cpp,$1,LDADD) +am.CFLAGS += $$($2_CFLAGS) +$$(outdir)/$1: private am.LDFLAGS := $$($2_LDFLAGS) +$$(outdir)/$1: $$(_am.depends) +am.subdirs := $$(sort $$(am.subdirs)\ + $$(filter-out $$(abspath $$(srcdir)),\ + $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) +am.CPPFLAGS := $$(am.CPPFLAGS) +am.CFLAGS := $$(am.CFLAGS) +$(foreach var,_am.depends $(call am.var_LTLIBRARIES,$2),undefine $(var)$(at.nl)) +endef +######################################################################## +# TODO: I'm not in love with how _am.per_LTLIBRARY figures out am.subdirs +# $1 = filename +# $2 = varname +define _am.per_LTLIBRARY +$(foreach var,_am.depends $(call am.var_LTLIBRARIES,$2),$(var) ?=$(at.nl)) +_am.depends += $$(call at.path,$$(call am.file2.lo,$1) $$(call am.file2lib,$1,LIBADD)) +am.CPPFLAGS += $$($2_CPPFLAGS) $$(call am.file2cpp,$1,LIBADD) +am.CFLAGS += $$($2_CFLAGS) +$$(outdir)/$1: private am.LDFLAGS := $$($2_LDFLAGS) +$$(outdir)/$1: $$(_am.depends) +am.subdirs := $$(sort $$(am.subdirs)\ + $$(filter-out $$(abspath $$(srcdir)),\ + $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) +am.CPPFLAGS := $$(am.CPPFLAGS) +am.CFLAGS := $$(am.CFLAGS) +$(foreach var,_am.depends $(call am.var_LTLIBRARIES,$2),undefine $(var)$(at.nl)) +endef +######################################################################## +define _am.per_directory +$$(DESTDIR)$1/%: $$(outdir)/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +$$(DESTDIR)$1/%: $$(srcdir)/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +endef +######################################################################## +define _am.per_include_directory +$$(DESTDIR)$1/%: $$(outdir)/include/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +$$(DESTDIR)$1/%: $$(srcdir)/include/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +endef 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..732f1e169d --- /dev/null +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -0,0 +1,36 @@ +# 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 = Display information about Autothing modules +mod.mod.depends += quote + +# The trickery that is _mod.empty/_mod.space is from §6.2 of the GNU Make +# manual, "The Two Flavors of Variables". +_mod.empty := +_mod.space := $(_mod.empty) # +undefine _mod.empty +# _mod.rest is equivalent to GMSL rest. +_mod.rest = $(wordlist 2,$(words $1),$1) + +_mod.file2mod = $(foreach _mod.tmp,$(patsubst %.mk,%,$(notdir $1)),$(subst $(_mod.space),-,$(call _mod.rest,$(subst -, ,$(_mod.tmp))))) + +_mod.modules := $(sort $(call _mod.file2mod,$(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk))) +undefine _mod.rest +undefine _mod.file2mod + +$(eval $(foreach _mod.tmp,$(_mod.modules),\ + mod.$(_mod.tmp).description ?=$(at.nl)\ + mod.$(_mod.tmp).depends ?=$(at.nl)\ + mod.$(_mod.tmp).files ?=$(at.nl))) |