diff options
267 files changed, 3976 insertions, 740 deletions
diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000000..4bf35862eb --- /dev/null +++ b/.gitconfig @@ -0,0 +1,71 @@ +# -*- Mode: Conf -*- + +[remote "r-systemd"] + url = https://github.com/systemd/systemd.git + fetch = +refs/heads/*:refs/remotes/r-systemd/* + # There are two tag formats coming from r-systemd: + # - vXXX: systemd versions + # - XXX: (001-182) udev versions, from before the + # systemd/udev merge + # Let's put them each in their own namespace. + tagopt = --no-tags + fetch = +refs/tags/v*:refs/tags/systemd/v* + fetch = +refs/tags/0*:refs/tags/udev/v0* + fetch = +refs/tags/1*:refs/tags/udev/v1* +[branch "systemd/master"] + remote = r-systemd + merge = refs/heads/master + +[remote "r-elogind"] + url = https://github.com/wingo/elogind.git + fetch = +refs/heads/*:refs/remotes/r-elogind/* + # There are 3 tag formats coming from r-elogind: + # - XXX: legacy udev tags + # - vXXX: upstream systemd tags + # - vXXX.Y: elogind versions + # Unfortunately, git gives us no good way of filtering to only + # get tags containing a `.` + tagopt = --no-tags + fetch = +refs/tags/v*:refs/tags/elogind/v* +[branch "elogind/master"] + remote = r-elogind + merge = refs/heads/master + +[remote "r-eudev"] + url = https://github.com/gentoo/eudev.git + fetch = +refs/heads/*:refs/remotes/r-eudev/* + # Similarly to how we have done, r-eudev has mapped systemd + # tags to `systemd-vXXX` and legacy udev tags to `udev-XXX`. + # The eudev tags are typically `vX.Y.Z`, but several of them + # are just `X.Y.Z`. Fortunately 1.5.* are the only ones + # without a vX.Y.Z tag; the other has both forms. + tagopt = --no-tags + fetch = +refs/tags/v*:refs/tags/eudev/v* + fetch = +refs/tags/1*:refs/tags/eudev/v1* +[branch "eudev/master"] + remote = r-eudev + merge = refs/heads/master + +[remote "origin"] + url = https://git.parabola.nu/~lukeshu/systemd.git + pushUrl = ssh://git@git.parabola.nu/~git/~lukeshu/systemd.git + fetch = +refs/heads/*:refs/remotes/origin/* + tagopt = --no-tags + fetch = +refs/tags/*:refs/tags/* +[branch "systemd/parabola"] + remote = origin + merge = refs/heads/systemd/parabola +[branch "notsystemd/premove"] + remote = origin + merge = refs/heads/notsystemd/premove +[branch "notsystemd/postmove"] + remote = origin + merge = refs/heads/notsystemd/postmove +[branch "notsystemd/master"] + remote = origin + merge = refs/heads/notsystemd/master + +[remote "r-autothing"] + url = git://lukeshu.com/autothing + tagopt = --no-tags + fetch = +refs/heads/*:refs/remotes/r-autothing/* diff --git a/.gitignore b/.gitignore index 2e89d17a8f..407696e1e8 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ /bootctl /build-aux/* !/build-aux/Makefile* +!/build-aux/write-atomic !/build-aux/write-ifchanged /busctl /cdrom_id @@ -309,9 +310,17 @@ config.log config.status configure stamp-* -.tmp* /autoconf.mk /automake.mk.in /automake.mk /config.mk -/gnustandards.mk +Makefile-man.mk +*-list.txt +*-gperf.c +*-to-name.h +*-from-name.h + +.tmp.* +.var.* + +/gitfiles.mk diff --git a/GNUmakefile b/GNUmakefile index 0f24a727ed..b8bfc3528b 120000..100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1 +1,13 @@ -GNUmakefile
\ No newline at end of file +# This file is a hack to let us pass whatever flags we want to Make, +# since adjusting MAKEFLAGS at runtime only half-works. +# +# Most of the complexity is dancing around to avoid having any +# possibly conflicting identifiers. + +MAKEFLAGS += --no-print-directory +rest = $(wordlist 2,$(words $1),$1) +target = $(or $(firstword $(MAKECMDGOALS)),default) +$(target): + @+$(MAKE) -f Makefile --no-builtin-rules --no-builtin-variables --warn-undefined-variables $(MAKECMDGOALS) +$(or $(call rest,$(MAKECMDGOALS)),_$(target)): $(target) + @: diff --git a/automake.mk.am b/automake.mk.am new file mode 100644 index 0000000000..5522cfa384 --- /dev/null +++ b/automake.mk.am @@ -0,0 +1,3 @@ +# This file doesn't actually get used, it just needs to exist to keep Automake +# happy. We don't use Autmake for any Makefile stuff, but we do use auxiliary +# build scripts provided by Automake. diff --git a/build-aux/Makefile.README.mk b/build-aux/Makefile.README.mk new file mode 100644 index 0000000000..fe9010aafc --- /dev/null +++ b/build-aux/Makefile.README.mk @@ -0,0 +1,20 @@ +# This Makefile is a minimal stub that exists to allow the +# `at-modules` set of Make targets to print documentation for the +# present Autothing modules. +# +# This file is part of the documentation for Autothing. +# +# Copyright (C) 2017 Luke Shumaker +# +# This documentation file is placed into the public domain. If that +# is not possible in your legal system, I grant you permission to use +# it in absolutely every way that I can legally grant to you. + +dist.pkgname = autothing +dist.version = 1.0 +gnuconf.pkgname = autothing + +topoutdir ?= . +topsrcdir ?= . +include $(topsrcdir)/build-aux/Makefile.head.mk +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/build-aux/Makefile.README.old.txt b/build-aux/Makefile.README.old.txt new file mode 100644 index 0000000000..b4ea562be4 --- /dev/null +++ b/build-aux/Makefile.README.old.txt @@ -0,0 +1,35 @@ +Obsolete +======== + +The following was written for previous versions of Autothing. I'm +leaving it here for now because I'll likely canibalize it for other +bits of documentation, either for Autothing itself, the `files` +module, or the `dist` module. + +High-level overview +------------------- + +It also makes it easy to follow the GNU standards for your makefiles: +it takes care of this entire table of .PHONY targets for you: + +| this | and this | are aliases for this | +|------+------------------+--------------------------------------------------------| +| all | build | $(outdir)/build | +| | install | $(outdir)/install | +| | uninstall | $(outdir)/uninstall | +| | mostlyclean | $(outdir)/mostlyclean | +| | clean | $(outdir)/clean | +| | distclean | $(outdir)/distclean | +| | maintainer-clean | $(outdir)/maintainer-clean | +| | check | $(outdir)/check (not implemented for you) | +| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) | + +(You are still responsible for implementing the `$(outdir)/check` +target in each of your Makefiles.) + +---- +Copyright (C) 2016 Luke Shumaker + +This documentation file is placed into the public domain. If that is +not possible in your legal system, I grant you permission to use it in +absolutely every way that I can legally grant to you. diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt new file mode 100644 index 0000000000..f67ede2a3d --- /dev/null +++ b/build-aux/Makefile.README.txt @@ -0,0 +1,447 @@ +# -*- Mode: markdown -*- + +Autothing 3: The smart way to write GNU Makefiles +================================================= + +Autothing is a thing that does things automatically. + +Ok, more helpfully: Autothing is a pair of .mk Makefile fragments +(`Makefile.head.mk` and `Makefile.tail.mk`) that you can `include` +from your Makefiles to make them easier to write; specifically, it +makes it _easy_ to write non-recursive Makefiles--and ones that are +similar to plain recursive Makefiles, at that! + +To many people, talking about GNU Make directly is a non-starter +because it means giving up the many other features that things like +GNU Automake provide. Other projects like GNU Automake were created +to plaster over differences between make(1) implementations; however, +this isn't all that Automake provides, it also makes it easy to do +complex things that users want, or the GNU Coding Standards require. +That's silly; the implementation of these features should be +orthogonal to plastering over the differences between Make +implementations. So, in addition to the Automake core, Automake is +distributed with several "modules" that implement similar feature sets +to what Automake provides. + +Autothing does depend on GNU Make; other make(1) implementations will +not work. However, if you are open to adding GNU Make as a +dependency, then Autothing should obviate the need for GNU Automake, +while also making your Makefiles better. + +Non-recursive? +-------------- + + (For those of you who aren't up on Makefile jargon) + +When you have a project that spans multiple directories, you'll +probably want to split up the Makefile, having the appropriate parts +in each sub-directory. There are a number of strategies you can use +to approach this. + +One of the more prevelant strategies (so much so that GNU make +includes special support for it) is to write "recursive Makefiles"; +that is, have Make rules that include commands like + + other-directory/libfoo.so: + $(MAKE) -C other-directory libfoo.so + +or + + other-directory/libfoo.so + cd other-directory && $(MAKE) libfoo.so + +This approach is popular because it is both very easy to implement, +and is supported by a wide variety of Make implementations. But, it +also introduces a wide variety of issues; so much so that a rather +famous paper was written about it: "Recursive Make Considered Harmful" +(Miller, 1997). + +For all of the arguments against it, and all of the alternative +approaches, recusive Makefiles are hard to beat because they are just +so easy to write, and the alternatives... aren't. UNTIL NOW! + +Instead of having rules that spawn a separate Make process in another +directory for targets in that directory, Autothing lets you provide a +list of directories that include targets that targets in this +directory might depend on, and Autothing will automagically include +the Makefile in that other directory into *this* instance of the Make +program. + + Peter Miller (1997) "Recursive Make Considered Harmful" + <http://aegis.sourceforge.net/auug97.pdf> + +An example Makefile / Introduction +---------------------------------- + +Write your Makefiles of the form: + + # Initialize basic information about how your project is structured. + topsrcdir ?= ... + topoutdir ?= ... + + # Include the Autothing entry point + include $(topsrcdir)/build-aux/Makefile.head.mk + + # Now write your Makefile very similarly to how you normally + # would. Just make sure that outputs are relative to $(outdir) + # and inputs relative to $(srcdir). + $(outdir)/%.o: $(srcdir)/%.c: + $(CC) -c -o $@ $< + $(outdir)/hello: $(outdir)/hello.o + + # If any of the dependencies of files here are outputs of a + # Makefile in another directory, list those directories here. + at.subdirs = ... + + # This part is kind of a pain: define a list of ouput targets that + # this Makefile produces. + at.targets = $(outdir)/%.o $(outdir)/hello + + # Include the Autothing exit point + include $(topsrcdir)/build-aux/Makefile.tail.mk + +This is similar to, but not quite, the comfortable way that you probably +already write your Makefiles. + +It is recommended that Autothing lives inside of the "build-aux" +directory in the top level of your project sources; "build-aux" is a +standard directory for auxiliary build programs and tools. + +What does Autothing do for me? +------------------------------ + +There are two fundamental things that Autothing provides: + + 1. Variable namespacing + 2. Tools for dealing with paths + +The first is important because globals are bad for composability. + +The second is important because GNU Make is too dumb to know that +`foo/bar/../baz` == `foo/baz`. + +Then, there's something that maybe doesn't belong, but I didn't have the heart +to cut it out: + + 3. A module (plugin) system, which allows for modules to provide + additional feature sets. + +The module system is "important" because there are very often common bits that +you want to be included in every Makefile, and this gives some structure to +that. + +Let's step through each of those features. + +## Variable namespacing + +When you write a Makefile, you quite likely use (global) variables. +When you have a project that uses multiple Makefiles, each Makefile +might have the same variable names, but with different values +(especially if converting from recursive Make). + +You could be very disciplined and carefully name your variables so +that they don't conflict. This is difficult and error prone normally, +but becomes neigh-on-impossible if you are converting a large-ish +project from recursive Make. + +So, Autothing provides a solution. If you provide Autothing with a +list of targets defined in your Makefile (via the `at.targets` +variable), Autothing will make any variables you defined local to that +Makefile; they will be present when making targets listed in +`at.targets`, but will be hidden from other Makfiles that get +included. + +Any variables defined before `Makefile.head.mk` is included are +treated as truly global; all Makefiles included will have access to +them. + +## Tools for dealing with paths + +As stated above, GNU Make is too dumb to realize that `foo/bar/../baz` +== `foo/baz`; so one has to be reasonably careful about path +normalization. For dealing with path normalization problems that +arise because of the way Autothing inclusions work, several global +functions are provided for dealing with paths. + +`$(call at.is_subdir,a,b)` returns whether `b` is a sub-directory of +`a` (including `a` as a sub-directory of itself). +`at.is_strict_subdir` does the same, but does not treat `a` as a +sub-directory of itself. (These function names mimic the terms +"subset" and "strict subset" in mathematics.) These use an empty +string for "false" and a non-empty string for "true". + +`$(call at.path,files...)` is a generic path-normalization routine. +The outputs of the other `at.*` functions are already normalized, and +do not need to be passed through this. Files immediately inside of +`$(srcdir)` or `$(outdir)` (without another directory name after the +variable) are already normalized, and do not need to be passed through +this function either. However, it is always safe to pass a path +through this function, so if in doubt, call `at.path`. + +`$(call at.relbase,dir,files...)` and its cousin `at.relto` take a +directory and a list of files, and transform each of the filenames to +be relative to the directory, if the file is inside of the directory. +Where they differ is that if the file is not inside of the directory; +`at.relbase` transforms it into an absolute path, while `at.relto` +prepends as many `../` segments as necessary to make it relative to +the directory. (These function names mimic the `--relative-base` and +`--relative-to` flags of the `realpath` utility that is part of GNU +coreutils.) + +If `$(srcdir)` and `$(outdir)` are the same, then `$(call +at.out2src,files...)` is a no-op, but otherwise it takes a (possibly +relative) path in `$(outdir)`, and transforms it to the equivalent +filename in `$(srcdir)`. + +`$(call at.addprefix,dir,files...)` takes a directory and a list of +filenames, and looks at each filename; if it is an absolute path, it +passes it through (well, "only" normalizes it); if the filename is a +relative path, it is joined with the given base directory. + +## Modules to provide feature sets + +The module system serves two purposes + + 1. Allow your developers to share logic between Makefiles in multiple + directories. + 2. Allow your developers to import "standard" modules implementing + common feature sets, so they don't have to. + +Distributed along with autothing are some "standard" modules that +provide commonly desired functionality from Makefiles; tricky little +things that your developers shouldn't have to implement themselves for +every project; the things that GNU Automake would take care of if you +used Automake (a piece of software that Autothing hopes to replace). + +The module system is conceptually quite simple: have 4 directories for +`.mk` makefile snippets that get included at certain points: + + Makefile.once.head/*.mk + + Makefile.each.head/*.mk + a/Makefile + Makefile.each.tail/*.mk + + Makefile.each.head/*.mk + b/Makefile + Makefile.each.tail/*.mk + + Makefile.each.head/*.mk + c/Makefile + Makefile.each.tail/*.mk + + Makefile.once.tail/*.mk + +Deciding which of the 4 directories to put your snippets in... you'll +figure it out pretty quickly once you start playing with it. + +Beyond these 4 directories, Autothing itself imposes no structure, but +there are some conventions that are followed by the distributed along +with Autothing, and I recommend that your developers follow. + +Each of the `.mk` files is name `NN-MODULE.mk` where NN is a number +(to affect the order that the module files are evaluated in, in case +of dependencies between them), and MODULE is the module name. Each +module has "public" variables prefixed with `MODULE.`, and "private" +variables prefixed with `_MODULE.` (again, "MODULE" being the module +name). For example, the "groups" parameter of the "files" module is +configured via the `files.groups` variable. Within this convention, +Autothing presents itself as a pseudo-module named "at"; that is, +public Autothing variables are prefixed with `at.`. + +If you follow these conventions, then the "mod" module distributed +along with Autothing can display information about the modules that a +project uses, and documentation on each module. Running the command +`make at-modules` (implemented by the "mod" module) will produce a +list of the modules present in a project, and short descriptions of +them: + + $ make at-modules + Autothing modules used in this project: + - dist `dist` target for distribution tarballs (more) + - files Keeping track of groups of files (more) + - gitfiles Automatically populate files.src.src from git (more) + - gnuconf GNU standard configuration variables (more) + - mod Display information about Autothing modules (more) + - nested Easy nested .PHONY targets (more) + - quote Macros to quote tricky strings (more) + - texinfo The GNU documentation system (more) + - var Depend on the values of variables (more) + - write-atomic `write-atomic` auxiliary build script (more) + - write-ifchanged `write-ifchanged` auxiliary build script (more) + +The "(more)" at the end of a line indicates that there is further +documentation for that module, which can be produced by running the +command `make at-modules/MODULE_NAME`. See the output of `make +at-modules/mod` for instructions on how to produce this further +documentation for modules you develop. + +Besides the "mod" module, the set modules distributed along with +Autothing primarily exists to provide the bits of (sometimes somewhat +tricky) functionality required of Makefiles by the GNU Coding +Standards. Run the `at-modules` commands above for documentation on +each of them. + +Formal interface +---------------- + +System requirements: + - A version of GNU Make that supports `undefine` (ie, version 3.82 + and above). + + If the user attempts to use your Autothing-using Makefile with an + older version of GNU Make, `Makefile.head.mk` will print an error + message and refuse to proceed: + + $ make-3.81 + build-aux/Makefile.head.mk:58: *** Autothing: We need a version of Make that supports 'undefine'. Stop. + +Inputs: + - In each `Makefile`: + - Before `Makefile.head.mk`: + - Variable (mandatory) : `topoutdir` + - Variable (mandatory) : `topsrcdir` (must not be a subdirectory of `$(topoutdir)`) + - Variable (optional) : `at.Makefile` (Default: `Makefile`) + - Between `Makefile.head.mk` and `Makefile.tail.mk`: + - Variable: `at.targets` (Default: empty) + - Variable: `at.subdirs` (Default: empty) + - Files: + - `${topsrcdir}/build-aux/Makefile.{each,once}.{head,tail}/*.mk` + + Unfortunately, a limitation of Autothing is that it does require a + designated "top" directory; it can't be used to have a sub-project + that can also be totally separate and built alone. In your + Makefiles, before you include `Makefile.head.mk`, you must tell + Autothing what the top directory is by setting `topoutdir` and + `topsrcdir`. + + If you wish for your per-directory Makefiles to have a name other + than `Makefile` (such as `GNUmakefile` or `makefile`, which GNU Make + also looks for by default; or another name for project-specific + reasons), Autothing supports this by setting the `at.Makefile` + variable. Unfortunately, Autothing does not support having a list + of filenames to try; so one must be consistent about the filename + throughout the project. + + In the body of each Makefile, you may set the `at.targets` variable + to list which targets should have access to the variables defined in + the body of that Makefile. + + In the body of each Makefile, you may set the `at.subdirs` variable + to list of directories which have their own Makefile which produces + targets that targets in this directory depend on. Directories + listed in `at.subdirs` may be relative or absolute; if relative, + they are interpreted as relative to `$(outdir)`. + +Outputs: + - Global: + - Variable (function): `$(call at.is_subdir, parent, child)` + - Variable (function): `$(call at.is_strict_subdir, parent, child)` + - Variable (function): `$(call at.relbase, parent, children...)` + - Variable (function): `$(call at.relto, parent, children...)` + - Variable (function): `$(call at.path, paths...)` + - Variable (function): `$(call at.out2src, paths...)` + - Variable (function): `$(call at.addprefix, prefix, paths...)` + - Variable : `$(at.nl)` # a single newline + - Per-directory: + - Variable: `$(outdir)` + - Variable: `$(srcdir)` + + For dealing with path normalization problems that arise because of + the way Autothing inclusions work, several global functions are + provided for dealing with paths; see the above "Tools for dealing + with paths" section for documentation on each of these functions. + + For convenience, it also provides `$(at.nl)` which is a single + newline, as newlines are very difficult to type in Make variable + values. + +Tips, notes +----------- + +If you use Autoconf (or similar), I recommend having a file at +`$(topsrcdir)/config.mk.in` of the form + + ifeq ($(origin topsrcdir),undefined) + topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) + topsrcdir := $(topoutdir)/@top_srcdir@ + + # Any other global variables you might want to set + + endif + +Then have `./configure` generate `$(topoutdir)/config.mk` from it by +placing `AC_CONFIG_FILES([config.mk])` in your `configure.ac`. I +recommend that you have `config.mk` be the _only_ Makefile edited by +`./configure`; which will require manual support to have `./configure` +link/copy the Makefiles unedited into `$(topoutdir)`; you can do this +by placing something like this in your `configure.ac`: + + AC_OUTPUT([], [], [ + if test "$srcdir" != .; then + find "$srcdir" -name Makefile -printf '%P\n' \ + | while read -r filename; do + mkdir -p "\$(dirname "\$filename")" + ln -srfT "$srcdir/\$filename" "\$filename" + done + fi + ]) + +This will allow you to write your Makefiles in the form: + + include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk + include $(topsrcdir)/build-aux/Makefile.head.mk + + # your Makefile here + + include $(topsrcdir)/build-aux/Makefile.tail.mk + +Where you only need to adjust the number of `../` segments in the +first line based on how deep that directory is. + +Further development +------------------- + +Most of the modules distributed along with Autothing have the goal of +combining to provide the things that the GNU Coding Standards require. +Between `gnuconf`, `dist`, `files`, and `texinfo`; the GNU Coding +Standards for Makefiles are nearly entirely satisfied. However, there +are a few targets that are required, but aren't implemented by a +module (yet!): + + - `install-strip` + - `TAGS` + - `check` + - `installcheck` (optional, but recommended) + +TODO +---- + + - Write documentation on `srcdir`, `outdir`, and out-of-tree builds; + I don't think discussions involving the separate `srcdir` and + `outdir` make much sense without that context. + +Bugs/Limitations +---------------- + + - This documentation file is almost three times as long as the code + that it documents. + + - The "parse time" for projects with hundreds of sub-directories + (each having a Makefile) can be slow (ex: a project with 166 + directories has a parse time of around 12 seconds on my box). I + blame GNU Make's garbage collector; I don't think it was ever + designed to deal with as much "garbage" as Autothing's variable + namespacing throws at it. + + - Requires a designated "top" directory; see discussion above. + + - Does not support varying per-directory Makefile names; see + discussion above. + +---- +Copyright (C) 2016-2017 Luke Shumaker + +This documentation file is placed into the public domain. If that is +not possible in your legal system, I grant you permission to use it in +absolutely every way that I can legally grant to you. 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..09a2d3c5ac --- /dev/null +++ b/build-aux/Makefile.each.head/00-am.mk @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000000..924d79aa7c --- /dev/null +++ b/build-aux/Makefile.each.head/00-dist.mk @@ -0,0 +1,23 @@ +# 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.depends += files + +ifeq ($(outdir),$(topoutdir)) +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..c4820cfb1f --- /dev/null +++ b/build-aux/Makefile.each.head/00-files.mk @@ -0,0 +1,32 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +files.src.src ?= +files.src.int ?= +files.src.cfg ?= +files.src.gen ?= + +files.out.slow ?= +files.out.int ?= +files.out.cfg ?= + +# define files.out.$(group) files.sys.$(group) for every files.group +$(eval $(foreach t,$(files.groups),files.out.$t ?=$(at.nl)files.sys.$t ?=$(at.nl))) + +# define files.src, files.out, and files.sys aggregates +$(eval \ + files.src = $$(sort $(foreach _files.v,$(filter files.src.%,$(.VARIABLES)),$$($(_files.v))))$(at.nl)\ + files.out = $$(sort $(foreach _files.v,$(filter files.out.%,$(.VARIABLES)),$$($(_files.v))))$(at.nl)\ + files.sys = $$(sort $(foreach _files.v,$(filter files.sys.%,$(.VARIABLES)),$$($(_files.v))))) diff --git a/build-aux/Makefile.each.head/00-gitfiles.mk b/build-aux/Makefile.each.head/00-gitfiles.mk new file mode 100644 index 0000000000..b872912015 --- /dev/null +++ b/build-aux/Makefile.each.head/00-gitfiles.mk @@ -0,0 +1,20 @@ +# 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/>. + +ifeq ($(abspath $(topsrcdir)),$(abspath $(srcdir))) +files.src.gen += $(gitfiles.file) +endif + +files.src.src += $(_gitfiles.dir.src) diff --git a/build-aux/Makefile.each.head/00-nested.mk b/build-aux/Makefile.each.head/00-nested.mk new file mode 100644 index 0000000000..4325825353 --- /dev/null +++ b/build-aux/Makefile.each.head/00-nested.mk @@ -0,0 +1,16 @@ +# Copyright (C) 2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +nested.subdirs ?= diff --git a/build-aux/Makefile.each.head/00-sd.mk b/build-aux/Makefile.each.head/00-sd.mk new file mode 100644 index 0000000000..43d1625245 --- /dev/null +++ b/build-aux/Makefile.each.head/00-sd.mk @@ -0,0 +1,6 @@ +sd.CFLAGS ?= +sd.CPPFLAGS ?= +sd.LDFLAGS ?= +sd.LIBTOOLFLAGS ?= + +sd.sed_files ?= diff --git a/build-aux/Makefile.each.head/00-texinfo.mk b/build-aux/Makefile.each.head/00-texinfo.mk new file mode 100644 index 0000000000..88aaeb5262 --- /dev/null +++ b/build-aux/Makefile.each.head/00-texinfo.mk @@ -0,0 +1,16 @@ +# Copyright (C) 2016-2017 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/>. + +texinfo.docs ?= diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk new file mode 100644 index 0000000000..b023e80235 --- /dev/null +++ b/build-aux/Makefile.each.tail/00-dist.mk @@ -0,0 +1 @@ +_dist.files := $(strip $(_dist.files) $(call at.addprefix,$(srcdir),$(filter-out $(files.src.int),$(files.src)))) diff --git a/build-aux/Makefile.each.tail/00-mod.mk b/build-aux/Makefile.each.tail/00-mod.mk new file mode 100644 index 0000000000..d6514dd93a --- /dev/null +++ b/build-aux/Makefile.each.tail/00-mod.mk @@ -0,0 +1,44 @@ +# 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/>. + +$(outdir)/at-variables $(outdir)/at-variables-local: _mod.VARIABLES := $(filter-out $(call quote.pattern,$(_at.VARIABLES)),$(.VARIABLES)) +$(outdir)/at-variables-global: + @printf '%s\n' $(call quote.shell-each,$(sort $(.VARIABLES))) +$(outdir)/at-variables-local: + @printf '%s\n' $(call quote.shell-each,$(sort $(_mod.VARIABLES))) +$(outdir)/at-variables $(outdir)/at-values: + @printf '%s\n' $(call quote.shell-each,$(sort $(.VARIABLES),$(_mod.VARIABLES))) +$(outdir)/at-variables/%: + @printf '%s\n' $(call quote.shell,$($*)) +$(outdir)/at-values/%: + @printf '%s\n' $(call quote.shell,$(value $*)) +.PHONY: $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values) +at.targets += $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values at-variables/% at-values/%) + +$(outdir)/at-modules: + @printf 'Autothing modules used in this project:\n' + @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call quote.shell,$(_mod.tmp) $(mod.$(_mod.tmp).description) $(if $(mod.$(_mod.tmp).doc),(more))))|column -t -s $$'\t' +$(addprefix $(outdir)/at-modules/,$(_mod.modules)): $(outdir)/at-modules/%: + @printf 'Name : %s\n' $(call quote.shell,$*) + @printf 'Description : %s\n' $(call quote.shell,$(mod.$*.description)) + @echo 'Depends on :' $(sort $(mod.$*.depends)) + @echo 'Files :' + @printf ' %s\n' $(call quote.shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk)))) + @echo 'Documentation :' + @printf '%s\n' $(call quote.shell,$(mod.$*.doc)) | sed -e 's/^# / /' -e 's/^#//' + +$(outdir)/at-noop: +.PHONY: $(outdir)/at-noop +at.targets += $(outdir)/at-noop diff --git a/build-aux/Makefile.each.tail/00-var.mk b/build-aux/Makefile.each.tail/00-var.mk new file mode 100644 index 0000000000..954defb2da --- /dev/null +++ b/build-aux/Makefile.each.tail/00-var.mk @@ -0,0 +1,22 @@ +# Copyright (C) 2016-2017 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.depends += files quote write-ifchanged + +$(outdir)/.var.%: _var.FORCE + @printf '%s' $(call quote.shell,$($*)) | sed 's/^/#/' | $(WRITE_IFCHANGED) $@ +-include $(wildcard $(outdir)/.var.*) + +files.out.int += .var.* 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..e22b216c19 --- /dev/null +++ b/build-aux/Makefile.each.tail/10-files.mk @@ -0,0 +1,57 @@ +# Copyright (C) 2015-2017 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# Add some more defaults to the *_files variables + +$(eval \ + $(foreach _files.var,$(filter files.src files.src.%,$(.VARIABLES)),\ + _$(_files.var) = $$(call at.addprefix,$$(srcdir),$$($(_files.var)))$(at.nl))\ + $(foreach _files.var,$(filter files.out files.out.%,$(.VARIABLES)),\ + _$(_files.var) = $$(call at.addprefix,$$(outdir),$$($(_files.var)))$(at.nl))\ + $(foreach _files.var,$(filter files.sys files.sys.%,$(.VARIABLES)),\ + _$(_files.var) = $$(addprefix $$(DESTDIR),$$($(_files.var)))$(at.nl))) + +_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))) +$(eval \ + $(foreach _files.g,$(files.groups),\ + $$(outdir)/$(_files.g): $$(_files.out.$(_files.g))$(at.nl))\ + $(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ + $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g))$(at.nl))) + +# Destructive targets +# +# We do our on $(srcdir) / $(outdir) prefixing here because +# at.addprefix (while necessary for dependency lists) doesn't preserve +# trailing slashes, which we care about here; while also not caring +# about the path normalization that at.addprefix does. +_files.uninstall = $(addprefix $(DESTDIR),$(files.sys)) +_files.mostlyclean = $(addprefix $(srcdir)/,$(filter-out $(files.out.slow) $(files.out.cfg),$(files.out))) +_files.clean = $(addprefix $(srcdir)/,$(filter-out $(files.out.cfg),$(files.out))) +_files.distclean = $(addprefix $(srcdir)/, $(files.out)) +_files.maintainer-clean = $(files.distclean) $(addprefix $(srcdir)/,$(filter-out $(files.src.cfg) $(files.src.src),$(files.src))) +_files.$(files.vcsclean) = $(files.distclean) $(addprefix $(srcdir)/,$(filter-out $(files.src.src),$(files.src))) +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean)): %: %-hook + $(call _files.XARGS,$(RM) -- {}, $(sort $(filter-out %/,$(_files.$(@F)))) ) + $(call _files.XARGS,$(RM) -r -- {}, $(sort $(filter %/,$(_files.$(@F)))) ) + $(call _files.XARGS,$(RMDIR_P) -- {} 2>/dev/null || true,$(filter-out ./,$(sort $(dir $(_files.$(@F)))))) +$(addprefix $(outdir)/,maintainer-clean $(files.vcsclean)): _files.maintainer-clean-warning +$(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..667ec6f901 --- /dev/null +++ b/build-aux/Makefile.each.tail/10-nested.mk @@ -0,0 +1,21 @@ +# Copyright (C) 2016-2017 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/>. + +$(eval $(foreach _tmp.nested,$(nested.targets),\ + $$(outdir)/$(_tmp.nested): $$(addsuffix /$(_tmp.nested),$$(call at.addprefix,$$(outdir),$$(nested.subdirs)))$(at.nl))) +.PHONY: $(addprefix $(outdir)/,$(nested.targets)) + +at.subdirs += $(nested.subdirs) +at.targets += $(addprefix $(outdir)/,$(nested.targets)) diff --git a/build-aux/Makefile.each.tail/11-texinfo.mk b/build-aux/Makefile.each.tail/11-texinfo.mk new file mode 100644 index 0000000000..1ee5843d69 --- /dev/null +++ b/build-aux/Makefile.each.tail/11-texinfo.mk @@ -0,0 +1,38 @@ +# 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/>. + +$(outdir)/info : $(addsuffix .info,$(texinfo.docs)) +files.src.gen += $(addsuffix .info,$(texinfo.docs)) +files.out.dvi += $(addsuffix .dvi ,$(texinfo.docs)) +files.out.html += $(addsuffix .html,$(texinfo.docs)) +files.out.pdf += $(addsuffix .pdf ,$(texinfo.docs)) +files.out.ps += $(addsuffix .ps ,$(texinfo.docs)) + +files.sys.all += $(foreach f,$(texinfo.docs), $(infodir)/$f.info ) +files.sys.dvi += $(foreach f,$(texinfo.docs), $(dvidir)/$f.dvi ) +files.sys.html += $(foreach f,$(texinfo.docs), $(htmldir)/$f.html ) +files.sys.pdf += $(foreach f,$(texinfo.docs), $(pdfdir)/$f.pdf ) +files.sys.ps += $(foreach f,$(texinfo.docs), $(psdir)/$f.ps ) + +$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $< +$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $< +$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $< +$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $< +$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $< +$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $< diff --git a/build-aux/Makefile.each.tail/50-sd.mk b/build-aux/Makefile.each.tail/50-sd.mk index c6c05cdff7..7927a31917 100644 --- a/build-aux/Makefile.each.tail/50-sd.mk +++ b/build-aux/Makefile.each.tail/50-sd.mk @@ -20,38 +20,75 @@ # # 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 -%-from-name.gperf: %-list.txt +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.lib.files.all)) = 0; then echo 'Cannot link library with no dependencies: $@' >&2; exit 1; fi + @if test $(origin am.LDFLAGS) = undefined; then echo 'Cannot link library with undefined am.LDFLAGS: $@' >&2; exit 1; fi + $(AM_V_CCLD)$(sd.LINK) $(if $(lt.lib.rpath),-rpath $(lt.lib.rpath)) $(lt.lib.files.ld) + $(AM_V_at)$(lt.lib.post) +$(addprefix $(outdir)/,$(am.out_PROGRAMS)): $(outdir)/%: + @if test $(words $(lt.exe.files.all)) = 0; then echo 'Cannot link executable with no dependencies: $@' >&2; exit 1; fi + @if test $(origin am.LDFLAGS) = undefined; then echo 'Cannot link executable with undefined am.LDFLAGS: $@' >&2; exit 1; fi + $(AM_V_CCLD)$(sd.LINK) $(lt.exe.files.ld) + +# Stupid test that everything purported to be exported really is +$(outdir)/test-lib%-sym.c: $(srcdir)/lib%.sym + $(AM_V_GEN){\ + printf '#include <stdio.h>\n' && \ + printf '#include "%s"\n' $(notdir $(filter %.h, $^)) && \ + printf 'void* functions[] = {\n' && \ + sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< && \ + printf '};\nint main(void) {\n' && \ + printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' && \ + printf 'return 0; }\n' && \ + :; } > $@ + +_sd.files_in = $(foreach f,$(files.sys),$(if $(filter $1,$(patsubst %/,%,$(dir $f))),$(DESTDIR)$f)) + +$(outdir)/%-from-name.gperf: $(outdir)/%-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@ -%-from-name.h: %-from-name.gperf +$(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 <$< >$@ -$(outdir)/%: sysctl.d/%.in - $(SED_PROCESS) +ifeq ($(sd.sed_files),) +EXTRA_DIST ?= +sd.sed_files += $(notdir $(patsubst %.in,%,$(filter %.in,$(EXTRA_DIST)))) +endif +ifneq ($(sd.sed_files),) +$(addprefix $(outdir)/,$(sd.sed_files)): $(outdir)/%: $(srcdir)/%.in + $(sd.SED_PROCESS) +endif -%.sh: %.sh.in - $(SED_PROCESS) - $(AM_V_GEN)chmod +x $@ +#$(outdir)/%.sh: $(srcdir)/%.sh.in +# $(SED_PROCESS) +# $(AM_V_GEN)chmod +x $@ -$(outdir)/%.c: src/%.gperf +$(outdir)/%.c: $(srcdir)/%.gperf + $(AM_V_GPERF)$(GPERF) < $< > $@ +$(outdir)/%.c: $(outdir)/%.gperf $(AM_V_GPERF)$(GPERF) < $< > $@ -$(outdir)/%: src/%.m4 $(top_builddir)/config.status +$(addprefix $(outdir)/,_bogus_m4 $(patsubst %.m4,%,$(filter %.m4,$(files.src)))): $(outdir)/%: $(srcdir)/%.m4 $(top_builddir)/config.status + $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@ +$(addprefix $(outdir)/,_bogus_m4_in $(patsubst %.m4.in,%,$(filter %.m4.in,$(files.src)))): $(outdir)/%: $(outdir)/%.m4 $(top_builddir)/config.status $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@ - -# Stupid test that everything purported to be exported really is -define generate-sym-test - $(AM_V_at)printf '#include <stdio.h>\n' > $@ - $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@ - $(AM_V_at)printf 'void* functions[] = {\n' >> $@ - $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@ - $(AM_V_at)printf '};\nint main(void) {\n' >> $@ - $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@ - $(AM_V_at)printf 'return 0; }\n' >> $@ -endef - - -include $(topsrcdir)/build-aux/Makefile.tail.mk 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..825e0b8c78 --- /dev/null +++ b/build-aux/Makefile.each.tail/60-am.mk @@ -0,0 +1,12 @@ +$(file >$(outdir)/.am.0.mk,$(_am.pass0)) +include $(outdir)/.am.0.mk +$(file >$(outdir)/.am.1.mk,$(_am.pass1)) +include $(outdir)/.am.1.mk +$(file >$(outdir)/.am.2.mk,$(_am.pass2)) +include $(outdir)/.am.2.mk +$(file >$(outdir)/.am.3.mk,$(_am.pass3)) +include $(outdir)/.am.3.mk +$(file >$(outdir)/.am.4.mk,$(_am.pass4)) +include $(outdir)/.am.4.mk +$(file >$(outdir)/.am.5.mk,$(_am.pass5)) +include $(outdir)/.am.5.mk diff --git a/build-aux/Makefile.each.tail/70-sdcompletion.mk b/build-aux/Makefile.each.tail/70-sdcompletion.mk new file mode 100644 index 0000000000..99677c9407 --- /dev/null +++ b/build-aux/Makefile.each.tail/70-sdcompletion.mk @@ -0,0 +1,23 @@ +mod.sdcompletion.description = (systemd) shell completion +mod.sdcompletion.depends += am +define mod.sdcompletion.doc +# Inputs: +# - Directory variable : `rootbin_PROGRAMS` +# - Directory variable : `bin_PROGRAMS` +# - Directory variable : `dist_bin_SCRIPTS` +# - Directory variable : `bashcompletion_DATA` +# - Directory variable : `zshcompletion_DATA` +# Outputs: +# - Directory variable : `dist_bashcompletion_DATA` +# - Directory variable : `dist_zshcompletion_DATA` +endef +mod.sdcompletion.doc := $(value mod.sdcompletion.doc) + +rootbin_PROGRAMS ?= +bin_PROGRAMS ?= +dist_bin_SCRIPTS ?= +bashcompletion_DATA ?= +zshcompletion_DATA ?= +# We use `dist_` to trick `am` into not putting it in `am.out_DATA` +dist_bashcompletion_DATA := $(sort $(bashcompletion_DATA) $(rootbin_PROGRAMS) $(bin_PROGRAMS) $(dist_bin_SCRIPTS)) +dist_zshcompletion_DATA := $(sort $(zshcompletion_DATA) $(addprefix _,$(notdir $(rootbin_PROGRAMS) $(bin_PROGRAMS) $(dist_bin_SCRIPTS)))) diff --git a/build-aux/Makefile.each.tail/70-sdman.mk b/build-aux/Makefile.each.tail/70-sdman.mk index 2e7e0d4e39..ccbb1bd4e1 100644 --- a/build-aux/Makefile.each.tail/70-sdman.mk +++ b/build-aux/Makefile.each.tail/70-sdman.mk @@ -20,103 +20,54 @@ # # 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 +_sdman.man_xml = $(foreach _sdman.tmp,$(filter %.xml,$(files.src.src)),$(if $(findstring /,$(_sdman.tmp)),,$(_sdman.tmp))) -MANPAGES = -MANPAGES_ALIAS = +ifneq ($(_sdman.man_xml),) -include Makefile-man.am +$(srcdir)/Makefile-man.mk: $(topsrcdir)/tools/make-man-rules.py $(topsrcdir)/tools/xml_helper.py $(topsrcdir)/man/custom-entities.ent.in $(outdir)/.var._sdman.man_xml $(call at.addprefix,$(srcdir),$(_sdman.man_xml)) + $(AM_V_GEN)$(PYTHON) $< $(filter %.xml,$^) | $(WRITE_ATOMIC) $@ +files.src.gen += Makefile-man.mk -.PHONY: man update-man-list -man: $(MANPAGES) $(MANPAGES_ALIAS) $(HTML_FILES) $(HTML_ALIAS) +sdman.MANPAGES = +sdman.MANPAGES_ALIAS = +#-include $(srcdir)/Makefile-man.mk -XML_FILES = \ - ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}} -HTML_FILES = \ - ${XML_FILES:.xml=.html} -HTML_ALIAS = \ - ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(MANPAGES_ALIAS)}}}}} +_sdman.XML_FILES = \ + ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(sdman.MANPAGES)}}}}} +_sdman.HTML_FILES = \ + ${_sdman.XML_FILES:.xml=.html} +_sdman.HTML_ALIAS = \ + ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(sdman.MANPAGES_ALIAS)}}}}} ifneq ($(ENABLE_MANPAGES),) man_MANS = \ - $(MANPAGES) \ - $(MANPAGES_ALIAS) + $(sdman.MANPAGES) \ + $(sdman.MANPAGES_ALIAS) noinst_DATA += \ - $(HTML_FILES) \ - $(HTML_ALIAS) \ - docs/html/man + $(_sdman.HTML_FILES) \ + $(_sdman.HTML_ALIAS) endif # ENABLE_MANPAGES -CLEANFILES += \ - $(man_MANS) \ - $(HTML_FILES) \ - $(HTML_ALIAS) \ - docs/html/man +at.subdirs += $(abspath $(topoutdir)/man) -$(outdir)/man: - $(AM_V_LN)$(LN_S) -f ../../man $@ +$(outdir)/%.1: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent + $(_sdman.XSLTPROC_PROCESS_MAN) -$(outdir)/index.html: man/systemd.index.html - $(AM_V_LN)$(LN_S) -f systemd.index.html $@ +$(outdir)/%.3: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent + $(_sdman.XSLTPROC_PROCESS_MAN) -ifneq ($(HAVE_PYTHON),) -noinst_DATA += \ - man/index.html -endif # HAVE_PYTHON - -CLEANFILES += \ - man/index.html - -XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml) -NON_INDEX_XML_FILES = $(filter-out man/systemd.index.xml,$(XML_FILES)) -SOURCE_XML_FILES = ${patsubst %,$(top_srcdir)/%,$(filter-out man/systemd.directives.xml,$(NON_INDEX_XML_FILES))} - -# This target should only be run manually. It recreates Makefile-man.am -# file in the source directory based on all man/*.xml files. Run it after -# adding, removing, or changing the conditional in a man page. -update-man-list: $(top_srcdir)/tools/make-man-rules.py $(XML_GLOB) man/custom-entities.ent - $(AM_V_GEN)$(PYTHON) $< $(XML_GLOB) > $(top_srcdir)/Makefile-man.tmp - $(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am - @echo "Makefile-man.am has been regenerated" - -$(outdir)/systemd.index.xml: $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES) - $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^) - -$(outdir)/systemd.directives.xml: $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES) - $(AM_V_GEN)$(PYTHON) $< $@ $(SOURCE_XML_FILES) - -CLEANFILES += \ - man/systemd.index.xml \ - man/systemd.directives.xml - -EXTRA_DIST += \ - $(filter-out man/systemd.directives.xml man/systemd.index.xml,$(XML_FILES)) \ - tools/make-man-index.py \ - tools/make-man-rules.py \ - tools/make-directive-index.py \ - tools/xml_helper.py \ - man/glib-event-glue.c - -$(outdir)/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent - $(XSLTPROC_PROCESS_MAN) - -$(outdir)/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent - $(XSLTPROC_PROCESS_MAN) - -$(outdir)/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent - $(XSLTPROC_PROCESS_MAN) - -$(outdir)/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent - $(XSLTPROC_PROCESS_MAN) +$(outdir)/%.5: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent + $(_sdman.XSLTPROC_PROCESS_MAN) -$(outdir)/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent - $(XSLTPROC_PROCESS_MAN) +$(outdir)/%.7: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent + $(_sdman.XSLTPROC_PROCESS_MAN) -$(outdir)/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent - $(XSLTPROC_PROCESS_HTML) +$(outdir)/%.8: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent + $(_sdman.XSLTPROC_PROCESS_MAN) +$(outdir)/%.html: $(srcdir)/%.xml $(topsrcdir)/man/custom-html.xsl $(topoutdir)/man/custom-entities.ent + $(_sdman.XSLTPROC_PROCESS_HTML) -include $(topsrcdir)/build-aux/Makefile.tail.mk +endif # _sdman.man_xml diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk new file mode 100644 index 0000000000..6ac3d49f9f --- /dev/null +++ b/build-aux/Makefile.head.mk @@ -0,0 +1,116 @@ +# Copyright (C) 2015-2017 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/>. + +at.Makefile ?= Makefile +_at.MAKEFILE_LIST ?= +_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(lastword $(filter %/$(at.Makefile),$(abspath $(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 %/.,%,$(patsubst $(abspath $1)/%,%,$(abspath $2)/.)), \ + $(abspath $2))) +_at.relto = $(strip \ + $(if $(call _at.is_subdir,$1,$2), \ + $(patsubst %/.,%,$(patsubst $(abspath $1)/%,%,$(abspath $2)/.)), \ + ../$(call _at.relto,$(dir $(abspath $1)),$2))) + +# These 3 functions only take one operand; we define public multi-operand +# versions below. +_at.path = $(strip $(or \ + $(if $(call _at.is_subdir, . ,$1), $(call _at.relto, . ,$1) ), \ + $(if $(call _at.is_subdir,$(topoutdir),$1),$(patsubst %/.,%,$(topoutdir)/$(call _at.relto,$(topoutdir),$1))), \ + $(if $(call _at.is_subdir,$(topsrcdir),$1),$(patsubst %/.,%,$(topsrcdir)/$(call _at.relto,$(topsrcdir),$1))), \ + $(abspath $1))) +_at.out2src = $(call _at.path,$(strip \ + $(if $(call _at.is_subdir,$(topoutdir),$1), \ + $(topsrcdir)/$(call _at.relto,$(topoutdir),$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) + +_at.target_variable = $(_at.target_variable.$(flavor $2)) +_at.target_variable.recursive = $1: private $2 = $(subst $(at.nl),$$(at.nl),$(value $2)) +_at.target_variable.simple = $1: private $2 := $$($2) + +_at.quote-pattern = $(subst %,\%,$(subst \,\\,$1)) + +# Sanity checking ###################################################### +ifeq ($(filter undefine,$(.FEATURES)),) +$(error Autothing: We need a version of Make that supports 'undefine') +endif +ifeq ($(topsrcdir),) +$(error Autothing: topsrcdir must be set (and non-empty) before including Makefile.head.mk) +endif +ifeq ($(topoutdir),) +$(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 + +# External provisions ################################################## + +# 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 + +# 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 + +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 + +srcdir := $(call _at.out2src,$(outdir)) +ifeq ($(call _at.is_subdir,$(topsrcdir),$(srcdir)),) +$(error Autothing: not a subdirectory of topsrcdir=$(topsrcdir): $(srcdir)) +endif + +at.subdirs = +at.targets = + +include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.head/*.mk)) 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..94bc943b60 --- /dev/null +++ b/build-aux/Makefile.once.head/00-quote.mk @@ -0,0 +1,49 @@ +# 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 +define mod.quote.doc +# Inputs: +# (none) +# Outputs: +# - Global variable: `quote.var` : GNU Make variables +# - Global variable: `quote.pattern` : GNU Make patterns +# - Global variable: `quote.ere` : POSIX Extended Regular Expressions +# - Global variable: `quote.bre` : POSIX Basic Regular Expressions +# - Global variable: `quote.shell` : POSIX sh(1) strings +# - Global variable: `quote.shell-each`: POSIX sh(1) strings +# +# Escaping/quoting things is hard! This module provides a number of +# functions to escape/quote strings for various contexts. +# +# `quote.shell-each` quotes each list-item separately (munging +# whitespace), while `quote.shell` keeps them as one string (preserving +# whitespace). +endef +mod.quote.doc := $(value mod.quote.doc) + +_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..7c9e6ffe55 --- /dev/null +++ b/build-aux/Makefile.once.head/00-var.mk @@ -0,0 +1,36 @@ +# Copyright (C) 2016-2017 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 +define mod.var.doc +# Inputs: +# (user-defined) +# Outputs: +# Target : `$(outdir)/.var.%` +# Directory variable: `at.targets` +# Directory variable: `var.` +# +# It's a well-known secret that many files generated by a Makefile vary with +# the values of particular variables, but that GNU Make can't track these +# dependencies. Well, with some cleverness, it actually can! +# +# With this module, to depend on the value of a variable, depend on +# `$(outdir)/.var.VARNAME`, or `$(var.)VARNAME` for short. +endef +mod.var.doc := $(value mod.var.doc) + +var. = $(patsubst ./%,%,$(outdir)/.var.) + +.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..3621195c0d --- /dev/null +++ b/build-aux/Makefile.once.head/10-dist.mk @@ -0,0 +1,85 @@ +# Copyright (C) 2015-2017 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 to create distribution tarballs +define mod.dist.doc +# User variables: +# - `CP ?= cp` +# - `GZIP ?= gzip` +# - `MKDIR ?= mkdir` +# - `MKDIR_P ?= mkdir -p` +# - `MV ?= mv` +# - `RM ?= rm -f` +# - `TAR ?= tar` +# - `GZIPFLAGS ?= $(GZIP_ENV)` +# - `GZIP_ENV ?= --best` (only used via `GZIPFLAGS`, not directly) +# Inputs: +# - Global variable : `dist.exts` (Default: `.tar.gz`) +# - Global variable : `dist.pkgname` (Default: first of PACKAGE_TARNAME PACKAGE PACKAGE_NAME) +# - Global variable : `dist.version` (Default: first of PACKAGE_VERSION VERSION) +# - Directory variable : `files.src` +# Outputs: +# - Directory variable : `files.out.int` (only in top dir) +# - .PHONY Target : `$(outdir)/dist` +# - Target : `$(topoutdir)/$(dist.pkgname)-$(dist.version)` +# - Target : `$(topoutdir)/$(dist.pkgname)-$(dist.version).tar` +# - Target : `$(topoutdir)/$(dist.pkgname)-$(dist.version).tar.gz` +# +# Provide the standard `dist` .PHONY target, based on the `files` module +# information. +# +# You may change the default compression target easily via the +# `dist.exts` variable, but you must define the rule for it manually. +# +# Bugs: +# +# The tarball isn't reproducible. It uses file-system ordering of +# files, and includes timestamps. +endef +mod.dist.doc := $(value mod.dist.doc) + +PACKAGE_TARNAME ?= +PACKAGE ?= +PACKAGE_NAME ?= +PACKAGE_VERSION ?= +VERSION ?= + +# 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..55c41cb9b9 --- /dev/null +++ b/build-aux/Makefile.once.head/10-files.mk @@ -0,0 +1,100 @@ +# Copyright (C) 2015-2017 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 +define mod.files.doc +# User variables: +# - `DESTDIR ?=` +# - `RM ?= rm -f` +# - `RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty` +# - `TRUE ?= true` +# Inputs: +# - Global variable : `files.groups ?= all` +# - Global variable : `files.default ?= all` +# - Global variable : `files.vcsclean ?= files.vcsclean` +# - Global variable : `files.generate ?= files.generate` +# - Directory variable : `files.src.src` # Sources +# - Directory variable : `files.src.int` # Intermediates; deletable +# - Directory variable : `files.src.cfg` # Outputs needed to run ./configure +# - Directory variable : `files.src.gen` # Other outputs +# - Directory variable : `files.out.slow` # Things to exclude from `make mostlyclean` +# - Directory variable : `files.out.int` # Intermediates +# - Directory variable : `files.out.cfg` # Outputs created by ./configure +# - Directory variable : `files.out.$(group)` for `group` in `$(files.groups)` +# - Directory variable : `files.sys.$(group)` for `group` in `$(files.groups)` +# Outputs: +# - Global variable : `nested.targets` +# - Global variable : `at.targets` +# - Global variable : `.DEFAULT_GOAL = $(files.default)` +# - Directory variable : `files.src` +# - Directory variable : `files.out` +# - Directory variable : `files.sys` +# - Creative .PHONY targets: +# - `$(outdir)/$(files.generate)` +# - `$(outdir)/$(group)` for `group` in `$(files.groups)` +# - `$(outdir)/install` +# - `$(outdir)/install-$(group)` for `group` in `$(filter-out $(files.default),$(files.groups))` +# - `$(outdir)/installdirs` +# - Destructive .PHONY targets: +# - `$(outdir)/uninstall` +# - `$(outdir)/mostlyclean` +# - `$(outdir)/clean` +# - `$(outdir)/distclean` +# - `$(outdir)/maintainer-clean` +# - `$(outdir)/$(files.vcsclean)` +# +# Basic `*` wildcards are supported. Use `*`, not `%`; it will automatically +# substitute `*`->`%` where appropriate. +# +# Each of the destructive targets depends on `$(target)-hook`, which +# is defined to be a "double-colon rule" allowing you to add your own +# code. +# +# TODO: prose documentation +endef +mod.files.doc := $(value mod.files.doc) + +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 $(files.vcsclean) + +# User configuration + +DESTDIR ?= + +RM ?= rm -f +RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty +TRUE ?= true + +# Utility functions + +_files.XARGS = $(if $(strip $2),$(subst {},$(strip $2),$1)) + +_files.maintainer-clean-warning: + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' +.PHONY: _files.maintainer-clean-warning diff --git a/build-aux/Makefile.once.head/10-gitfiles.mk b/build-aux/Makefile.once.head/10-gitfiles.mk new file mode 100644 index 0000000000..8566a7f5e9 --- /dev/null +++ b/build-aux/Makefile.once.head/10-gitfiles.mk @@ -0,0 +1,75 @@ +# Copyright (C) 2016-2017 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 +mod.gitfiles.files += $(topsrcdir)/$(gitfiles.file) +define mod.gitfiles.doc +# Inputs: +# - Global variable : `gitfiles.file` (Default: gitfiles.mk) +# - Directory variable : `nested.subdirs` +# - External : git +# Outputs: +# - File : `$(topsrcdir)/$(gitfiles.file)` +# - Directory variable : `files.src.src` +# - Directory variable : `files.src.gen` (only in top dir) +# +# The `files` module has a variable (`files.src.src`) that you (the +# developer) set to list "pure" source files; the type of files that you +# would check into a version control system. Since you are a +# responsible developer, you use a version control system. Since the +# computer is already maintaining a list of these files *in the VCS*, +# why should you--a filthy human--need to also maintain the list? Enter +# gitfiles, which will talk to git to maintain `files.src.src`, but +# won't require that the git repository be distributed to +# installing-users. +# +# If `$(topsrcdir)/.git` exists, then it will generate +# `$(topsrcdir)/$(gitfiles.file)`. Otherwise, it will assume that +# `$(topsrcdir)/$(gitfiles.file)` already exists. +# +# It will use the information in `$(topsrcdir)/$(gitfiles.file)` to +# append to `files.src.src` in each directory +# +# Finally, since the generated `$(topsrcdir)/$(gitfiles.file)` must be +# distributed to users, it is added to $(topsrcdirs)'s `files.src.gen`. +# +# When setting `files.src.src`, it needs to know which files "belong" to +# the current directory directly, and which "belong" to a further +# subdirectory. To do this, it uses an expression involving +# `$(nested.subdirs)`. +# +# While gitfiles sets `files.src.src` very early in `each.head`, because +# `nested.subdirs` might not be set yet, it may or may not be safe to +# use the value of `$(files.src.src)` in your Makefile, depending on how +# you set `nested.subdirs`. +endef +mod.gitfiles.doc := $(value mod.gitfiles.doc) + +gitfiles.file ?= gitfiles.mk + +_gitfiles.all = +-include $(topsrcdir)/$(gitfiles.file) + +ifneq ($(wildcard $(topsrcdir)/.git),) +$(topsrcdir)/$(gitfiles.file): _gitfiles.FORCE + @(cd $(@D) && git ls-files --recurse-submodules -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.pat = $(patsubst ./%,%,$(_gitfiles.dir)/%) +_gitfiles.dir.all = $(patsubst $(_gitfiles.pat),%,$(filter $(_gitfiles.pat),$(_gitfiles.all))) +_gitfiles.dir.src = $(filter-out $(addsuffix /%,$(nested.subdirs)),$(_gitfiles.dir.all)) 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..87baa14a69 --- /dev/null +++ b/build-aux/Makefile.once.head/10-gnuconf.mk @@ -0,0 +1,205 @@ +# Copyright (C) 2016-2017 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.gnuconf.description = GNU standard configuration variables +define mod.gnuconf.doc +# Inputs: +# - Global variable: `gnuconf.pkgname` +# (Default: `$(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))`) +# Outputs: +# (see below) +# +# This module defines default values (using `?=`) a huge list of +# variables specified in the GNU Coding Standards that installing-users +# expect to be able to set. +# +# This is based on §7.2 "Makefile Conventions" of the July 25, 2016 +# release of the GNU Coding Standards. +endef +mod.gnuconf.doc := $(value mod.gnuconf.doc) + +PACKAGE_TARNAME ?= +PACKAGE ?= +PACKAGE_NAME ?= +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 + +CPPFLAGS ?= + +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..2ccfc2c459 --- /dev/null +++ b/build-aux/Makefile.once.head/10-lt.mk @@ -0,0 +1,57 @@ +mod.lt.description = (systemd) Easy handling of libtool dependencies +mod.lt.depends += files +define mod.lt.doc +# Inputs: +# - Global variable : `$(.LIBPATTERNS)` +# - Directory variable : `$(files.sys)` +# - Target variable : `$@` +# - Target variable : `$(@F)` +# - Target variable : `$^` +# Outputs: +# - Target variable : `lt.lib.rpath` (`$(@D)`, `$(files.sys)`) +# - Target variable : `lt.lib.files.all` (`$^`, `$(.LIBPATTERNS)`) +# - Target variable : `lt.lib.files.ld` (`$(lt.lib.rpath)`, `$(lt.lib.files.all)`) +# - Target variable : `lt.lib.post` (`$(lt.lib.rpath)`, `$(lt.lib.files.all)`) +# - Target variable : `lt.exe.files.all` (`$^`, `$(.LIBPATTERNS)`) +# - Target variable : `lt.exe.files.ld` (an alias for `lt.exe.files.all`) +# +# A set of variables to make interacting with libtool a little easier. +# +# libtool tries to abstract away the difference between static libraries +# and dynamic libraries. But, it does a crappy job. If one library +# depends on another library, you have to care about which of them are +# static and which are dynamic, or you'll either end up with missing +# symbols, or duplicate symbols. Either way, it will fail to link your +# executable. +# +# So, our workaround: don't pass any .la libraries to libtool/ld when +# linking a convenience library, but then run a post-libtool command to +# insert them into the .la file's dependency_libs. This uses the +# emptiness of lt.lib.rpath to determine if a library is a static +# convenience library or not. +endef +mod.lt.doc := $(value mod.lt.doc) + +_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) +# Usage: $(call _lt.dedup,ITEM1 ITEM2 ITEM3) +# Removes duplicate items while keeping the order the same (the leftmost of a duplicate is used). +_lt.dedup = $(if $1,$(if $(filter $(firstword $1),$(call _lt.rest,$1)),,$(firstword $1) )$(call _lt.dedup,$(call _lt.rest,$1))) +# Usage: $(call _lt.dependency_libs,LIB1.la OBJ.lo LIB2.la) +# => LIB1.la LIB1.la:dependency_libs OBJ.lo LIB2.la LIB2.la:dependency_libs +# Insert a .la library's dependency_libs after the library itself in the list. +_lt.dependency_libs = $(foreach _lt.tmp,$1,$(_lt.tmp)$(if $(filter %.la,$(_lt.tmp)), $(shell . $(_lt.tmp); echo $$dependency_libs))) + + lt.lib.rpath = $(patsubst %/,%,$(dir $(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..d903d53cd4 --- /dev/null +++ b/build-aux/Makefile.once.head/10-nested.mk @@ -0,0 +1,46 @@ +# Copyright (C) 2016-2017 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 +define mod.nested.doc +# Inputs: +# - Global variable : `nested.targets` +# - Directory variable : `nested.subdirs` +# Outputs: +# - .PHONY Targets : `$(addprefix $(outdir)/,$(nested.targets))` +# - Variable : `at.subdirs` +# - Variable : `at.targets` +# +# The Autothing `at.subdirs` slates a subdirectory's Makefile for inclusion, +# but doesn't help with recursive targets like `all`, `install`, or `clean`, +# which one would expect to descend into subdirectories. Enter `nested`: +# Define a global list of targets that are recursive/nested, and then in each +# directory define a list of subdirectries that one would expect them to +# recurse into. +# +# Directories added to `nested.subdirs` are automatically added to `at.subdirs` +# during the each.tail phase. +# +# It may help to think of at.subdirs and nested.subdirs in terms of their +# Automake conterparts: +# +# | Autothing | GNU Automake | +# +----------------+--------------+ +# | at.subdirs | DIST_SUBDIRS | +# | nested.subdirs | SUBDIRS | +endef +mod.nested.doc := $(value mod.nested.doc) + +nested.targets ?= diff --git a/build-aux/Makefile.once.head/10-texinfo.mk b/build-aux/Makefile.once.head/10-texinfo.mk new file mode 100644 index 0000000000..d24852d8eb --- /dev/null +++ b/build-aux/Makefile.once.head/10-texinfo.mk @@ -0,0 +1,47 @@ +# Copyright (C) 2016-2017 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.texinfo.description = The GNU documentation system +mod.texinfo.depends += files nested gnuconf +define mod.texinfo.doc +# User variables (in addition to gnuconf): +# - `TEXI2HTML ?= makeinfo --html` +# - `TEXI2PDF ?= texi2pdf` +# - `TEXI2PS ?= texi2dvi --ps` +# Inputs: +# - Directory variable : `texinfo.docs ?=` +# Outputs: +# - Global variable : `files.groups += html dvi pdf ps` +# - Global variable : `nested.targets += info` +# - Directory variable : `files.src.gen` +# - Directory variable : `files.out.{dvi,html,pdf,ps}` +# - Directory variable : `files.sys.{dvi,html,pdf,ps,all}` +# - .PHONY target : `$(outdir)/info` +# - Target : `$(outdir)/%.info` +# - Target : `$(outdir)/%.dvi` +# - target : `$(outdir)/%.html` +# - target : `$(outdir)/%.pdf` +# - Target : `$(outdir)/%.ps` +# +# TODO: prose documentation +endef +mod.texinfo.doc := $(value mod.texinfo.doc) + +TEXI2HTML ?= makeinfo --html +TEXI2PDF ?= texi2pdf +TEXI2PS ?= texi2dvi --ps + +files.groups += html dvi pdf ps +nested.targets += info 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..c4aa808c61 --- /dev/null +++ b/build-aux/Makefile.once.head/10-write-atomic.mk @@ -0,0 +1,23 @@ +mod.write-atomic.description = `write-atomic` auxiliary build script +mod.write-atomic.files += $(topsrcdir)/build-aux/write-atomic +define mod.write-atomic.doc +# User variables: +# - `WRITE_ATOMIC ?= $(topsrcdir)/build-aux/write-atomic` +# Inputs: +# (none) +# Outputs: +# (none) +# +# The $(WRITE_ATOMIC) program reads a file from stdin, and writes it to +# the file named in argv[1], but does so atomically. +# +# That is, the following lines are almost equivalient: +# +# ... > $@ +# ... | $(WRITE_ATOMIC) $@ +# +# The are only different in that one is atomic, while the other is not. +endef +mod.write-atomic.doc := $(value mod.write-atomic.doc) + +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..649aab9c12 --- /dev/null +++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk @@ -0,0 +1,23 @@ +mod.write-ifchanged.description = `write-ifchanged` auxiliary build script +mod.write-ifchanged.files += $(topsrcdir)/build-aux/write-ifchanged +define mod.write-ifchanged.doc +# User variables: +# - `WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged` +# Inputs: +# (none) +# Outputs: +# (none) +# +# The $(WRITE_IFCHANGED) program reads a file from stdin, and writes it to the +# file named in argv[1], but does so atomically, but more importantly, does so +# in a way that does not bump the file's ctime if the new content is the same +# as the old content. +# +# That is, the following lines are almost equivalient: +# +# ... > $@ +# ... | $(WRITE_ATOMIC) $@ +endef +mod.write-ifchanged.doc := $(value mod.write-ifchanged.doc) + +WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged diff --git a/build-aux/Makefile.once.head/20-amcfg.mk b/build-aux/Makefile.once.head/20-amcfg.mk new file mode 100644 index 0000000000..57d1561204 --- /dev/null +++ b/build-aux/Makefile.once.head/20-amcfg.mk @@ -0,0 +1,84 @@ +mod.amcfg.description = (systemd) Automake-to-Autothing configuration +mod.amcfg.depends += am +define mod.amcfg.doc +# User variables: +# - `V` +# - `AM_V_*` +# - `pamconfdir` +# - `tmpfilesdir` +# - `sysusersdir` +# - `sysctldir` +# - `bashcompletiondir` +# - `zshcompletiondir` +# - `LIBTOOL` +# - `INSTALL_PROGRAM` +# - `INSTALL_SCRIPT` +# - `INSTALL_DATA` +# Inputs: +# - Global variable: `sd.ALL_LIBTOOLFLAGS` +# Outputs: +# - Global variable: `am.sys2out_*` +# - Global variable: `am.INSTALL_*` +endef +mod.amcfg.doc := $(value mod.amcfg.doc) + +am.outpat_pamconf_DATA = %.pam + +am.outpat_tmpfiles_DATA = %.tmpfiles +am.syspat_tmpfiles_DATA = %.conf + +am.outpat_sysusers_DATA = %.sysusers +am.syspat_sysusers_DATA = %.conf + +am.outpat_sysctl_DATA = %.sysctl +am.syspat_sysctl_DATA = %.conf + +am.outpat_bashcompletion_DATA = %.completion.bash + +am.outpat_zshcompletion_DATA = %.completion.zsh +am.syspat_zshcompletion_DATA = _% + +am.outpat_xinitrc_SCRIPTS = %.xinitrc +am.syspat_xinitrc_SCRIPTS = %.sh + +am.outpat_include_HEADERS = $(abspath $(srcdir)/include)/%.h +am.syspat_include_HEADERS = %.h + +V ?= + +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 ?= + +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) $< $@ diff --git a/build-aux/Makefile.once.head/20-sd.mk b/build-aux/Makefile.once.head/20-sd.mk index 134c2c0ef1..4e44d2f7b3 100644 --- a/build-aux/Makefile.once.head/20-sd.mk +++ b/build-aux/Makefile.once.head/20-sd.mk @@ -20,81 +20,173 @@ # # 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 +define mod.sd.doc +# User variables: +# (flags) +# - `CFLAGS` +# - `CPPFLAGS` +# - `LDFLAGS` +# - `LIBTOOLFLAGS` +# (programs) +# - `CC` +# - `CCLD` +# - `LIBTOOL` +# - `MKDIR_P` +# - `SED` +# (verbosity) +# - `V` +# - `AM_V_*` +# - `INTLTOOL_V_MERGE*` +# (substitutions)$(foreach v,$(sort $(sd.substitution_keys)),$(at.nl)# - $v) +# Inputs: +# - Global variable : `DEPDIR` +# - Global variable : `ENABLE_TESTS` +# - Global variable : `ENABLE_UNSAFE_TESTS` +# - Global variable : `OUR_CFLAGS` +# - Global variable : `OUR_CPPFLAGS` +# - Global variable : `OUR_LDFLAGS` +# - Global variable : `OUR_LIBTOOLFLAGS` +# (Makefiles) +# - Directory variable : `sd.CFLAGS` +# - Directory variable : `sd.CPPFLAGS` +# - Directory variable : `sd.LDFLAGS` +# - Directory variable : `sd.LIBTOOLFLAGS` +# - Directory variable : `sd.sed_files` (default based on `EXTRA_DIST`) +# (am) +# - Directory variable : `EXTRA_DIST` +# - Directory variable : `am.out_PROGRAMS` +# - Directory variable : `am.CFLAGS` +# - Directory variable : `am.CPPFLAGS` +# - Target variable : `am.LDFLAGS` +# Outputs: +# - Global variable : `SHELL` +# - Make setting : `.DELETE_ON_ERROR` +# - Make setting : `.SECONDARY` +# - Global variable : `sd.substitutions` +# - Global variable : `sd.substitution_keys` +# - Global variable : `sd.sed_process` +# - Directory variable : `files.out.int` +# - Target variable : `sd.ALL_CFLAGS` +# - Target variable : `sd.ALL_CPPFLAGS` +# - Target variable : `sd.ALL_LDFLAGS` +# - Target variable : `sd.ALL_LIBTOLFLAGS` +# - Target variable : `sd.COMPILE` +# - Target variable : `sd.LTCOMPILE` +# - Target variable : `sd.LINK` +# - Target : `$$(outdir)/%.o` +# - Target : `$$(outdir)/%.lo` +# - Target : `$$(outdir)/$$(DEPDIR)` +# - Target : `$$(outdir)/%.la` +# - Target : `$$(addprefix $$(outdir)/,$$(am.out_PROGRAMS))` +# - Target : `$$(outdir)/test-lib%-sym.c` +# - Target : `$$(outdir)/%-from-name.gperf` +# - Target : `$$(outdir)/%-from-name.h` +# - Target : `$$(addprefix $$(outdir)/,$$(sd.sed_files))` +# - Target : `$$(outdir)/%.c: $$(srcdir)/%.gperf` +# - Target : `$$(outdir)/%: $$(srcdir)/%.m4` +# ???: +# - tests +# - unsafe_tests +# - TESTS -GCC_COLORS ?= 'ooh, shiny!' -export GCC_COLORS +endef -SUBDIRS = . po +tests ?= +unsafe_tests ?= +TESTS = $(if $(ENABLE_TESTS),$(tests) \ + $(if $(ENABLE_UNSAFE_TESTS),$(unsafe_tests))) -# remove targets if the command fails -.DELETE_ON_ERROR: +# Make behavior +SHELL = bash -o pipefail -# keep intermediate files +.DELETE_ON_ERROR: .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_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_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_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_RM ?= $(AM_V_RM_$(V)) +AM_V_RM_ ?= $(AM_V_RM_$(AM_DEFAULT_VERBOSITY)) +AM_V_RM_0 ?= @echo " RM " $@; +AM_V_RM_1 ?= + +AM_V_CC ?= $(AM_V_CC_$(V)) +AM_V_CC_ ?= $(AM_V_CC_$(AM_DEFAULT_VERBOSITY)) +AM_V_CC_0 ?= @echo " CC " $@; +AM_V_CC_1 ?= + +AM_V_CCLD ?= $(AM_V_CCLD_$(V)) +AM_V_CCLD_ ?= $(AM_V_CCLD_$(AM_DEFAULT_VERBOSITY)) +AM_V_CCLD_0 ?= @echo " CCLD " $@; +AM_V_CCLD_1 ?= + +AM_V_EFI_CC ?= $(AM_V_EFI_CC_$(V)) +AM_V_EFI_CC_ ?= $(AM_V_EFI_CC_$(AM_DEFAULT_VERBOSITY)) +AM_V_EFI_CC_0 ?= @echo " EFI_CC " $@; +AM_V_EFI_CC_1 ?= + +AM_V_EFI_CCLD ?= $(AM_V_EFI_CCLD_$(V)) +AM_V_EFI_CCLD_ ?= $(AM_V_EFI_CCLD_$(AM_DEFAULT_VERBOSITY)) +AM_V_EFI_CCLD_0 ?= @echo " EFI_CCLD" $@; +AM_V_EFI_CCLD_1 ?= + +AM_V_P ?= $(AM_V_P_$(V)) +AM_V_P_ ?= $(AM_V_P_$(AM_DEFAULT_VERBOSITY)) +AM_V_P_0 ?= false +AM_V_P_1 ?= : + +AM_V_GEN ?= $(AM_V_GEN_$(V)) +AM_V_GEN_ ?= $(AM_V_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN_0 ?= @echo " GEN " $@; +AM_V_GEN_1 ?= + +AM_V_lt ?= $(AM_V_lt_$(V)) +AM_V_lt_ ?= $(AM_V_lt_$(AM_DEFAULT_VERBOSITY)) +AM_V_lt_0 ?= --silent +AM_V_lt_1 ?= + +INTLTOOL_V_MERGE ?= $(INTLTOOL_V_MERGE_$(V)) +INTLTOOL_V_MERGE_OPTIONS ?= $(intltool_v_merge_options_$(V)) +INTLTOOL_V_MERGE_ ?= $(INTLTOOL_V_MERGE_$(AM_DEFAULT_VERBOSITY)) +INTLTOOL_V_MERGE_0 ?= @echo " ITMRG " $@; +INTLTOOL_V_MERGE_1 ?= + +sd.substitutions = \ '|rootlibexecdir=$(rootlibexecdir)|' \ '|rootbindir=$(rootbindir)|' \ '|bindir=$(bindir)|' \ @@ -156,10 +248,9 @@ 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)))) \ < $< > $@ - - -include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/build-aux/Makefile.once.head/20-sdman.mk b/build-aux/Makefile.once.head/20-sdman.mk index 3fb076febe..558c60531d 100644 --- a/build-aux/Makefile.once.head/20-sdman.mk +++ b/build-aux/Makefile.once.head/20-sdman.mk @@ -20,20 +20,59 @@ # # 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 -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 = +mod.sdman.description = (systemd) manpages +mod.sdman.depends += am files write-atomic +define mod.sdman.doc +# User variables: +# - `V` +# - `AM_V_LN*` +# - `AM_V_XSLT*` +# - `LN_S` +# - `XSLTPROC` +# Inputs: +# - Global variable : `ENABLE_MANPAGES` +# - Global variable : `VERSION` +# - Directory variable : `files.src.src` +# Outputs: +# - File : `$(srcdir)/Makefile-man.mk` +# - Directory variable : `at.subdirs` +# - Directory variable : `files.src.gen` +# - Directory variable : `man_MANS` +# - Directory variable : `noinst_DATA` (HTML) +# - Target : `$(outdir)/%.1` +# - Target : `$(outdir)/%.3` +# - Target : `$(outdir)/%.5` +# - Target : `$(outdir)/%.7` +# - Target : `$(outdir)/%.8` +# - Target : `$(outdir)/%.html` +# +# sdman -> Makefile-man.mk: +# - Global variable : `sdman.html-alias` +# Makefile-man.mk -> sdman: +# - Directory variable : `sdman.MANPAGES` +# - Directory variable : `sdman.MANPAGES_ALIAS` +# +# The `sdman.*` variables are the interface by which the module +# communicates with the genrated Makefile-man.mk file. They should not +# be used outside of the `sdman` module. +endef +mod.sdman.doc := $(value mod.sdman.doc) + +V ?= +LN_S ?= ln -s -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_LN ?= $(AM_V_LN_$(V)) +AM_V_LN_ ?= $(AM_V_LN_$(AM_DEFAULT_VERBOSITY)) +AM_V_LN_0 ?= @echo " LN " $@; +AM_V_LN_1 ?= -XSLTPROC_FLAGS = \ +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 ?= + +_sdman.XSLTPROC_FLAGS = \ --nonet \ --xinclude \ --stringparam man.output.quietly 1 \ @@ -41,18 +80,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 $< +_sdman.XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc) +_sdman.XSLTPROC_PROCESS_MAN = \ + $(AM_V_XSLT)$(_sdman.XSLT) -o $@ $(_sdman.XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $< -XSLTPROC_PROCESS_HTML = \ - $(AM_V_XSLT)$(XSLT) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $< +_sdman.XSLTPROC_PROCESS_HTML = \ + $(AM_V_XSLT)$(_sdman.XSLT) -o $@ $(_sdman.XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $< -define html-alias +sdman.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..d120e73ab8 --- /dev/null +++ b/build-aux/Makefile.once.head/30-am.mk @@ -0,0 +1,354 @@ +mod.am.description = (systemd) Automake-to-Autothing magic +mod.am.depends += gnuconf +define mod.am.doc +# Because many of the inputs/outpus are repetative, they are defined +# here in terms of $$(primary), which may be any of the supported +# Automake primaries (see below for a table). +# +# | Automake 1.15 primaries | +# +-------------------------+ +# | name | supported | +# +-------------+-----------+ +# | PROGRAMS | yes | +# | LIBRARIES | no | +# | LTLIBRARIES | yes | +# | LISP | no | +# | PYTHON | no | +# | JAVA | no | +# | SCRIPTS | yes | +# | DATA | yes | +# | HEADERS | yes | +# | MANS | yes | +# | TEXINFOS | no | +# +# Further, there is also $$(dirname), which could be anything; and is +# detected at runtime by inspecting $$(.VARIABLES) to find every possible +# matching value. See `_am.primary2dirs` for how this is done. +# +# Some inputs are "erased" after the pass they are used in. This means +# that they are `undefine`ed. +# +$(value _am.pass0.doc) +# +$(value _am.pass1.doc) +# +$(value _am.pass2.doc) +# +$(value _am.pass3.doc) +# +$(value _am.pass4.doc) +# +$(value _am.pass5.doc) +endef + +_am.primaries = +_am.primaries += PROGRAMS +#_am.primaries += LIBRARIES +_am.primaries += LTLIBRARIES +#_am.primaries += LISP +#_am.primaries += PYTHON +#_am.primaries += JAVA +_am.primaries += SCRIPTS +_am.primaries += DATA +_am.primaries += HEADERS +_am.primaries += MANS +#_am.primaries += TEXINFOS + +am.distmode_PROGRAMS = nodist +am.distmode_LTLIBRARIES = nodist +am.distmode_SCRIPTS = dist +am.distmode_DATA = nodist +am.distmode_HEADERS = dist +am.distmode_MANS = nodist + +# Used by the PROGRAMS and LTLIBRARIES passes +_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.pass0.doc +# == Pass 0: man_MANS == +# Erased inputs: +# - Directory variable: `man_MANS` +# Outputs: +# - Directory variable: `man$n_MANS` for $n in `{0..9} n l` +# +# Split man_MANS into man$n_MANS +endef +_am.pass0 = $(value _am.pass0_) +define _am.pass0_ +# == Pass 0: man_MANS == +man_MANS ?= +_am.man_MANS := $(man_MANS) +undefine man_MANS +man0_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .0,$(suffix $(_am.tmp))),$(_am.tmp))) +man1_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .1,$(suffix $(_am.tmp))),$(_am.tmp))) +man2_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .2,$(suffix $(_am.tmp))),$(_am.tmp))) +man3_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .3,$(suffix $(_am.tmp))),$(_am.tmp))) +man4_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .4,$(suffix $(_am.tmp))),$(_am.tmp))) +man5_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .5,$(suffix $(_am.tmp))),$(_am.tmp))) +man6_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .6,$(suffix $(_am.tmp))),$(_am.tmp))) +man7_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .7,$(suffix $(_am.tmp))),$(_am.tmp))) +man8_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .8,$(suffix $(_am.tmp))),$(_am.tmp))) +man9_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .9,$(suffix $(_am.tmp))),$(_am.tmp))) +manl_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .l,$(suffix $(_am.tmp))),$(_am.tmp))) +mann_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .n,$(suffix $(_am.tmp))),$(_am.tmp))) +endef + +define _am.pass1.doc +# == Pass 1: initialize variables == +# Inputs: (used to detect a list of $(dirname)s) +# - Directory variable : `$(dirname)_$(primary)` +# - Directory variable : `nodist_$(dirname)_$(primary)` +# - Directory variable : `dist_$(dirname)_$(primary)` +# Outputs: +# - Directory variable : `noinst_$(primary) ?=` +# - Directory variable : `check_$(primary) ?=` +# - Directory variable : ` $(dirname)_$(primary) ?=` +# - Directory variable : ` dist_$(dirname)_$(primary) ?=` +# - Directory variable : `nodist_$(dirname)_$(primary) ?=` +# - Global variable : `am.outpat_$(dirname)_$(primary) ?= %` +# - Global variable : `am.syspat_$(dirname)_$(primary) ?= %` +# +# Make sure that several variabes are initialized +endef + +# Utility (reused in pass 2) +_am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\ + $(patsubst nodist_%,%,$(patsubst dist_%,%,$(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES)))))) + +define _am.pass1 +# == Pass 1: initialize variables == +$(foreach _am.primary,$(_am.primaries), + $(foreach _am.dirname,$(call _am.primary2dirs,$(_am.primary)), + am.outpat_$(_am.dirname)_$(_am.primary) ?= % + am.syspat_$(_am.dirname)_$(_am.primary) ?= %)) +endef + +define _am.pass2.doc +# == Pass 2: Uniform Naming Scheme == +# Inputs: +# - Global variable : `NORMAL_INSTALL` +# - Global variable : `MKDIR_P` +# - Global variable : `am.INSTALL_$(primary)` +# - Global variable : `am.outpat_$(dirname)_$(primary)` +# - Global variable : `am.syspat_$(dirname)_$(primary)` +# - Global variable : `am.distmode_$(primary)` +# - Global variable : `$(dirname)dir` +# Erased inputs: +# - Directory variable : `noinst_$(primary)` +# - Directory variable : `check_$(primary)` +# +# - Directory variable : `$(dirname)_$(primary)` +# - Directory variable : `dist_$(dirname)_$(primary)` +# - Directory variable : `nodist_$(dirname)_$(primary)` +# Outputs: +# - Directory variable : `am.chk_$(primary)` +# - Directory variable : `am.out_$(primary)` +# - Directory variable : `am.sys_$(primary)` +# - Targets : `$(addprefix $(DESTDIR)$(dirname)/,$(notdir $({,dist_,nodist_}$(dirname)_$(primary))))` +# +# TODO +endef + +# Default values +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) $< $@ + +# Utility +_am.var_out = $(_am.dirname)_$(_am.primary) +_am.var_out += nodist_$(_am.dirname)_$(_am.primary) +#_am.var_out += noinst_$(_am.primary) +#_am.var_out += check_$(_am.primary) + +_am.var_sys = $(_am.dirname)_$(_am.primary) +_am.var_sys += nodist_$(_am.dirname)_$(_am.primary) +_am.var_sys += dist_$(_am.dirname)_$(_am.primary) + +define _am.pass2 +# == Pass 2: Uniform Naming Scheme == +$(foreach _am.primary,$(_am.primaries), + ## primary: $(_am.primary) + noinst_$(_am.primary) ?= + check_$(_am.primary) ?= + + am.chk_$(_am.primary) := $$(check_$(_am.primary)) + am.out_$(_am.primary) := $$(noinst_$(_am.primary)) + am.sys_$(_am.primary) := + + $(foreach _am.dirname,$(call _am.primary2dirs,$(_am.primary)), + ## dirname: $(_am.dirname) ($(_am.primary)) + $(_am.dirname)_$(_am.primary) ?= + dist_$(_am.dirname)_$(_am.primary) ?= + nodist_$(_am.dirname)_$(_am.primary) ?= + + $(am.distmode_$(_am.primary))_$(_am.dirname)_$(_am.primary) += $$($(_am.dirname)_$(_am.primary)) + + # nodist + $$(addprefix $$(DESTDIR)$$($(_am.dirname)dir)/,$$(notdir $$(nodist_$(_am.dirname)_$(_am.primary)) )): \ + $$(DESTDIR)$$($(_am.dirname)dir)/$(am.syspat_$(_am.dirname)_$(_am.primary)): $(call at.addprefix,$(outdir),$(am.outpat_$(_am.dirname)_$(_am.primary))) + @$$(NORMAL_INSTALL) + @$$(MKDIR_P) $$(@D) + $$(am.INSTALL_$(_am.primary)) + + # dist + $$(addprefix $$(DESTDIR)$$($(_am.dirname)dir)/,$$(notdir $$(dist_$(_am.dirname)_$(_am.primary)) )): \ + $$(DESTDIR)$$($(_am.dirname)dir)/$(am.syspat_$(_am.dirname)_$(_am.primary)): $(call at.addprefix,$(srcdir),$(am.outpat_$(_am.dirname)_$(_am.primary))) + @$$(NORMAL_INSTALL) + @$$(MKDIR_P) $$(@D) + $$(am.INSTALL_$(_am.primary)) + + am.out_$(_am.primary) := $$(patsubst $(am.syspat_$(_am.dirname)_$(_am.primary)),$(am.outpat_$(_am.dirname)_$(_am.primary)),$$(notdir $$(nodist_$(_am.dirname)_$(_am.primary)) )) + am.sys_$(_am.primary) := $$(addprefix $$($(_am.dirname)dir)/,$$(notdir $$(nodist_$(_am.dirname)_$(_am.primary)) $$(dist_$(_am.dirname)_$(_am.primary)) )) + + undefine $(_am.dirname)_$(_am.primary) + undefine dist_$(_am.dirname)_$(_am.primary) + undefine nodist_$(_am.dirname)_$(_am.primary) + ## (end dirname) + ) + + undefine noinst_$(_am.primary) + undefine check_$(_am.primary) + ## (end primary) +) +endef + +define _am.pass3.doc +# == Pass 3: PROGRAMS == +# Inputs: +# - Directory variable : `am.out_PROGRAMS` +# Erased inputs: +# - Directory variable : `$(program)_SOURCES` +# - Directory variable : `nodist_$(program)_SOURCES` +# - Directory variable : `$(program)_CFLAGS` +# - Directory variable : `$(program)_CPPFLAGS` +# - Directory variable : `$(program)_LDFLAGS` +# - Directory variable : `$(program)_LDADD` +# Outputs: +# - Directory variable : `am.CPPFLAGS` +# - Directory variable : `am.CFLAGS` +# - Target dependencies: `$(outdir)/$(program)` +# - Target variable : `$(outdir)/$(program): am.LDFLAGS` +# - Directory variable : `am.subdirs` +# +# TODO: I'm not in love with how it figures out `am.subdirs`. +# TODO: I'm not in love with how it does the `install` dependencies. +endef + +# Utility +_am.var_PROGRAMS = $(_am.var)_SOURCES +_am.var_PROGRAMS += nodist_$(_am.var)_SOURCES +_am.var_PROGRAMS += $(_am.var)_CFLAGS +_am.var_PROGRAMS += $(_am.var)_CPPFLAGS +_am.var_PROGRAMS += $(_am.var)_LDFLAGS +_am.var_PROGRAMS += $(_am.var)_LDADD + +define _am.pass3 +# == Pass 3: PROGRAMS == +$(foreach _am.file,$(am.out_PROGRAMS), + $(eval _am.var = $(call _am.file2var,$(_am.file))) + ## PROGRAM: $(_am.file) ($(_am.var)) + $(foreach var,_am.depends $(_am.var_PROGRAMS), + $(var) ?=) + + _am.depends += $$(call at.path,$$(call _am.file2.o,$(_am.file)) $$(call _am.file2lib,$(_am.file),LDADD)) + am.CPPFLAGS += $$($(_am.var)_CPPFLAGS) $$(call _am.file2cpp,$(_am.file),LDADD) + am.CFLAGS += $$($(_am.var)_CFLAGS) + $$(outdir)/$(_am.file): private am.LDFLAGS := $$($(_am.var)_LDFLAGS) + $$(outdir)/$(_am.file): $$(_am.depends) + $$(outdir)/install: $$(addsuffix install,$$(dir $$(filter %.la,$$(_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 $(_am.var_PROGRAMS), + undefine $(var))) +endef + +define _am.pass4.doc +# == Pass 4: LTLIBRARIES == +# Inputs: +# - Directory variable : `am.out_LTLIBRARIES` +# Erased inputs: +# - Directory variable : `$(library)_SOURCES` +# - Directory variable : `nodist_$(library)_SOURCES` +# - Directory variable : `$(library)_CFLAGS` +# - Directory variable : `$(library)_CPPFLAGS` +# - Directory variable : `$(library)_LDFLAGS` +# - Directory variable : `$(library)_LIBADD` +# Outputs: +# - Directory variable : `am.CPPFLAGS` +# - Directory variable : `am.CFLAGS` +# - Target dependencies: `$(outdir)/$(library)` +# - Target variable : `$(outdir)/$(library): am.LDFLAGS` +# - Directory variable : `am.subdirs` +# +# TODO: I'm not in love with how it figures out `am.subdirs`. +# TODO: I'm not in love with how it does the `install` dependencies. +endef + +# Utility +_am.var_LTLIBRARIES = $(_am.var)_SOURCES +_am.var_LTLIBRARIES += nodist_$(_am.var)_SOURCES +_am.var_LTLIBRARIES += $(_am.var)_CFLAGS +_am.var_LTLIBRARIES += $(_am.var)_CPPFLAGS +_am.var_LTLIBRARIES += $(_am.var)_LDFLAGS +_am.var_LTLIBRARIES += $(_am.var)_LIBADD + +define _am.pass4 +# == Pass 4: LTLIBRARIES == +$(foreach _am.file,$(am.out_LTLIBRARIES), + $(eval _am.var = $(call _am.file2var,$(_am.file))) + ## LTLIBRARY: $(_am.file) ($(_am.var)) + $(foreach var,_am.depends $(_am.var_LTLIBRARIES), + $(var) ?=) + + _am.depends += $$(call at.path,$$(call _am.file2.lo,$(_am.file)) $$(call _am.file2lib,$(_am.file),LIBADD)) + am.CPPFLAGS += $$($(_am.var)_CPPFLAGS) $$(call _am.file2cpp,$(_am.file),LIBADD) + am.CFLAGS += $$($(_am.var)_CFLAGS) + $$(outdir)/$(_am.file): private am.LDFLAGS := $$($(_am.var)_LDFLAGS) + $$(outdir)/$(_am.file): $$(_am.depends) + $$(outdir)/install: $$(addsuffix install,$$(dir $$(filter %.la,$$(_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 $(_am.var_LTLIBRARIES), + undefine $(var))) +endef + +mod.am.depends += files +define _am.pass5.doc +# == Pass 5: export == +# Inputs: +# - Directory variable : `am.subdirs` +# - Directory variable : `am.sys_$(primary)` +# - Directory variable : `am.out_$(primary)` +# - Directory variable : `am.check_$(primary)` +# Outputs: +# - Directory variable : `at.subdirs` +# - Directory variable : `files.sys.all` +# - Directory variable : `files.out.all` +# - Directory variable : `files.out.check` +endef +_am.pass5 = $(value _am.pass5_) +define _am.pass5_ +# == Pass 4: export == +at.subdirs += $(am.subdirs) +files.out.check += $(foreach p,$(_am.primaries),$(am.chk_$p)) +files.out.all += $(foreach p,$(_am.primaries),$(am.out_$p)) +files.sys.all += $(foreach p,$(_am.primaries),$(am.sys_$p)) +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..95d251d37c --- /dev/null +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -0,0 +1,59 @@ +# 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 +define mod.mod.doc +# Inputs: +# - Files : `$(topsrcdir)/build-aux/Makefile.*/??-*.mk` +# - Global variable : `mod.*.description` +# - Global variable : `mod.*.depends` +# - Global variable : `mod.*.files` +# - Global variable : `mod.*.doc` +# Outputs: +# - Directory variable : `at.targets` +# - .PHONY Target : `$(outdir)/at-variables-local` +# - .PHONY Target : `$(outdir)/at-variables-global` +# - .PHONY Target : `$(outdir)/at-variables` +# - .PHONY Target : `$(outdir)/at-variables/%` +# - .PHONY Target : `$(outdir)/at-values` +# - .PHONY Target : `$(outdir)/at-values/%` +# - .PHONY Target : `$(outdir)/at-modules` +# - .PHONY Target : `$(outdir)/at-modules/%` +# - .PHONY Target : `$(outdir)/at-noop` +# +# TODO: prose documentation +endef +mod.mod.doc := $(value mod.mod.doc) + +# 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)\ + mod.$(_mod.tmp).doc ?=$(at.nl))) diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk new file mode 100644 index 0000000000..59a7dc3c70 --- /dev/null +++ b/build-aux/Makefile.once.tail/00-dist.mk @@ -0,0 +1,31 @@ +# Copyright (C) 2015-2017 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/>. + +# NB: intentionally resolve symlinks (tack on the -P flag to `cp` to +# not resolve them). The GNU Coding Standards say to avoid symlinks +# in tarballs. +_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): $(_dist.files) + $(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) + +# TODO: The tar rule isn't reproducible, it should be. +$(topoutdir)/$(dist.pkgname)-$(dist.version).tar: %.tar: % + $(TAR) cf $@ -C $(<D) $(<F) +$(topoutdir)/$(dist.pkgname)-$(dist.version).tar.gz: %.gz: % + $(GZIP) $(GZIPFLAGS) < $< > $@ diff --git a/build-aux/Makefile.once.tail/10-sd.mk b/build-aux/Makefile.once.tail/10-sd.mk index 7df79c0364..596163d7a4 100644 --- a/build-aux/Makefile.once.tail/10-sd.mk +++ b/build-aux/Makefile.once.tail/10-sd.mk @@ -20,8 +20,24 @@ # # 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 + +_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 po/Makefile.in # AC_CONFIG_FILES +config_headers = config.h # AC_CONFIG_HEADERS +config_commands = 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 @@ -35,21 +51,21 @@ valgrind-tests: $(TESTS) x="\n\n"; \ done -exported-%: % - $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@ +# exported-%: % +# $(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 $^ > $@ +# 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 +# .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))) @@ -94,5 +110,3 @@ 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 - - -include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk new file mode 100644 index 0000000000..2e4adc611b --- /dev/null +++ b/build-aux/Makefile.tail.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/>. + +# This bit gets evaluated for each Makefile processed + +include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) + +_at.tmp_targets := $(at.targets) +_at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) + +# Clean the environment +$(eval \ + $(foreach _at.tmp_variable,$(filter-out $(call _at.quote-pattern,_at.tmp_variable $(_at.VARIABLES)),$(.VARIABLES)),\ + $(call _at.target_variable,$(_at.tmp_targets),$(_at.tmp_variable))$(at.nl)\ + undefine $(_at.tmp_variable)$(at.nl))) + +# Recurse +$(foreach _at.NO_ONCE,y,\ + $(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) + +include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk))) + +endif # _at.NO_ONCE diff --git a/build-aux/write-atomic b/build-aux/write-atomic new file mode 100755 index 0000000000..ab2a417c12 --- /dev/null +++ b/build-aux/write-atomic @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# 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/>. + +outfile=$1 +tmpfile="$(dirname "$outfile")/.tmp.${outfile##*/}.tmp" + +cat > "$tmpfile" || { r=$?; rm -f "$tmpfile"; exit $r; } +mv -f "$tmpfile" "$outfile" diff --git a/config.mk.in b/config.mk.in index 77283a78bf..3699a6a44a 100644 --- a/config.mk.in +++ b/config.mk.in @@ -6,7 +6,7 @@ # Copyright 2010-2012 Kay Sievers # Copyright 2013 Zbigniew Jędrzejewski-Szmek # Copyright 2013 David Strauss -# Copyright 2016 Luke Shumaker +# Copyright 2016-2017 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 @@ -20,8 +20,31 @@ # # 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 + +ifeq ($(origin topsrcdir),undefined) +topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) +topsrcdir := $(topoutdir)/@top_srcdir@ + +.LIBPATTERNS = lib%.so lib%.a + +CCLD = $(CC) + +OUR_CPPFLAGS = @OUR_CPPFLAGS@ +OUR_CFLAGS = @OUR_CFLAGS@ +OUR_LDFLAGS = @OUR_LDFLAGS@ +OUR_LIBTOOLFLAGS = + +AM_CPPFLAGS = +AM_CFLAGS = +AM_LDFLAGS = +AM_LIBTOOLFLAGS = + +EFI_CPPFLAGS = +EFI_CFLAGS = +EFI_LDFLAGS = + +SYSTEM_SYSVINIT_PATH = @SYSTEM_SYSVINIT_PATH@ +SYSTEM_SYSVRCND_PATH = @SYSTEM_SYSVRCND_PATH@ # Dirs of external packages dbuspolicydir=@dbuspolicydir@ @@ -73,6 +96,500 @@ bootlibdir = $(prefix)/lib/systemd/boot/efi rootprefix=@rootprefix@ rootbindir=$(rootprefix)/bin rootlibexecdir=$(rootprefix)/lib/systemd +rootlibdir=@rootlibdir@ + +# Libraries we provide +libsystemd.CPPFLAGS = -I$(topsrcdir)/src/libsystemd/include +libsystemd.DEPENDS = $(topoutdir)/src/libsystemd/libsystemd.la +libsystemd-internal.CPPFLAGS = -I$(topsrcdir)/src/libsystemd/src -I$(topoutdir)/src/libsystemd/src $(libsystemd.CPPFLAGS) $(libsystemd-staging.CPPFLAGS) $(libsystemd-basic.CPPFLAGS) +libsystemd-internal.DEPENDS = $(topoutdir)/src/libsystemd/src/libsystemd-internal.la +libsystemd-staging.CPPFLAGS = -I$(topsrcdir)/src/libsystemd/include-staging $(libsystemd.CPPFLAGS) +libsystemd-staging.DEPENDS = $(libsystemd-internal.DEPENDS) + +libsystemd-basic.CPPFLAGS = -I$(topsrcdir)/src/libsystemd-basic/include +libsystemd-basic.DEPENDS = $(topoutdir)/src/libsystemd-basic/src/libsystemd-basic.la +libsystemd-blkid.CPPFLAGS = -I$(topsrcdir)/src/libsystemd-blkid/include $(libsystemd-basic.CPPFLAGS) $(BLKID_CFLAGS) +libsystemd-blkid.DEPENDS = $(BLKID_LIBS) +libsystemd-firewall.CPPFLAGS = -I$(topsrcdir)/src/libsystemd-firewall/include $(libsystemd-basic.CPPFLAGS) +libsystemd-firewall.DEPENDS = $(topoutdir)/src/libsystemd-firewall/src/libsystemd-firewall.la +libsystemd-microhttpd.CPPFLAGS = -I$(topsrcdir)/src/grp-journal/grp-remote/libsystemd-microhttpd/include $(libsystemd-basic.CPPFLAGS) +libsystemd-microhttpd.DEPENDS = $(topoutdir)/src/grp-journal/grp-remote/libsystemd-microhttpd/src/libsystemd-microhttpd.la +libsystemd-gcrypt.CPPFLAGS = -I$(topsrcdir)/src/libsystemd-gcrypt/include +libsystemd-gcrypt.DEPENDS = $(topoutdir)/src/libsystemd-gcrypt/src/libsystemd-gcrypt.la +libsystemd-network.CPPFLAGS = -I$(topsrcdir)/src/libsystemd-network/include $(libsystemd-basic.CPPFLAGS) $(libsystemd-shared.CPPFLAGS) +libsystemd-network.DEPENDS = $(topoutdir)/src/libsystemd-network/src/libsystemd-network.la +libsystemd-shared.CPPFLAGS = -I$(topsrcdir)/src/libsystemd-shared/include $(libsystemd-basic.CPPFLAGS) $(libudev-internal.CPPFLAGS) +libsystemd-shared.DEPENDS = $(topoutdir)/src/libsystemd-shared/src/libsystemd-shared.la + +libudev.CPPFLAGS = -I$(topsrcdir)/src/libudev/include +libudev.DEPENDS = $(topoutdir)/src/libudev/libudev.la +libudev-internal.CPPFLAGS = -I$(topsrcdir)/src/libudev/src $(libudev.CPPFLAGS) $(libsystemd-basic.CPPFLAGS) $(libsystemd-staging.CPPFLAGS) +libudev-internal.DEPENDS = $(topoutdir)/src/libudev/src/libudev-internal.la + +# -core libs +libcore.CPPFLAGS = -I$(topsrcdir)/src/grp-system/libcore/include $(libsystemd-shared.CPPFLAGS) +libcore.DEPENDS = $(topoutdir)/src/grp-system/libcore/src/libcore.la +#libbus-proxy-core.CPPFLAGS = +#libbus-proxy-core.DEPENDS = +libjournal-core.CPPFLAGS = -I$(topsrcdir)/src/grp-journal/libjournal-core/include $(libsystemd-internal.CPPFLAGS) $(libsystemd-basic.CPPFLAGS) $(libsystemd-shared.CPPFLAGS) +libjournal-core.DEPENDS = $(topoutdir)/src/grp-journal/libjournal-core/src/libjournal-core.la +#liblogind-core.CPPFLAGS = +#liblogind-core.DEPENDS = +libmachine-core.CPPFLAGS = -I$(topsrcdir)/src/grp-machine/libmachine-core/include +libmachine-core.DEPENDS = $(topoutdir)/src/grp-machine/libmachine-core/src/libmachine-core.la +libnetworkd-core.CPPFLAGS = -I$(topsrcdir)/src/grp-network/libnetworkd-core $(libsystemd-internal.CPPFLAGS) $(libsystemd-network.CPPFLAGS) $(libsystemd-shared.CPPFLAGS) $(libudev-internal.CPPFLAGS) +libnetworkd-core.DEPENDS = $(topoutdir)/src/grp-network/libnetworkd-core/libnetworkd-core.la +libudev-core.CPPFLAGS = -I$(topoutdir)/src/grp-udev/libudev-core $(libsystemd-network.CPPFLAGS) $(libsystemd-shared.CPPFLAGS) +libudev-core.DEPENDS = $(topoutdir)/src/grp-udev/libudev-core/libudev-core.la +libbasic-dns.CPPFLAGS = -I$(topsrcdir)/src/grp-resolve/libbasic-dns/include +libbasic-dns.DEPENDS = $(topoutdir)/src/grp-resolve/libbasic-dns/src/libbasic-dns.la +libimport.CPPFLAGS = -I$(topsrcdir)/src/grp-machine/grp-import/libimport +libimport.DEPENDS = $(topoutdir)/src/grp-machine/grp-import/libimport/libimport.la +# NSS modules +libnss_myhostname.CPPFLAGS = +libnss_myhostname.DEPENDS = +libnss_mymachines.CPPFLAGS = +libnss_mymachines.DEPENDS = +libnss_resolve.CPPFLAGS = +libnss_resolve.DEPENDS = +libnss_systemd.CPPFLAGS = +libnss_systemd.DEPENDS = + +# Libraries we use +HAVE_ACL = @HAVE_ACL_TRUE@1 + ACL_CFLAGS =#HARDCODED + ACL_LIBS = @ACL_LIBS@ +HAVE_APPARMOR = @HAVE_APPARMOR_TRUE@1 + APPARMOR_CFLAGS = @APPARMOR_CFLAGS@ + APPARMOR_LIBS = @APPARMOR_LIBS@ +HAVE_AUDIT = @HAVE_AUDIT_TRUE@1 + AUDIT_CFLAGS =#HARDCODED + AUDIT_LIBS = @AUDIT_LIBS@ +HAVE_BLKID = @HAVE_BLKID_TRUE@1 + BLKID_CFLAGS = @BLKID_CFLAGS@ + BLKID_LIBS = @BLKID_LIBS@ +HAVE_BZIP2 = @HAVE_BZIP2_TRUE@1 + BZIP2_CFLAGS =#HARDCODED + BZIP2_LIBS = -lbz2#HARDCODED +HAVE_CAP = 1#HARDCODED + CAP_CFLAGS =#HARDCODED + CAP_LIBS = @CAP_LIBS@ +HAVE_DBUS = @HAVE_DBUS_TRUE@1 + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ +HAVE_ELFUTILS = @HAVE_ELFUTILS_TRUE@1 + ELFUTILS_CFLAGS =#HARDCODED + ELFUTILS_LIBS = @ELFUTILS_LIBS@ +HAVE_GCRYPT = @HAVE_GCRYPT_TRUE@1 + GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ + GCRYPT_LIBS = @GCRYPT_LIBS@ +HAVE_GNUTLS = @HAVE_GNUTLS_TRUE@1 + GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ + GNUTLS_LIBS = @GNUTLS_LIBS@ +HAVE_KMOD = @HAVE_KMOD_TRUE@1 + KMOD_CFLAGS = @KMOD_CFLAGS@ + KMOD_LIBS = @KMOD_LIBS@ +HAVE_LIBCRYPTSETUP = @HAVE_LIBCRYPTSETUP_TRUE@1 + LIBCRYPTSETUP_CFLAGS = @LIBCRYPTSETUP_CFLAGS@ + LIBCRYPTSETUP_LIBS = @LIBCRYPTSETUP_LIBS@ +HAVE_LIBCURL = @HAVE_LIBCURL_TRUE@1 + LIBCURL_CFLAGS = @LIBCURL_CFLAGS@ + LIBCURL_LIBS = @LIBCURL_LIBS@ +HAVE_LIBIDN = @HAVE_LIBIDN_TRUE@1 + LIBIDN_CFLAGS = @LIBIDN_CFLAGS@ + LIBIDN_LIBS = @LIBIDN_LIBS@ +HAVE_LIBIPTC = @HAVE_LIBIPTC_TRUE@1 + LIBIPTC_CFLAGS = @LIBIPTC_CFLAGS@ + LIBIPTC_LIBS = @LIBIPTC_LIBS@ +HAVE_LZ4 = @HAVE_LZ4_TRUE@1 + LZ4_CFLAGS = @LZ4_CFLAGS@ + LZ4_LIBS = @LZ4_LIBS@ +HAVE_MICROHTTPD = @HAVE_MICROHTTPD_TRUE@1 + MICROHTTPD_CFLAGS = @MICROHTTPD_CFLAGS@ + MICROHTTPD_LIBS = @MICROHTTPD_LIBS@ +HAVE_MOUNT = 1#HARDCODED + MOUNT_CFLAGS = @MOUNT_CFLAGS@ + MOUNT_LIBS = @MOUNT_LIBS@ +HAVE_PAM = @HAVE_PAM_TRUE@1 + PAM_CFLAGS =#HARDCODED + PAM_LIBS = @PAM_LIBS@ +HAVE_QRENCODE = @HAVE_QRENCODE_TRUE@1 + QRENCODE_CFLAGS = @QRENCODE_CFLAGS@ + QRENCODE_LIBS = @QRENCODE_LIBS@ +HAVE_SECCOMP = @HAVE_SECCOMP_TRUE@1 + SECCOMP_CFLAGS = @SECCOMP_CFLAGS@ + SECCOMP_LIBS = @SECCOMP_LIBS@ +HAVE_SELINUX = @HAVE_SELINUX_TRUE@1 + SELINUX_CFLAGS = @SELINUX_CFLAGS@ + SELINUX_LIBS = @SELINUX_LIBS@ +HAVE_XKBCOMMON = @HAVE_XKBCOMMON_TRUE@1 + XKBCOMMON_CFLAGS = @XKBCOMMON_CFLAGS@ + XKBCOMMON_LIBS = @XKBCOMMON_LIBS@ +HAVE_XZ = @HAVE_XZ_TRUE@1 + XZ_CFLAGS = @XZ_CFLAGS@ + XZ_LIBS = @XZ_LIBS@ +HAVE_ZLIB = @HAVE_ZLIB_TRUE@1 + ZLIB_CFLAGS = @ZLIB_CFLAGS@ + ZLIB_LIBS = @ZLIB_LIBS@ + +# Other stuff +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + +ARCH_AARCH64 = @ARCH_AARCH64_TRUE@1 +ARCH_IA32 = @ARCH_IA32_TRUE@1 +ARCH_X86_64 = @ARCH_X86_64_TRUE@1 + +DEFAULT_DNSSEC_MODE = @DEFAULT_DNSSEC_MODE@ +KILL_USER_PROCESSES = @KILL_USER_PROCESSES@ + +ENABLE_BACKLIGHT = @ENABLE_BACKLIGHT_TRUE@1 +ENABLE_BASH_COMPLETION = @ENABLE_BASH_COMPLETION_TRUE@1 +ENABLE_BINFMT = @ENABLE_BINFMT_TRUE@1 +ENABLE_BOOTCHART = @ENABLE_BOOTCHART_TRUE@1 +ENABLE_COMPAT_LIBS = @ENABLE_COMPAT_LIBS_TRUE@1 +ENABLE_COREDUMP = @ENABLE_COREDUMP_TRUE@1 +ENABLE_COVERAGE = @ENABLE_COVERAGE_TRUE@1 +ENABLE_EFI = @ENABLE_EFI_TRUE@1 +ENABLE_FIRSTBOOT = @ENABLE_FIRSTBOOT_TRUE@1 +ENABLE_HIBERNATE = @ENABLE_HIBERNATE_TRUE@1 +ENABLE_HOSTNAMED = @ENABLE_HOSTNAMED_TRUE@1 +ENABLE_HWDB = @ENABLE_HWDB_TRUE@1 +ENABLE_IMPORTD = @ENABLE_IMPORTD_TRUE@1 +ENABLE_LDCONFIG = @ENABLE_LDCONFIG_TRUE@1 +ENABLE_LOCALED = @ENABLE_LOCALED_TRUE@1 +ENABLE_LOGIND = @ENABLE_LOGIND_TRUE@1 +ENABLE_MACHINED = @ENABLE_MACHINED_TRUE@1 +ENABLE_MANPAGES = @ENABLE_MANPAGES_TRUE@1 +ENABLE_NETWORKD = @ENABLE_NETWORKD_TRUE@1 +ENABLE_PAM_CONFIG = @ENABLE_PAM_CONFIG@1 +ENABLE_POLKIT = @ENABLE_POLKIT_TRUE@1 +ENABLE_QUOTACHECK = @ENABLE_QUOTACHECK_TRUE@1 +ENABLE_RANDOMSEED = @ENABLE_RANDOMSEED_TRUE@1 +ENABLE_RESOLVED = @ENABLE_RESOLVED_TRUE@1 +ENABLE_RFKILL = @ENABLE_RFKILL_TRUE@1 +ENABLE_SPLIT_USR = @ENABLE_SPLIT_USR_TRUE@1 +ENABLE_SYSUSERS = @ENABLE_SYSUSERS_TRUE@1 +ENABLE_TESTS = @ENABLE_TESTS_TRUE@1 +ENABLE_UNSAFE_TESTS = @ENABLE_UNSAFE_TESTS_TRUE@1 +ENABLE_TIMEDATED = @ENABLE_TIMEDATED_TRUE@1 +ENABLE_TIMESYNCD = @ENABLE_TIMESYNCD_TRUE@1 +ENABLE_TMPFILES = @ENABLE_TMPFILES_TRUE@1 +ENABLE_VCONSOLE = @ENABLE_VCONSOLE_TRUE@1 +ENABLE_ZSH_COMPLETION = @ENABLE_ZSH_COMPLETION_TRUE@1 + +HAVE_COMPRESSION = @HAVE_COMPRESSION_TRUE@1 +HAVE_GNUEFI = @HAVE_GNUEFI_TRUE@1 +HAVE_MYHOSTNAME = @HAVE_MYHOSTNAME_TRUE@1 +HAVE_PYTHON = @HAVE_PYTHON_TRUE@1 +HAVE_REMOTE = @HAVE_REMOTE_TRUE@1 +HAVE_SMACK = @HAVE_SMACK_TRUE@1 +HAVE_SYSV_COMPAT = @HAVE_SYSV_COMPAT_TRUE@1 +HAVE_UTMP = @HAVE_UTMP_TRUE@1 + +LIBTOOLFLAGS = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ + +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +GMSGFMT = @GMSGFMT@ +KBD_LOADKEYS = @KBD_LOADKEYS@ +KBD_SETFONT = @KBD_SETFONT@ +KEXEC = @KEXEC@ +KILL = @KILL@ +KMOD = @KMOD@ +LD = @LD@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +QEMU = @QEMU@ +QUOTACHECK = @QUOTACHECK@ +QUOTAON = @QUOTAON@ +SETCAP = @SETCAP@ +SULOGIN = @SULOGIN@ +SUSHELL = @SUSHELL@ +UMOUNT_PATH = @UMOUNT_PATH@ +XSLTPROC = @XSLTPROC@ +MOUNT_PATH = @MOUNT_PATH@ + +AMTAR = @AMTAR@ +CCDEPMODE = @CCDEPMODE@ +CERTIFICATEROOT = @CERTIFICATEROOT@ +DEBUGTTY = @DEBUGTTY@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DNS_SERVERS = @DNS_SERVERS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +EFI_ARCH = @EFI_ARCH@ +EFI_CC = @EFI_CC@ +EFI_INC_DIR = @EFI_INC_DIR@ +EFI_LDS_DIR = @EFI_LDS_DIR@ +EFI_LIB_DIR = @EFI_LIB_DIR@ +EFI_MACHINE_TYPE_NAME = @EFI_MACHINE_TYPE_NAME@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +NMEDIT = @NMEDIT@ +NTP_SERVERS = @NTP_SERVERS@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ + +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +QEMU_BIOS = @QEMU_BIOS@ +RC_LOCAL_SCRIPT_PATH_START = @RC_LOCAL_SCRIPT_PATH_START@ +RC_LOCAL_SCRIPT_PATH_STOP = @RC_LOCAL_SCRIPT_PATH_STOP@ +SYSTEM_GID_MAX = @SYSTEM_GID_MAX@ +SYSTEM_UID_MAX = @SYSTEM_UID_MAX@ +TELINIT = @TELINIT@ +TTY_GID = @TTY_GID@ +USE_NLS = @USE_NLS@ + +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ + +top_builddir = $(topoutdir) +top_srcdir = $(topsrcdir) + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_URL = @PACKAGE_URL@ + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +CPP = @CPP@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +FGREP = @FGREP@# Requires AC_PROG_FGREP +GPERF = @GPERF@ +LIBTOOL = @LIBTOOL@ +M4 = @M4@ +M4_DEFINES = @M4_DEFINES@ +MKDIR_P = @MKDIR_P@# Requires AC_PROG_MKDIR_P +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +OBJCOPY = @OBJCOPY@ +OBJDUMP = @OBJDUMP@ +STRINGS = @STRINGS@ +STRIP = @STRIP@ +XGETTEXT = @XGETTEXT@ + +# This is based on §7.2 "Makefile Conventions" of the July 25, 2016 +# release of the GNU Coding Standards. +# +# Grep for '^##' in this file to see which Autoconf macros it depends +# on. + +dist.pkgname = @PACKAGE_TARNAME@ +gnuconf.pkgname = @PACKAGE_NAME@ + +# 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? + +## AC_PROG_AWK +## AC_PROG_GREP +## AC_PROG_EGREP +## AC_PROG_SED + +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. + +## AC_PROG_INSTALL # @INSTALL@ @INSTALL_PROGRAM@ @INSTALL_SCRIPT@ @INSTALL_DATA@ +## AC_PROG_LEX # @LEX@ @LEXLIB@ +## AC_PROG_RANLIB +## AC_PROG_YACC +## AC_PROG_CC +# +# TODO: What causes Autoconf to define @AR@? + +AR = @AR@ +ARFLAGS = +BISON = bison +BISONFLAGS = +CC = @CC@ +CFLAGS = @CFLAGS@ # CFLAGS instead of CCFLAGS +FLEX = flex +FLEXFLAGS = +INSTALL = @INSTALL@ +# There is no INSTALLFLAGS[0] +LD = ld +LDFLAGS = @LDFLAGS@ +LDCONFIG = ldconfig # TODO[1] +LDCONFIGFLAGS = +LEX = @LEX@ +LFLAGS = #LFLAGS instead of LEXFLAGS +#MAKE +MAKEINFO = makeinfo +MAKEINFOFLAGS = +RANLIB = @RANLIB@ +RANLIBFLAGS = +TEXI2DVI = texi2dvi +TEXI2DVIFLAGS = +YACC = @YACC@ +YFLAGS = # YFLAGS instead of YACCFLAGS + +CPPFLAGS = @CPPFLAGS@ + +LN_S = @LN_S@ + +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.) + +# 7.2.3: Variables for Specifying Commands +# ---------------------------------------- + +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +#INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_DATA = @INSTALL_DATA@ + +# 7.2.5: Variables for Installation Directories +# --------------------------------------------- + +# Root for the installation +prefix = @prefix@ +exec_prefix = @exec_prefix@ +# Executable programs +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +# Data files (Autoconf won't support runstatedir until version 2.70) +datarootdir = @datarootdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +runstatedir = $(localstatedir)/run +# Specific types of files +includedir = @includedir@ +oldincludedir = @oldincludedir@ +docdir = @docdir@ +infodir = @infodir@ +htmldir = @htmldir@ +dvidir = @dvidir@ +pdfdir = @pdfdir@ +psdir = @psdir@ +libdir = @libdir@ +lispdir = $(datarootdir)/emacs/site-lisp +localedir = @localedir@ + +mandir = @mandir@ +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 = -include $(topsrcdir)/build-aux/Makefile.tail.mk +endif diff --git a/configure.ac b/configure.ac index 5c639e32d4..634ab02d38 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_INIT([systemd], [systemd], [http://www.freedesktop.org/wiki/Software/systemd]) -AC_CONFIG_SRCDIR([src/core/main.c]) +AC_CONFIG_SRCDIR([src/grp-system/systemd/main.c]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) @@ -59,7 +59,7 @@ SET_ARCH(IA32, i*86*) SET_ARCH(MIPS, mips*) SET_ARCH(AARCH64, aarch64*) -# i18n stuff for the PolicyKit policy files, heck whether intltool can be found, disable NLS otherwise +# i18n stuff for the PolicyKit policy files, check whether intltool can be found, disable NLS otherwise AC_CHECK_PROG(intltool_found, [intltool-merge], [yes], [no]) AS_IF([test x"$intltool_found" != xyes], [AS_IF([test x"$enable_nls" = xyes], @@ -86,11 +86,16 @@ GETTEXT_PACKAGE=systemd AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [systemd]) +AC_PROG_AWK +AC_PROG_GREP +AC_PROG_EGREP +AC_PROG_FGREP +AC_PROG_INSTALL AC_PROG_MKDIR_P +AC_PROG_LEX AC_PROG_LN_S AC_PROG_SED -AC_PROG_GREP -AC_PROG_AWK +AC_PROG_YACC AC_PATH_PROG([M4], [m4]) @@ -188,7 +193,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ -fno-common \ -fdiagnostics-show-option \ -fno-strict-aliasing \ - -fvisibility=hidden \ -fstack-protector \ -fstack-protector-strong \ -fPIE \ @@ -1612,11 +1616,21 @@ AC_SUBST([rootprefix], [$with_rootprefix]) AC_SUBST([rootlibdir], [$with_rootlibdir]) AC_CONFIG_FILES([ - Makefile + config.mk + automake.mk po/Makefile.in ]) -AC_OUTPUT +AC_OUTPUT([], [], [ +if test "$srcdir" != .; then + { + find "$srcdir" '(' -name GNUmakefile -o -name Makefile -o -name subdir.mk ')' -printf '%P\n' + } | while read -r filename; do + mkdir -p "\$(dirname "\$filename")" + ln -srfT "$srcdir/\$filename" "\$filename" + done +fi +]) AC_MSG_RESULT([ $PACKAGE_NAME $VERSION @@ -1694,6 +1708,7 @@ AC_MSG_RESULT([ tests: ${enable_tests} prefix: ${prefix} + exec_prefix: ${exec_prefix} rootprefix: ${with_rootprefix} sysconf dir: ${sysconfdir} datarootdir: ${datarootdir} diff --git a/man/.gitignore b/man/.gitignore index d928e5a83f..1e3a647575 100644 --- a/man/.gitignore +++ b/man/.gitignore @@ -3,3 +3,4 @@ /*.[13578] /*.html /custom-entities.ent +/custom-entities.ent.in diff --git a/man/Makefile b/man/Makefile index edba211499..87dee0b725 100644 --- a/man/Makefile +++ b/man/Makefile @@ -23,10 +23,11 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -$(outdir)/custom-entities.ent: configure.ac - $(AM_V_GEN)$(MKDIR_P) $(dir $@) +$(srcdir)/custom-entities.ent.in: $(outdir)/.var.sd.substitution_keys $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \ - printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \ - > $@ # ' + printf '<!ENTITY %s "@%s@">\n' $(foreach v,$(sd.substitution_keys),$v $v)) \ + > $@ +files.src.gen += custom-entities.ent.in +sd.sed_files += custom-entities.ent include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/po/GNUmakefile b/po/GNUmakefile new file mode 120000 index 0000000000..bb60b1ed40 --- /dev/null +++ b/po/GNUmakefile @@ -0,0 +1 @@ +../GNUmakefile
\ No newline at end of file diff --git a/src/busctl/Makefile b/src/busctl/Makefile index bb41d82b85..9e8f1fac4f 100644 --- a/src/busctl/Makefile +++ b/src/busctl/Makefile @@ -32,6 +32,7 @@ busctl_SOURCES = \ src/libsystemd/sd-bus/busctl-introspect.h busctl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/busctl/busctl-introspect.h b/src/busctl/busctl-introspect.h index d922e352db..3dd1df4e47 100644 --- a/src/busctl/busctl-introspect.h +++ b/src/busctl/busctl-introspect.h @@ -20,6 +20,7 @@ ***/ #include <stdbool.h> +#include <stdint.h> typedef struct XMLIntrospectOps { int (*on_path)(const char *path, void *userdata); diff --git a/src/grp-boot/bootctl/Makefile b/src/grp-boot/bootctl/Makefile index 90bbed9fad..58f22611e9 100644 --- a/src/grp-boot/bootctl/Makefile +++ b/src/grp-boot/bootctl/Makefile @@ -37,6 +37,7 @@ bootctl_CFLAGS = \ bootctl_LDADD = \ libsystemd-shared.la \ + libsystemd-blkid.la \ $(BLKID_LIBS) bin_PROGRAMS += \ diff --git a/src/grp-boot/systemd-boot/Makefile b/src/grp-boot/systemd-boot/Makefile index 3b4d4ddda1..8b770c0c81 100644 --- a/src/grp-boot/systemd-boot/Makefile +++ b/src/grp-boot/systemd-boot/Makefile @@ -25,6 +25,7 @@ include $(topsrcdir)/build-aux/Makefile.head.mk ifneq ($(ENABLE_EFI),) ifneq ($(HAVE_GNUEFI),) +# ------------------------------------------------------------------------------ efi_cppflags = \ $(EFI_CPPFLAGS) \ -I$(top_builddir) -include config.h \ @@ -81,9 +82,18 @@ EFI_FORMAT = -O binary else EFI_FORMAT = --target=efi-app-$(EFI_ARCH) endif # ARCH_AARCH64 -endif # HAVE_GNUEFI -endif # ENABLE_EFI +$(outdir)/%.o: $(srcdir)/%.c + $(AM_V_EFI_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@ + +$(outdir)/%.so: + @if test $(words $^) = 0; then echo 'Cannot link EFI library with no dependencies: $@' >&2; exit 1; fi + $(AM_V_EFI_CCLD)$(LD) $(efi_ldflags) $^ -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name) + $(AM_V_at)! { nm -D -u $@ | grep ' U '; } + +# These next 2 are the same rule +$(outdir)/%$(EFI_MACHINE_TYPE_NAME).efi : $(outdir)/%.so; $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ +$(outdir)/%$(EFI_MACHINE_TYPE_NAME).efi.stub: $(outdir)/%.so; $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ # ------------------------------------------------------------------------------ systemd_boot_headers = \ src/boot/efi/util.h \ @@ -102,33 +112,9 @@ systemd_boot_sources = \ src/boot/efi/measure.c \ src/boot/efi/boot.c -EXTRA_DIST += $(systemd_boot_sources) $(systemd_boot_headers) - -systemd_boot_objects = $(addprefix $(top_builddir)/,$(systemd_boot_sources:.c=.o)) -systemd_boot_solib = $(top_builddir)/src/boot/efi/systemd_boot.so systemd_boot = systemd-boot$(EFI_MACHINE_TYPE_NAME).efi - -ifneq ($(ENABLE_EFI),) -ifneq ($(HAVE_GNUEFI),) -bootlib_DATA = $(systemd_boot) - -$(outdir)/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(top_srcdir)/,$(systemd_boot_headers)) - @$(MKDIR_P) $(top_builddir)/src/boot/efi/ - $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@ - -$(systemd_boot_solib): $(systemd_boot_objects) - $(AM_V_CCLD)$(LD) $(efi_ldflags) $(systemd_boot_objects) \ - -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \ - nm -D -u $@ | grep ' U ' && exit 1 || : - -$(systemd_boot): $(systemd_boot_solib) - $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \ - -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ -endif # HAVE_GNUEFI -endif # ENABLE_EFI - -CLEANFILES += $(systemd_boot_objects) $(systemd_boot_solib) $(systemd_boot) - +bootlib_DATA += $(systemd_boot) +$(outdir)/systemd-boot.so: $(addprefix $(outdir)/,$(notdir $(systemd_boot_sources:.c=.o))) # ------------------------------------------------------------------------------ stub_headers = \ src/boot/efi/util.h \ @@ -149,45 +135,19 @@ stub_sources = \ src/boot/efi/measure.c \ src/boot/efi/stub.c -EXTRA_DIST += \ - $(stub_sources) \ - $(stub_headers) \ - test/splash.bmp - -stub_objects = $(addprefix $(top_builddir)/,$(stub_sources:.c=.o)) -stub_solib = $(top_builddir)/src/boot/efi/stub.so stub = linux$(EFI_MACHINE_TYPE_NAME).efi.stub - -ifneq ($(ENABLE_EFI),) -ifneq ($(HAVE_GNUEFI),) bootlib_DATA += $(stub) - -$(outdir)/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(top_srcdir)/,$(stub_headers)) - @$(MKDIR_P) $(top_builddir)/src/boot/efi/ - $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@ - -$(stub_solib): $(stub_objects) - $(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \ - -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \ - nm -D -u $@ | grep ' U ' && exit 1 || : - -$(stub): $(stub_solib) - $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \ - -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ -endif # HAVE_GNUEFI -endif # ENABLE_EFI - -CLEANFILES += $(stub_objects) $(stub_solib) $(stub) - +$(outdir)/linux.so: $(addprefix $(outdir)/,$(notdir $(stub_sources:.c=.o))) # ------------------------------------------------------------------------------ -CLEANFILES += test-efi-disk.img - -test-efi-disk.img: $(systemd_boot) $(stub) test/test-efi-create-disk.sh - $(AM_V_GEN)test/test-efi-create-disk.sh +$(outdir)/test-efi-disk.img: $(outdir)/$(systemd_boot) $(outdir)/$(stub) $(srcdir)/test-efi-create-disk.sh + $(AM_V_GEN)$(@D)/test-efi-create-disk.sh -test-efi: test-efi-disk.img +test-efi: $(outdir)/test-efi-disk.img $(QEMU) -machine accel=kvm -m 1024 -bios $(QEMU_BIOS) -snapshot test-efi-disk.img -EXTRA_DIST += test/test-efi-create-disk.sh +files.out.int += test-efi-disk.img +# ------------------------------------------------------------------------------ +endif # HAVE_GNUEFI +endif # ENABLE_EFI include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-boot/systemd-boot/console.h b/src/grp-boot/systemd-boot/console.h index 3fe0ce5ec4..887995a9cc 100644 --- a/src/grp-boot/systemd-boot/console.h +++ b/src/grp-boot/systemd-boot/console.h @@ -16,6 +16,8 @@ #ifndef __SDBOOT_CONSOLE_H #define __SDBOOT_CONSOLE_H +#include <efi.h> + #define EFI_SHIFT_STATE_VALID 0x80000000 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004 #define EFI_LEFT_CONTROL_PRESSED 0x00000008 diff --git a/src/grp-boot/systemd-boot/disk.h b/src/grp-boot/systemd-boot/disk.h index af91a9c674..5804b8881a 100644 --- a/src/grp-boot/systemd-boot/disk.h +++ b/src/grp-boot/systemd-boot/disk.h @@ -15,5 +15,7 @@ #ifndef __SDBOOT_DISK_H #define __SDBOOT_DISK_H +#include <efi.h> + EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[37]); #endif diff --git a/src/grp-boot/systemd-boot/graphics.h b/src/grp-boot/systemd-boot/graphics.h index cf48e647e7..d8e5adfcd8 100644 --- a/src/grp-boot/systemd-boot/graphics.h +++ b/src/grp-boot/systemd-boot/graphics.h @@ -18,5 +18,7 @@ #ifndef __SDBOOT_GRAPHICS_H #define __SDBOOT_GRAPHICS_H +#include <efi.h> + EFI_STATUS graphics_mode(BOOLEAN on); #endif diff --git a/src/grp-boot/systemd-boot/linux.h b/src/grp-boot/systemd-boot/linux.h index d9e6ed7955..b87a7f0d38 100644 --- a/src/grp-boot/systemd-boot/linux.h +++ b/src/grp-boot/systemd-boot/linux.h @@ -15,6 +15,8 @@ #ifndef __SDBOOT_kernel_H #define __SDBOOT_kernel_H +#include <efi.h> + EFI_STATUS linux_exec(EFI_HANDLE *image, CHAR8 *cmdline, UINTN cmdline_size, UINTN linux_addr, diff --git a/src/grp-boot/systemd-boot/measure.h b/src/grp-boot/systemd-boot/measure.h index a2cfe817d0..ddd686a8fd 100644 --- a/src/grp-boot/systemd-boot/measure.h +++ b/src/grp-boot/systemd-boot/measure.h @@ -13,6 +13,8 @@ #ifndef __SDBOOT_MEASURE_H #define __SDBOOT_MEASURE_H +#include <efi.h> + #ifndef SD_TPM_PCR #define SD_TPM_PCR 8 #endif diff --git a/src/grp-boot/systemd-boot/pefile.h b/src/grp-boot/systemd-boot/pefile.h index 2e445ede17..bc2d73fea9 100644 --- a/src/grp-boot/systemd-boot/pefile.h +++ b/src/grp-boot/systemd-boot/pefile.h @@ -15,6 +15,8 @@ #ifndef __SDBOOT_PEFILE_H #define __SDBOOT_PEFILE_H +#include <efi.h> + EFI_STATUS pefile_locate_sections(EFI_FILE *dir, CHAR16 *path, CHAR8 **sections, UINTN *addrs, UINTN *offsets, UINTN *sizes); #endif diff --git a/src/grp-boot/systemd-boot/splash.h b/src/grp-boot/systemd-boot/splash.h index 09b543fb47..362ff22643 100644 --- a/src/grp-boot/systemd-boot/splash.h +++ b/src/grp-boot/systemd-boot/splash.h @@ -16,5 +16,7 @@ #ifndef __SDBOOT_SPLASH_H #define __SDBOOT_SPLASH_H +#include <efi.h> + EFI_STATUS graphics_splash(UINT8 *content, UINTN len, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *background); #endif diff --git a/src/grp-boot/systemd-boot/util.h b/src/grp-boot/systemd-boot/util.h index e673cdf9a0..e2da8b3fee 100644 --- a/src/grp-boot/systemd-boot/util.h +++ b/src/grp-boot/systemd-boot/util.h @@ -22,7 +22,7 @@ #define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0])) static inline const CHAR16 *yes_no(BOOLEAN b) { - return b ? L"yes" : L"no"; + return b ? (CHAR16*)L"yes" : (CHAR16*)L"no"; } EFI_STATUS parse_boolean(CHAR8 *v, BOOLEAN *b); diff --git a/src/grp-coredump/coredumpctl/Makefile b/src/grp-coredump/coredumpctl/Makefile index 25a0ee29f2..743f010f7b 100644 --- a/src/grp-coredump/coredumpctl/Makefile +++ b/src/grp-coredump/coredumpctl/Makefile @@ -27,6 +27,7 @@ coredumpctl_SOURCES = \ src/coredump/coredumpctl.c coredumpctl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la bin_PROGRAMS += \ diff --git a/src/grp-coredump/systemd-coredump/.gitignore b/src/grp-coredump/systemd-coredump/.gitignore new file mode 100644 index 0000000000..768e3d4d9f --- /dev/null +++ b/src/grp-coredump/systemd-coredump/.gitignore @@ -0,0 +1 @@ +/50-coredump.sysctl diff --git a/src/grp-coredump/systemd-coredump/Makefile b/src/grp-coredump/systemd-coredump/Makefile index 08fc6d44df..f27c4a3976 100644 --- a/src/grp-coredump/systemd-coredump/Makefile +++ b/src/grp-coredump/systemd-coredump/Makefile @@ -33,6 +33,8 @@ systemd_coredump_CFLAGS = \ $(ACL_CFLAGS) systemd_coredump_LDADD = \ + libsystemd-internal.la \ + libjournal-core.la \ libsystemd-shared.la \ $(ACL_LIBS) @@ -79,7 +81,9 @@ CLEANFILES += \ endif # ENABLE_COREDUMP EXTRA_DIST += \ - sysctl.d/50-coredump.conf.in \ + sysctl.d/50-coredump.sysctl.in \ units/systemd-coredump@.service.in +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-hostname/hostnamectl/Makefile b/src/grp-hostname/hostnamectl/Makefile index c728acce7b..5285beca4b 100644 --- a/src/grp-hostname/hostnamectl/Makefile +++ b/src/grp-hostname/hostnamectl/Makefile @@ -29,6 +29,7 @@ hostnamectl_SOURCES = \ src/hostname/hostnamectl.c hostnamectl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la bin_PROGRAMS += \ @@ -39,6 +40,7 @@ dist_bashcompletion_data += \ dist_zshcompletion_data += \ shell-completion/zsh/_hostnamectl + endif # ENABLE_HOSTNAMED include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-hostname/systemd-hostnamed/Makefile b/src/grp-hostname/systemd-hostnamed/Makefile index 0c8f0b5ae6..cce065ccd4 100644 --- a/src/grp-hostname/systemd-hostnamed/Makefile +++ b/src/grp-hostname/systemd-hostnamed/Makefile @@ -28,6 +28,7 @@ systemd_hostnamed_SOURCES = \ src/hostname/hostnamed.c systemd_hostnamed_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la rootlibexec_PROGRAMS += \ @@ -55,6 +56,7 @@ BUSNAMES_TARGET_WANTS += \ org.freedesktop.hostname1.busname endif # ENABLE_HOSTNAMED + polkitpolicy_in_files += \ src/hostname/org.freedesktop.hostname1.policy.in diff --git a/src/grp-initprogs/grp-sleep/systemd-hibernate-resume-generator/Makefile b/src/grp-initprogs/grp-sleep/systemd-hibernate-resume-generator/Makefile index 835f2a37b2..32e944c61d 100644 --- a/src/grp-initprogs/grp-sleep/systemd-hibernate-resume-generator/Makefile +++ b/src/grp-initprogs/grp-sleep/systemd-hibernate-resume-generator/Makefile @@ -35,4 +35,6 @@ systemd_hibernate_resume_generator_LDADD = \ endif # ENABLE_HIBERNATE +sd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-initprogs/grp-sleep/systemd-sleep/Makefile b/src/grp-initprogs/grp-sleep/systemd-sleep/Makefile index 45c0beaf9d..2c94aaf4a9 100644 --- a/src/grp-initprogs/grp-sleep/systemd-sleep/Makefile +++ b/src/grp-initprogs/grp-sleep/systemd-sleep/Makefile @@ -42,8 +42,17 @@ nodist_systemunit_DATA += \ endif # ENABLE_HIBERNATE +dist_systemunit_DATA += \ + units/suspend.target + +nodist_systemunit_DATA += \ + units/systemd-suspend.service + EXTRA_DIST += \ + units/systemd-suspend.service.in \ units/systemd-hibernate.service.in \ units/systemd-hybrid-sleep.service.in +sd.CPPFLAGS += -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-initprogs/grp-sleep/systemd-sleep/systemd-sleep.xml b/src/grp-initprogs/grp-sleep/systemd-sleep/systemd-sleep.xml index a8beb86f4d..efd97eb671 100644 --- a/src/grp-initprogs/grp-sleep/systemd-sleep/systemd-sleep.xml +++ b/src/grp-initprogs/grp-sleep/systemd-sleep/systemd-sleep.xml @@ -26,7 +26,7 @@ xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> - <title>systemd-suspend.service</title> + <title>systemd-sleep</title> <productname>systemd</productname> <authorgroup> @@ -40,7 +40,7 @@ </refentryinfo> <refmeta> - <refentrytitle>systemd-suspend.service</refentrytitle> + <refentrytitle>systemd-sleep</refentrytitle> <manvolnum>8</manvolnum> </refmeta> diff --git a/src/grp-initprogs/systemd-firstboot/systemd-firstboot.completion.bash b/src/grp-initprogs/systemd-firstboot/systemd-firstboot.completion.bash new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-initprogs/systemd-firstboot/systemd-firstboot.completion.bash diff --git a/src/grp-initprogs/systemd-firstboot/systemd-firstboot.completion.zsh b/src/grp-initprogs/systemd-firstboot/systemd-firstboot.completion.zsh new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-initprogs/systemd-firstboot/systemd-firstboot.completion.zsh diff --git a/src/grp-initprogs/systemd-fsck/Makefile b/src/grp-initprogs/systemd-fsck/Makefile index 8a223a7f70..1f331bca73 100644 --- a/src/grp-initprogs/systemd-fsck/Makefile +++ b/src/grp-initprogs/systemd-fsck/Makefile @@ -28,6 +28,7 @@ systemd_fsck_SOURCES = \ src/fsck/fsck.c systemd_fsck_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-initprogs/systemd-quotacheck/Makefile b/src/grp-initprogs/systemd-quotacheck/Makefile index 84c7204d38..83580b4c66 100644 --- a/src/grp-initprogs/systemd-quotacheck/Makefile +++ b/src/grp-initprogs/systemd-quotacheck/Makefile @@ -38,9 +38,12 @@ systemd_quotacheck_LDADD = \ endif # ENABLE_QUOTACHECK EXTRA_DIST += \ + units/quotaon.service.in \ units/systemd-quotacheck.service.in nodist_systemunit_DATA += \ units/quotaon.service +sd.CPPFLAGS += -DQUOTACHECK=\"$(QUOTACHECK)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-initprogs/systemd-random-seed/Makefile b/src/grp-initprogs/systemd-random-seed/Makefile index 8d8fce955c..ecc82206cb 100644 --- a/src/grp-initprogs/systemd-random-seed/Makefile +++ b/src/grp-initprogs/systemd-random-seed/Makefile @@ -44,4 +44,7 @@ endif # ENABLE_RANDOMSEED EXTRA_DIST += \ units/systemd-random-seed.service.in +sd.CPPFLAGS += -DRANDOM_SEED_DIR=\"$(localstatedir)/lib/systemd/\" +sd.CPPFLAGS += -DRANDOM_SEED=\"$(localstatedir)/lib/systemd/random-seed\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-initprogs/systemd-sysusers/.gitignore b/src/grp-initprogs/systemd-sysusers/.gitignore deleted file mode 100644 index c065034d29..0000000000 --- a/src/grp-initprogs/systemd-sysusers/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/basic.conf -/systemd.conf -/systemd-remote.conf diff --git a/src/grp-initprogs/systemd-sysusers/Makefile b/src/grp-initprogs/systemd-sysusers/Makefile index 66af87f02c..0c37e0e5c2 100644 --- a/src/grp-initprogs/systemd-sysusers/Makefile +++ b/src/grp-initprogs/systemd-sysusers/Makefile @@ -40,7 +40,6 @@ SYSINIT_TARGET_WANTS += \ systemd-sysusers.service nodist_sysusers_DATA = \ - sysusers.d/systemd.conf \ sysusers.d/basic.conf INSTALL_DIRS += \ @@ -49,8 +48,6 @@ endif # ENABLE_SYSUSERS EXTRA_DIST += \ units/systemd-sysusers.service.in \ - sysusers.d/systemd.conf.m4 \ - sysusers.d/systemd-remote.conf.m4 \ - sysusers.d/basic.conf.in + sysusers.d/basic.sysusers.in include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-initprogs/systemd-sysusers/systemd-sysusers.completion.bash b/src/grp-initprogs/systemd-sysusers/systemd-sysusers.completion.bash new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-initprogs/systemd-sysusers/systemd-sysusers.completion.bash diff --git a/src/grp-initprogs/systemd-sysusers/systemd-sysusers.completion.zsh b/src/grp-initprogs/systemd-sysusers/systemd-sysusers.completion.zsh new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-initprogs/systemd-sysusers/systemd-sysusers.completion.zsh diff --git a/src/grp-initprogs/systemd-tmpfiles/Makefile b/src/grp-initprogs/systemd-tmpfiles/Makefile index 14da180947..8e114070b3 100644 --- a/src/grp-initprogs/systemd-tmpfiles/Makefile +++ b/src/grp-initprogs/systemd-tmpfiles/Makefile @@ -46,7 +46,6 @@ nodist_systemunit_DATA += \ units/systemd-tmpfiles-clean.service nodist_tmpfiles_DATA = \ - tmpfiles.d/systemd.conf \ tmpfiles.d/etc.conf dist_tmpfiles_DATA = \ @@ -54,9 +53,7 @@ dist_tmpfiles_DATA = \ tmpfiles.d/tmp.conf \ tmpfiles.d/x11.conf \ tmpfiles.d/var.conf \ - tmpfiles.d/home.conf \ - tmpfiles.d/systemd-nspawn.conf \ - tmpfiles.d/journal-nocow.conf + tmpfiles.d/home.conf ifneq ($(HAVE_SYSV_COMPAT),) dist_tmpfiles_DATA += \ @@ -79,8 +76,7 @@ INSTALL_DIRS += \ endif # ENABLE_TMPFILES EXTRA_DIST += \ - tmpfiles.d/systemd.conf.m4 \ - tmpfiles.d/etc.conf.m4 \ + tmpfiles.d/etc.tmpfiles.m4 \ units/systemd-tmpfiles-setup-dev.service.in \ units/systemd-tmpfiles-setup.service.in \ units/systemd-tmpfiles-clean.service.in diff --git a/src/grp-initprogs/systemd-update-utmp/Makefile b/src/grp-initprogs/systemd-update-utmp/Makefile index 506e4840a5..550948589c 100644 --- a/src/grp-initprogs/systemd-update-utmp/Makefile +++ b/src/grp-initprogs/systemd-update-utmp/Makefile @@ -35,6 +35,7 @@ systemd_update_utmp_CFLAGS = \ $(AUDIT_CFLAGS) systemd_update_utmp_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ $(AUDIT_LIBS) diff --git a/src/grp-journal/.gitignore b/src/grp-journal/.gitignore index c3fea7424f..c9bd45a7be 100644 --- a/src/grp-journal/.gitignore +++ b/src/grp-journal/.gitignore @@ -1 +1,5 @@ +/journald-gperf.c +/libsystemd-journal.pc +/audit_type-list.txt +/audit_type-*-name.* /README diff --git a/src/grp-journal/Makefile b/src/grp-journal/Makefile index 2b4a366f8a..59ae3ee8b3 100644 --- a/src/grp-journal/Makefile +++ b/src/grp-journal/Makefile @@ -173,14 +173,13 @@ tests += \ test-compress-benchmark endif # HAVE_COMPRESSION -ifneq ($(HAVE_SYSV_COMPAT),) +dist_tmpfiles_DATA = \ + tmpfiles.d/journal-nocow.conf +ifneq ($(HAVE_SYSV_COMPAT),) varlog_DATA = \ docs/var-log/README -$(outdir)/README: docs/var-log/README.in - $(SED_PROCESS) - CLEANFILES += \ docs/var-log/README endif # HAVE_SYSV_COMPAT @@ -188,6 +187,9 @@ endif # HAVE_SYSV_COMPAT EXTRA_DIST += \ docs/var-log/README.in +dist_systempreset_DATA = \ + 90-journald.preset + nested.subdirs += grp-remote nested.subdirs += journalctl nested.subdirs += systemd-cat diff --git a/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile b/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile index 2d0ec68307..b0eae79db5 100644 --- a/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile +++ b/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile @@ -23,4 +23,27 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk +ifneq ($(HAVE_MICROHTTPD),) + +rootlibexec_LTLIBRARIES += \ + libsystemd-microhttpd.la + +libsystemd_microhttpd_la_SOURCES += \ + srjournal-remote/microhttpd-util.h \ + srjournal-remote/microhttpd-util.c + +libsystemd_microhttpd_la_CFLAGS = \ + $(MICROHTTPD_CFLAGS) + +libsystemd_microhttpd_la_LIBADD += \ + libsystemd-basic.la \ + $(MICROHTTPD_LIBS) + +ifneq ($(HAVE_GNUTLS),) +libsystemd_microhttpd_la_LIBADD += \ + $(GNUTLS_LIBS) +endif # HAVE_GNUTLS + +endif # HAVE_MICROHTTPD + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-journal/grp-remote/systemd-journal-gatewayd/Makefile b/src/grp-journal/grp-remote/systemd-journal-gatewayd/Makefile index 0ae96978af..723dfa7ac7 100644 --- a/src/grp-journal/grp-remote/systemd-journal-gatewayd/Makefile +++ b/src/grp-journal/grp-remote/systemd-journal-gatewayd/Makefile @@ -30,21 +30,12 @@ rootlibexec_PROGRAMS += \ systemd-journal-gatewayd systemd_journal_gatewayd_SOURCES = \ - src/journal-remote/journal-gatewayd.c \ - src/journal-remote/microhttpd-util.h \ - src/journal-remote/microhttpd-util.c + src/journal-remote/journal-gatewayd.c systemd_journal_gatewayd_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ - $(MICROHTTPD_LIBS) - -ifneq ($(HAVE_GNUTLS),) -systemd_journal_gatewayd_LDADD += \ - $(GNUTLS_LIBS) -endif # HAVE_GNUTLS - -systemd_journal_gatewayd_CFLAGS = \ - $(MICROHTTPD_CFLAGS) + libsystemd-microhttpd.la systemd_journal_gatewayd_CPPFLAGS = \ -DDOCUMENT_ROOT=\"$(gatewayddocumentrootdir)\" @@ -58,6 +49,9 @@ nodist_systemunit_DATA += \ dist_gatewayddocumentroot_DATA = \ src/journal-remote/browse.html +dist_sysusers_DATA += \ + sysusers.d/systemd-journal-gatewayd.conf + endif # HAVE_MICROHTTPD EXTRA_DIST += \ diff --git a/src/grp-journal/grp-remote/browse.html b/src/grp-journal/grp-remote/systemd-journal-gatewayd/browse.html index 32848c7673..32848c7673 100644 --- a/src/grp-journal/grp-remote/browse.html +++ b/src/grp-journal/grp-remote/systemd-journal-gatewayd/browse.html diff --git a/src/grp-journal/grp-remote/systemd-journal-remote/Makefile b/src/grp-journal/grp-remote/systemd-journal-remote/Makefile index 8bb2c3871d..601bad9b5f 100644 --- a/src/grp-journal/grp-remote/systemd-journal-remote/Makefile +++ b/src/grp-journal/grp-remote/systemd-journal-remote/Makefile @@ -36,41 +36,27 @@ systemd_journal_remote_SOURCES = \ src/journal-remote/journal-remote.c systemd_journal_remote_LDADD = \ + libsystemd-microhttpd.la \ libjournal-core.la -systemd_journal_remote_SOURCES += \ - src/journal-remote/microhttpd-util.h \ - src/journal-remote/microhttpd-util.c - -systemd_journal_remote_CFLAGS = \ - $(MICROHTTPD_CFLAGS) - -systemd_journal_remote_LDADD += \ - $(MICROHTTPD_LIBS) - ifneq ($(ENABLE_TMPFILES),) dist_tmpfiles_DATA += \ tmpfiles.d/systemd-remote.conf endif # ENABLE_TMPFILES -ifneq ($(HAVE_GNUTLS),) -systemd_journal_remote_LDADD += \ - $(GNUTLS_LIBS) -endif # HAVE_GNUTLS - # systemd-journal-remote make sense mostly with full crypto stack dist_systemunit_DATA += \ units/systemd-journal-remote.socket +dist_sysusers_DATA += \ + sysusers.d/systemd-journal-remote.conf + nodist_systemunit_DATA += \ units/systemd-journal-remote.service -journal-remote-install-hook: journal-install-hook - -$(MKDIR_P) $(DESTDIR)/var/log/journal/remote - -chown 0:0 $(DESTDIR)/var/log/journal/remote - -chmod 755 $(DESTDIR)/var/log/journal/remote - -INSTALL_EXEC_HOOKS += journal-remote-install-hook +files.sys.all += /var/log/journal/remote +$(DESTDIR)/var/log/journal/remote: + $(MKDIR_P) $@ nodist_pkgsysconf_DATA += \ src/journal-remote/journal-remote.conf @@ -81,4 +67,7 @@ EXTRA_DIST += \ src/journal-remote/log-generator.py endif # HAVE_MICROHTTPD +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" +sd.CPPFLAGS += -DCERTIFICATE_ROOT=\"$(CERTIFICATEROOT)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-journal/grp-remote/systemd-journal-upload/Makefile b/src/grp-journal/grp-remote/systemd-journal-upload/Makefile index f6966df0f6..bc272e52da 100644 --- a/src/grp-journal/grp-remote/systemd-journal-upload/Makefile +++ b/src/grp-journal/grp-remote/systemd-journal-upload/Makefile @@ -45,10 +45,16 @@ nodist_systemunit_DATA += \ nodist_pkgsysconf_DATA += \ src/journal-remote/journal-upload.conf +dist_sysusers_DATA += \ + sysusers.d/systemd-journal-upload.conf + endif # HAVE_LIBCURL EXTRA_DIST += \ units/systemd-journal-upload.service.in \ src/journal-remote/journal-upload.conf.in +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" +sd.CPPFLAGS += -DCERTIFICATE_ROOT=\"$(CERTIFICATEROOT)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-journal/grp-remote/systemd-journal-upload/journal-upload.h b/src/grp-journal/grp-remote/systemd-journal-upload/journal-upload.h index c121f8f16b..f1fd95e22c 100644 --- a/src/grp-journal/grp-remote/systemd-journal-upload/journal-upload.h +++ b/src/grp-journal/grp-remote/systemd-journal-upload/journal-upload.h @@ -1,5 +1,6 @@ #pragma once +#include <curl/curl.h> #include <inttypes.h> #include <systemd/sd-event.h> diff --git a/src/grp-journal/journalctl/Makefile b/src/grp-journal/journalctl/Makefile index f8519405d2..880827b85d 100644 --- a/src/grp-journal/journalctl/Makefile +++ b/src/grp-journal/journalctl/Makefile @@ -30,6 +30,7 @@ journalctl_SOURCES = \ src/journal/journalctl.c journalctl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ libudev-core.la @@ -51,11 +52,15 @@ rootbin_PROGRAMS += \ nodist_systemunit_DATA += \ units/systemd-journal-flush.service \ units/systemd-journal-catalog-update.service + SYSINIT_TARGET_WANTS += \ systemd-journal-flush.service \ systemd-journal-catalog-update.service + EXTRA_DIST += \ units/systemd-journal-flush.service.in \ units/systemd-journal-catalog-update.service.in +sd.CPPFLAGS += -DCATALOG_DATABASE=\"$(catalogstatedir)/database\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-journal/libjournal-core/.gitignore b/src/grp-journal/libjournal-core/.gitignore deleted file mode 100644 index b93a9462fa..0000000000 --- a/src/grp-journal/libjournal-core/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/journald-gperf.c -/audit_type-list.txt -/audit_type-*-name.* diff --git a/src/grp-journal/libjournal-core/GNUmakefile b/src/grp-journal/libjournal-core/GNUmakefile new file mode 120000 index 0000000000..95e5924740 --- /dev/null +++ b/src/grp-journal/libjournal-core/GNUmakefile @@ -0,0 +1 @@ +../../../GNUmakefile
\ No newline at end of file diff --git a/src/grp-journal/libjournal-core/Makefile b/src/grp-journal/libjournal-core/Makefile new file mode 100644 index 0000000000..76e6e9ddee --- /dev/null +++ b/src/grp-journal/libjournal-core/Makefile @@ -0,0 +1,28 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. +include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +nested.subdirs += src + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-journal/libjournal-core/src/Makefile b/src/grp-journal/libjournal-core/src/Makefile index 6ea0446e27..429c6ddbb7 100644 --- a/src/grp-journal/libjournal-core/src/Makefile +++ b/src/grp-journal/libjournal-core/src/Makefile @@ -53,4 +53,6 @@ libjournal_core_la_LIBADD = \ noinst_LTLIBRARIES += \ libjournal-core.la +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-journal/systemd-journald/Makefile b/src/grp-journal/systemd-journald/Makefile index 4f05218d88..b75a248ea1 100644 --- a/src/grp-journal/systemd-journald/Makefile +++ b/src/grp-journal/systemd-journald/Makefile @@ -60,6 +60,7 @@ nodist_catalog_DATA = \ EXTRA_DIST += \ $(nodist_catalog_DATA:.catalog=.catalog.in) +EXTRA_DIST := $(EXTRA_DIST) # Note that we don't use @@ for replacement markers here, but %%. This is # because the catalog uses @@ already for its runtime replacement handling and diff --git a/src/grp-locale/localectl/Makefile b/src/grp-locale/localectl/Makefile index 2544d16309..347e68c024 100644 --- a/src/grp-locale/localectl/Makefile +++ b/src/grp-locale/localectl/Makefile @@ -29,6 +29,7 @@ localectl_SOURCES = \ src/locale/localectl.c localectl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la bin_PROGRAMS += \ @@ -39,6 +40,7 @@ dist_bashcompletion_data += \ dist_zshcompletion_data += \ shell-completion/zsh/_localectl + endif # ENABLE_LOCALED include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-locale/systemd-localed/.gitignore b/src/grp-locale/systemd-localed/.gitignore index b1e0ba755e..6d9d6089c0 100644 --- a/src/grp-locale/systemd-localed/.gitignore +++ b/src/grp-locale/systemd-localed/.gitignore @@ -1 +1 @@ -org.freedesktop.locale1.policy +/org.freedesktop.locale1.policy diff --git a/src/grp-locale/systemd-localed/Makefile b/src/grp-locale/systemd-localed/Makefile index 1a12959a61..5cd9e07936 100644 --- a/src/grp-locale/systemd-localed/Makefile +++ b/src/grp-locale/systemd-localed/Makefile @@ -30,6 +30,7 @@ systemd_localed_SOURCES = \ src/locale/keymap-util.h systemd_localed_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ -ldl @@ -86,4 +87,7 @@ polkitpolicy_in_files += \ EXTRA_DIST += \ units/systemd-localed.service.in +sd.CPPFLAGS += -DSYSTEMD_KBD_MODEL_MAP=\"$(pkgdatadir)/kbd-model-map\" +sd.CPPFLAGS += -DSYSTEMD_LANGUAGE_FALLBACK_MAP=\"$(pkgdatadir)/language-fallback-map\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-login/.gitignore b/src/grp-login/.gitignore index 3a8ba497c1..4e5702a8e8 100644 --- a/src/grp-login/.gitignore +++ b/src/grp-login/.gitignore @@ -3,4 +3,3 @@ /org.freedesktop.login1.policy /71-seat.rules /73-seat-late.rules -/systemd-user diff --git a/src/grp-login/loginctl/Makefile b/src/grp-login/loginctl/Makefile index f1a474e1cc..12987f92bc 100644 --- a/src/grp-login/loginctl/Makefile +++ b/src/grp-login/loginctl/Makefile @@ -29,6 +29,7 @@ loginctl_SOURCES = \ src/login/sysfs-show.c loginctl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la rootbin_PROGRAMS += \ diff --git a/src/grp-login/pam_systemd/.gitignore b/src/grp-login/pam_systemd/.gitignore new file mode 100644 index 0000000000..f3bb5b971b --- /dev/null +++ b/src/grp-login/pam_systemd/.gitignore @@ -0,0 +1 @@ +/systemd-user diff --git a/src/grp-login/pam_systemd/Makefile b/src/grp-login/pam_systemd/Makefile index 2f1dfd9db1..4239d23df5 100644 --- a/src/grp-login/pam_systemd/Makefile +++ b/src/grp-login/pam_systemd/Makefile @@ -39,6 +39,7 @@ pam_systemd_la_LDFLAGS = \ -Wl,--version-script=$(srcdir)/pam_systemd.sym pam_systemd_la_LIBADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ $(PAM_LIBS) @@ -46,7 +47,7 @@ pamlib_LTLIBRARIES = \ pam_systemd.la ifneq ($(ENABLE_PAM_CONFIG),) -dist_pamconf_DATA = \ +nodist_pamconf_DATA = \ src/login/systemd-user endif diff --git a/src/grp-login/systemd-inhibit/Makefile b/src/grp-login/systemd-inhibit/Makefile index 8b3b7995d9..41775189d4 100644 --- a/src/grp-login/systemd-inhibit/Makefile +++ b/src/grp-login/systemd-inhibit/Makefile @@ -29,6 +29,7 @@ systemd_inhibit_SOURCES = \ src/login/inhibit.c systemd_inhibit_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la rootbin_PROGRAMS += \ diff --git a/src/grp-login/systemd-logind/Makefile b/src/grp-login/systemd-logind/Makefile index 24de945818..0dbbc9733b 100644 --- a/src/grp-login/systemd-logind/Makefile +++ b/src/grp-login/systemd-logind/Makefile @@ -23,9 +23,8 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -ifneq ($(ENABLE_LOGIND),) - systemd_logind_SOURCES = \ + $(_liblogind_core_la_SOURCES) \ src/login/logind.c \ src/login/logind.h @@ -33,9 +32,10 @@ nodist_systemd_logind_SOURCES = \ src/login/logind-gperf.c systemd_logind_LDADD = \ - liblogind-core.la + libsystemd-internal.la \ + libsystemd-shared.la -liblogind_core_la_SOURCES = \ +_liblogind_core_la_SOURCES = \ src/login/logind-core.c \ src/login/logind-device.c \ src/login/logind-device.h \ @@ -64,13 +64,10 @@ liblogind_core_la_LIBADD = \ libsystemd-shared.la ifneq ($(HAVE_ACL),) -liblogind_core_la_SOURCES += \ +_liblogind_core_la_SOURCES += \ src/login/logind-acl.c endif # HAVE_ACL -noinst_LTLIBRARIES += \ - liblogind-core.la - rootlibexec_PROGRAMS += \ systemd-logind @@ -115,8 +112,6 @@ nodist_udevrules_DATA += \ src/login/71-seat.rules \ src/login/73-seat-late.rules -endif # ENABLE_LOGIND - polkitpolicy_in_files += \ src/login/org.freedesktop.login1.policy.in @@ -129,4 +124,7 @@ EXTRA_DIST += \ units/systemd-logind.service.in \ src/login/logind.conf.in +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" +sd.CPPFLAGS += -DKEXEC=\"$(KEXEC)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-machine/grp-import/libimport/Makefile b/src/grp-machine/grp-import/libimport/Makefile index 585001b2fa..3e8b6b1401 100644 --- a/src/grp-machine/grp-import/libimport/Makefile +++ b/src/grp-machine/grp-import/libimport/Makefile @@ -23,6 +23,15 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk +noinst_LTLIBRARIES += libimport.la + +libimport_la_SOURCES = \ + qcow2-util.c \ + import-common.c \ + import-compress.c + +libimport_la_LIBADD += libsystemd-basic.la + manual_tests += \ test-qcow2 diff --git a/src/grp-machine/grp-import/libimport/import-common.h b/src/grp-machine/grp-import/libimport/import-common.h index 07d3250e71..3abd62e8c3 100644 --- a/src/grp-machine/grp-import/libimport/import-common.h +++ b/src/grp-machine/grp-import/libimport/import-common.h @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <sys/types.h> + int import_make_read_only_fd(int fd); int import_make_read_only(const char *path); diff --git a/src/grp-machine/grp-import/systemd-export/Makefile b/src/grp-machine/grp-import/systemd-export/Makefile index fa6306226f..f641d93f14 100644 --- a/src/grp-machine/grp-import/systemd-export/Makefile +++ b/src/grp-machine/grp-import/systemd-export/Makefile @@ -30,11 +30,7 @@ systemd_export_SOURCES = \ src/import/export-tar.c \ src/import/export-tar.h \ src/import/export-raw.c \ - src/import/export-raw.h \ - src/import/import-common.c \ - src/import/import-common.h \ - src/import/import-compress.c \ - src/import/import-compress.h + src/import/export-raw.h systemd_export_CFLAGS = \ $(XZ_CFLAGS) \ @@ -43,6 +39,7 @@ systemd_export_CFLAGS = \ systemd_export_LDADD = \ libsystemd-shared.la \ + libimport.la \ $(XZ_LIBS) \ $(ZLIB_LIBS) \ $(BZIP2_LIBS) diff --git a/src/grp-machine/grp-import/systemd-import/Makefile b/src/grp-machine/grp-import/systemd-import/Makefile index 8d04ec18c5..51510f4470 100644 --- a/src/grp-machine/grp-import/systemd-import/Makefile +++ b/src/grp-machine/grp-import/systemd-import/Makefile @@ -29,13 +29,7 @@ systemd_import_SOURCES = \ src/import/import-raw.c \ src/import/import-raw.h \ src/import/import-tar.c \ - src/import/import-tar.h \ - src/import/import-common.c \ - src/import/import-common.h \ - src/import/import-compress.c \ - src/import/import-compress.h \ - src/import/qcow2-util.c \ - src/import/qcow2-util.h + src/import/import-tar.h systemd_import_CFLAGS = \ $(XZ_CFLAGS) \ @@ -44,6 +38,7 @@ systemd_import_CFLAGS = \ systemd_import_LDADD = \ libsystemd-shared.la \ + libimport.la \ $(XZ_LIBS) \ $(ZLIB_LIBS) \ $(BZIP2_LIBS) diff --git a/src/grp-machine/grp-import/systemd-importd/Makefile b/src/grp-machine/grp-import/systemd-importd/Makefile index 19705a925e..58b760ea86 100644 --- a/src/grp-machine/grp-import/systemd-importd/Makefile +++ b/src/grp-machine/grp-import/systemd-importd/Makefile @@ -33,6 +33,7 @@ systemd_importd_CFLAGS = \ -D SYSTEMD_EXPORT_PATH=\"$(rootlibexecdir)/systemd-export\" systemd_importd_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la dist_rootlibexec_DATA += \ diff --git a/src/grp-machine/grp-import/systemd-pull/Makefile b/src/grp-machine/grp-import/systemd-pull/Makefile index a9653a5f2c..0b593158e4 100644 --- a/src/grp-machine/grp-import/systemd-pull/Makefile +++ b/src/grp-machine/grp-import/systemd-pull/Makefile @@ -34,14 +34,8 @@ systemd_pull_SOURCES = \ src/import/pull-job.h \ src/import/pull-common.c \ src/import/pull-common.h \ - src/import/import-common.c \ - src/import/import-common.h \ - src/import/import-compress.c \ - src/import/import-compress.h \ src/import/curl-util.c \ - src/import/curl-util.h \ - src/import/qcow2-util.c \ - src/import/qcow2-util.h + src/import/curl-util.h systemd_pull_CFLAGS = \ $(LIBCURL_CFLAGS) \ @@ -54,6 +48,7 @@ systemd_pull_CFLAGS = \ systemd_pull_LDADD = \ libsystemd-shared.la \ + libimport.la \ $(LIBCURL_LIBS) \ $(XZ_LIBS) \ $(ZLIB_LIBS) \ diff --git a/src/grp-machine/libmachine-core/src/Makefile b/src/grp-machine/libmachine-core/src/Makefile index ac7cdc0e2d..a1e10f3cb4 100644 --- a/src/grp-machine/libmachine-core/src/Makefile +++ b/src/grp-machine/libmachine-core/src/Makefile @@ -35,6 +35,7 @@ libmachine_core_la_SOURCES = \ src/machine/operation.h libmachine_core_la_LIBADD = \ + libsystemd-internal.la \ libsystemd-shared.la noinst_LTLIBRARIES += \ diff --git a/src/grp-machine/libmachine-core/src/machine-dbus.c b/src/grp-machine/libmachine-core/src/machine-dbus.c index b7363054b3..89991a798f 100644 --- a/src/grp-machine/libmachine-core/src/machine-dbus.c +++ b/src/grp-machine/libmachine-core/src/machine-dbus.c @@ -33,7 +33,6 @@ #include "sd-bus/bus-common-errors.h" #include "sd-bus/bus-internal.h" #include "sd-bus/bus-util.h" -#include "sd-netlink/local-addresses.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/bus-label.h" #include "systemd-basic/copy.h" @@ -50,6 +49,7 @@ #include "systemd-basic/strv.h" #include "systemd-basic/terminal-util.h" #include "systemd-basic/user-util.h" +#include "systemd-shared/local-addresses.h" static int property_get_state( sd_bus *bus, diff --git a/src/grp-machine/machinectl/Makefile b/src/grp-machine/machinectl/Makefile index f6760f3174..397d4fd4da 100644 --- a/src/grp-machine/machinectl/Makefile +++ b/src/grp-machine/machinectl/Makefile @@ -27,6 +27,7 @@ machinectl_SOURCES = \ src/machine/machinectl.c machinectl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la rootbin_PROGRAMS += \ diff --git a/src/grp-machine/systemd-machined/Makefile b/src/grp-machine/systemd-machined/Makefile index 432a792a18..011e740e02 100644 --- a/src/grp-machine/systemd-machined/Makefile +++ b/src/grp-machine/systemd-machined/Makefile @@ -28,6 +28,9 @@ systemd_machined_SOURCES = \ src/machine/machined.h systemd_machined_LDADD = \ + libsystemd-internal.la \ + libsystemd-shared.la \ + libsystemd-basic.la \ libmachine-core.la rootlibexec_PROGRAMS += \ @@ -63,13 +66,4 @@ polkitpolicy_in_files += \ EXTRA_DIST += \ units/systemd-machined.service.in -# ------------------------------------------------------------------------------ -ifneq ($(ENABLE_IMPORTD),) - -ifneq ($(HAVE_LIBCURL),) -ifneq ($(HAVE_XZ),) -ifneq ($(HAVE_ZLIB),) -ifneq ($(HAVE_BZIP2),) -ifneq ($(HAVE_GCRYPT),) - include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-network/Makefile b/src/grp-network/Makefile index 504395e39d..d5e6d62689 100644 --- a/src/grp-network/Makefile +++ b/src/grp-network/Makefile @@ -23,7 +23,8 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -dist_network_DATA = \ +# TODO +_dist_network_DATA = \ network/99-default.link \ network/80-container-host0.network \ network/80-container-ve.network \ @@ -72,10 +73,8 @@ gperf_gperf_sources += \ src/network/networkd-network-gperf.gperf \ src/network/networkd-netdev-gperf.gperf -EXTRA_DIST += \ - units/systemd-networkd.service.m4.in \ - units/systemd-networkd-wait-online.service.in \ - test/networkd-test.py +dist_systempreset_DATA = \ + 90-networkd.preset nested.subdirs += libnetworkd-core nested.subdirs += networkctl diff --git a/src/grp-network/libnetworkd-core/Makefile b/src/grp-network/libnetworkd-core/Makefile index 5b4501f9ef..591e7830b6 100644 --- a/src/grp-network/libnetworkd-core/Makefile +++ b/src/grp-network/libnetworkd-core/Makefile @@ -94,6 +94,10 @@ nodist_libnetworkd_core_la_SOURCES = \ libnetworkd_core_la_LIBADD = \ libsystemd-network.la \ + libsystemd-internal.la \ + libsystemd-firewall.la \ libsystemd-shared.la +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-network/libnetworkd-core/networkd-manager.c b/src/grp-network/libnetworkd-core/networkd-manager.c index d7d149ebb5..1babedcce7 100644 --- a/src/grp-network/libnetworkd-core/networkd-manager.c +++ b/src/grp-network/libnetworkd-core/networkd-manager.c @@ -25,7 +25,6 @@ #include "libudev-private.h" #include "sd-bus/bus-util.h" -#include "sd-netlink/local-addresses.h" #include "sd-netlink/netlink-util.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/def.h" @@ -37,6 +36,7 @@ #include "systemd-basic/virt.h" #include "systemd-shared/conf-parser.h" #include "systemd-shared/dns-domain.h" +#include "systemd-shared/local-addresses.h" #include "systemd-shared/udev-util.h" #include "systemd-staging/sd-netlink.h" diff --git a/src/grp-network/networkctl/Makefile b/src/grp-network/networkctl/Makefile index 7b651c7f74..4343011157 100644 --- a/src/grp-network/networkctl/Makefile +++ b/src/grp-network/networkctl/Makefile @@ -30,6 +30,7 @@ networkctl_SOURCES = \ src/network/networkctl.c networkctl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ libsystemd-network.la diff --git a/src/grp-network/networkctl/networkctl.c b/src/grp-network/networkctl/networkctl.c index bc95b4fb24..fd75f1aed8 100644 --- a/src/grp-network/networkctl/networkctl.c +++ b/src/grp-network/networkctl/networkctl.c @@ -23,7 +23,6 @@ #include "sd-device/device-util.h" #include "sd-hwdb/hwdb-util.h" -#include "sd-netlink/local-addresses.h" #include "sd-netlink/netlink-util.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/arphrd-list.h" @@ -42,6 +41,7 @@ #include "systemd-basic/util.h" #include "systemd-basic/verbs.h" #include "systemd-network/sd-lldp.h" +#include "systemd-shared/local-addresses.h" #include "systemd-shared/pager.h" #include "systemd-staging/sd-device.h" #include "systemd-staging/sd-hwdb.h" diff --git a/src/grp-network/systemd-networkd-wait-online/Makefile b/src/grp-network/systemd-networkd-wait-online/Makefile index 421bb9a673..1b0c801833 100644 --- a/src/grp-network/systemd-networkd-wait-online/Makefile +++ b/src/grp-network/systemd-networkd-wait-online/Makefile @@ -37,7 +37,17 @@ systemd_networkd_wait_online_SOURCES = \ src/network/networkd-wait-online-link.c systemd_networkd_wait_online_LDADD = \ + libsystemd-internal.la \ libsystemd-network.la \ libsystemd-shared.la +nodist_systemunit_DATA += \ + units/systemd-networkd-wait-online.service + +GENERAL_ALIASES += \ + $(systemunitdir)/systemd-networkd-wait-online.service $(pkgsysconfdir)/system/network-online.target.wants/systemd-networkd-wait-online.service + +EXTRA_DIST += \ + units/systemd-networkd-wait-online.service.in + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-network/systemd-networkd/Makefile b/src/grp-network/systemd-networkd/Makefile index 118f627c16..9036159c70 100644 --- a/src/grp-network/systemd-networkd/Makefile +++ b/src/grp-network/systemd-networkd/Makefile @@ -30,6 +30,7 @@ systemd_networkd_SOURCES = \ src/network/networkd.c systemd_networkd_LDADD = \ + libsystemd-basic.la \ libnetworkd-core.la ifneq ($(HAVE_LIBIPTC),) @@ -41,8 +42,7 @@ dist_systemunit_DATA += \ units/systemd-networkd.socket nodist_systemunit_DATA += \ - units/systemd-networkd.service \ - units/systemd-networkd-wait-online.service + units/systemd-networkd.service dist_systemunit_DATA_busnames += \ units/org.freedesktop.network1.busname @@ -55,8 +55,7 @@ dist_dbuspolicy_DATA += \ GENERAL_ALIASES += \ $(systemunitdir)/systemd-networkd.socket $(pkgsysconfdir)/system/sockets.target.wants/systemd-networkd.socket \ - $(systemunitdir)/systemd-networkd.service $(pkgsysconfdir)/system/multi-user.target.wants/systemd-networkd.service \ - $(systemunitdir)/systemd-networkd-wait-online.service $(pkgsysconfdir)/system/network-online.target.wants/systemd-networkd-wait-online.service + $(systemunitdir)/systemd-networkd.service $(pkgsysconfdir)/system/multi-user.target.wants/systemd-networkd.service SYSTEM_UNIT_ALIASES += \ systemd-networkd.service dbus-org.freedesktop.network1.service @@ -64,4 +63,8 @@ SYSTEM_UNIT_ALIASES += \ BUSNAMES_TARGET_WANTS += \ org.freedesktop.network1.busname +EXTRA_DIST += \ + units/systemd-networkd.service.m4.in \ + test/networkd-test.py + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-resolve/Makefile b/src/grp-resolve/Makefile index 8132573d49..5e90fec8c7 100644 --- a/src/grp-resolve/Makefile +++ b/src/grp-resolve/Makefile @@ -23,6 +23,9 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk +dist_systempreset_DATA = \ + 90-resolved.preset + nested.subdirs += libbasic-dns nested.subdirs += nss-resolve nested.subdirs += systemd-resolve diff --git a/src/grp-resolve/libbasic-dns/src/Makefile b/src/grp-resolve/libbasic-dns/src/Makefile index d7f12fafd4..ac3551fc1f 100644 --- a/src/grp-resolve/libbasic-dns/src/Makefile +++ b/src/grp-resolve/libbasic-dns/src/Makefile @@ -23,16 +23,16 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -$(outdir)/dns_type-list.txt: src/resolve/dns-type.h +$(outdir)/dns_type-list.txt: $(call at.path,$(srcdir)/../include/basic-dns/dns-type.h) $(AM_V_GEN)$(SED) -n -r 's/.* DNS_TYPE_(\w+).*/\1/p' <$< >$@ -$(outdir)/dns_type-to-name.h: src/resolve/dns_type-list.txt +$(outdir)/dns_type-to-name.h: $(outdir)/dns_type-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *dns_type_to_string(int type) {\n\tswitch(type) {" } {printf " case DNS_TYPE_%s: return ", $$1; sub(/_/, "-"); printf "\"%s\";\n", $$1 } END{ print " default: return NULL;\n\t}\n}\n" }' <$< >$@ -$(outdir)/dns_type-from-name.gperf: src/resolve/dns_type-list.txt +$(outdir)/dns_type-from-name.gperf: $(outdir)/dns_type-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct dns_type_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { s=$$1; sub(/_/, "-", s); printf "%s, ", $$s; printf "DNS_TYPE_%s\n", $$1 }' <$< >$@ -basic_dns_sources = \ +libbasic_dns_la_SOURCES = \ src/resolve/resolved-dns-dnssec.c \ src/resolve/resolved-dns-dnssec.h \ src/resolve/resolved-dns-packet.c \ @@ -49,4 +49,11 @@ basic_dns_sources = \ gperf_txt_sources += \ src/resolve/dns_type-list.txt +noinst_LTLIBRARIES = libbasic-dns.la +libbasic_dns_la_LIBADD += \ + libsystemd-gcrypt.la \ + libsystemd-shared.la + +$(outdir)/dns-type.lo: $(outdir)/dns_type-from-name.h $(outdir)/dns_type-to-name.h + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-resolve/libbasic-dns/test/Makefile b/src/grp-resolve/libbasic-dns/test/Makefile index 165f401d26..4f4cbd42a3 100644 --- a/src/grp-resolve/libbasic-dns/test/Makefile +++ b/src/grp-resolve/libbasic-dns/test/Makefile @@ -42,6 +42,7 @@ test_resolve_tables_CFLAGS = \ $(GCRYPT_CFLAGS) test_resolve_tables_LDADD = \ + libbasic-dns.la \ libsystemd-shared.la \ $(GCRYPT_LIBS) \ -lm @@ -57,6 +58,7 @@ test_dns_packet_CFLAGS = \ $(GCRYPT_CFLAGS) test_dns_packet_LDADD = \ + libbasic-dns.la \ libsystemd-shared.la \ $(GCRYPT_LIBS) \ -lm @@ -82,6 +84,7 @@ test_dnssec_CFLAGS = \ $(GCRYPT_CFLAGS) test_dnssec_LDADD = \ + libbasic-dns.la \ libsystemd-shared.la \ $(GCRYPT_LIBS) \ -lm diff --git a/src/grp-resolve/systemd-resolve/Makefile b/src/grp-resolve/systemd-resolve/Makefile index 9d9b46d58d..ef8b1785dc 100644 --- a/src/grp-resolve/systemd-resolve/Makefile +++ b/src/grp-resolve/systemd-resolve/Makefile @@ -23,11 +23,11 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk +basic_dns_sources = + systemd_resolve_SOURCES = \ src/resolve/resolve-tool.c \ - $(basic_dns_sources) \ - src/shared/gcrypt-util.c \ - src/shared/gcrypt-util.h + $(basic_dns_sources) nodist_systemd_resolve_SOURCES = \ src/resolve/dns_type-from-name.h \ @@ -37,6 +37,9 @@ systemd_resolve_CFLAGS = \ $(GCRYPT_CFLAGS) systemd_resolve_LDADD = \ + libsystemd-internal.la \ + libsystemd-gcrypt.la \ + libbasic-dns.la \ libsystemd-shared.la \ $(GCRYPT_LIBS) \ -lm diff --git a/src/grp-resolve/systemd-resolved/Makefile b/src/grp-resolve/systemd-resolved/Makefile index e8ae8ccc28..f1cd91483e 100644 --- a/src/grp-resolve/systemd-resolved/Makefile +++ b/src/grp-resolve/systemd-resolved/Makefile @@ -23,7 +23,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -ifneq ($(ENABLE_RESOLVED),) +basic_dns_sources = systemd_resolved_SOURCES = \ src/resolve/resolved.c \ @@ -68,9 +68,7 @@ systemd_resolved_SOURCES = \ src/resolve/resolved-dns-stub.h \ src/resolve/resolved-dns-stub.c \ src/resolve/resolved-etc-hosts.h \ - src/resolve/resolved-etc-hosts.c \ - src/shared/gcrypt-util.c \ - src/shared/gcrypt-util.h + src/resolve/resolved-etc-hosts.c nodist_systemd_resolved_SOURCES = \ src/resolve/dns_type-from-name.h \ @@ -81,6 +79,8 @@ systemd_resolved_CFLAGS = \ $(GCRYPT_CFLAGS) systemd_resolved_LDADD = \ + libbasic-dns.la \ + libsystemd-internal.la \ libsystemd-network.la \ libsystemd-shared.la \ $(GCRYPT_LIBS) \ @@ -113,7 +113,6 @@ GENERAL_ALIASES += \ nodist_pkgsysconf_DATA += \ src/resolve/resolved.conf -endif # ENABLE_RESOLVED gperf_gperf_sources += \ src/resolve/resolved-gperf.gperf @@ -124,4 +123,6 @@ EXTRA_DIST += \ dist_rootlibexec_DATA += \ src/resolve/resolv.conf +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-query.c b/src/grp-resolve/systemd-resolved/resolved-dns-query.c index 2193dc5bcf..75229d5b1e 100644 --- a/src/grp-resolve/systemd-resolved/resolved-dns-query.c +++ b/src/grp-resolve/systemd-resolved/resolved-dns-query.c @@ -18,11 +18,11 @@ ***/ #include "basic-dns/dns-type.h" -#include "sd-netlink/local-addresses.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/hostname-util.h" #include "systemd-basic/string-util.h" #include "systemd-shared/dns-domain.h" +#include "systemd-shared/local-addresses.h" #include "resolved-dns-query.h" #include "resolved-dns-synthesize.h" diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-scope.h b/src/grp-resolve/systemd-resolved/resolved-dns-scope.h index 26623b1878..69dd6320d3 100644 --- a/src/grp-resolve/systemd-resolved/resolved-dns-scope.h +++ b/src/grp-resolve/systemd-resolved/resolved-dns-scope.h @@ -32,6 +32,7 @@ typedef struct DnsScope DnsScope; #include "resolved-dns-stream.h" #include "resolved-dns-zone.h" #include "resolved-link.h" +#include "resolved-manager.h" typedef enum DnsScopeMatch { DNS_SCOPE_NO, diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-server.h b/src/grp-resolve/systemd-resolved/resolved-dns-server.h index cb0ad80292..299beecefe 100644 --- a/src/grp-resolve/systemd-resolved/resolved-dns-server.h +++ b/src/grp-resolve/systemd-resolved/resolved-dns-server.h @@ -23,16 +23,6 @@ typedef struct DnsServer DnsServer; -typedef enum DnsServerType { - DNS_SERVER_SYSTEM, - DNS_SERVER_FALLBACK, - DNS_SERVER_LINK, -} DnsServerType; -#define _DNS_SERVER_TYPE_MAX (DNS_SERVER_LINK + 1) - -const char* dns_server_type_to_string(DnsServerType i) _const_; -DnsServerType dns_server_type_from_string(const char *s) _pure_; - typedef enum DnsServerFeatureLevel { DNS_SERVER_FEATURE_LEVEL_TCP, DNS_SERVER_FEATURE_LEVEL_UDP, @@ -49,9 +39,19 @@ typedef enum DnsServerFeatureLevel { const char* dns_server_feature_level_to_string(int i) _const_; int dns_server_feature_level_from_string(const char *s) _pure_; +typedef enum DnsServerType { + DNS_SERVER_SYSTEM, + DNS_SERVER_FALLBACK, + DNS_SERVER_LINK, +} DnsServerType; +#define _DNS_SERVER_TYPE_MAX (DNS_SERVER_LINK + 1) + #include "resolved-link.h" #include "resolved-manager.h" +const char* dns_server_type_to_string(DnsServerType i) _const_; +DnsServerType dns_server_type_from_string(const char *s) _pure_; + struct DnsServer { Manager *manager; diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c b/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c index 53d1940d9e..84cf632244 100644 --- a/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c +++ b/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c @@ -17,9 +17,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-netlink/local-addresses.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/hostname-util.h" +#include "systemd-shared/local-addresses.h" #include "resolved-dns-synthesize.h" diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-transaction.h b/src/grp-resolve/systemd-resolved/resolved-dns-transaction.h index 705336221d..babc206f7f 100644 --- a/src/grp-resolve/systemd-resolved/resolved-dns-transaction.h +++ b/src/grp-resolve/systemd-resolved/resolved-dns-transaction.h @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <systemd/sd-event.h> + typedef struct DnsTransaction DnsTransaction; typedef enum DnsTransactionState DnsTransactionState; typedef enum DnsTransactionSource DnsTransactionSource; diff --git a/src/grp-resolve/systemd-resolved/resolved-manager.c b/src/grp-resolve/systemd-resolved/resolved-manager.c index 67bbe30f13..eea95a6fd9 100644 --- a/src/grp-resolve/systemd-resolved/resolved-manager.c +++ b/src/grp-resolve/systemd-resolved/resolved-manager.c @@ -21,7 +21,6 @@ #include <poll.h> #include <sys/ioctl.h> -#include "sd-netlink/netlink-util.h" #include "systemd-basic/af-list.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/dirent-util.h" diff --git a/src/grp-system/Makefile b/src/grp-system/Makefile index b950c8136b..c3dad876f5 100644 --- a/src/grp-system/Makefile +++ b/src/grp-system/Makefile @@ -1,3 +1,4 @@ + # -*- Mode: makefile; indent-tabs-mode: t -*- # # This file is part of systemd. @@ -23,6 +24,9 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk +dist_systempreset_DATA = \ + 90-systemd.preset + nested.subdirs += grp-utils nested.subdirs += libcore nested.subdirs += systemctl diff --git a/src/grp-system/grp-utils/systemd-analyze/Makefile b/src/grp-system/grp-utils/systemd-analyze/Makefile index cb1b72e77d..db8a29e9aa 100644 --- a/src/grp-system/grp-utils/systemd-analyze/Makefile +++ b/src/grp-system/grp-utils/systemd-analyze/Makefile @@ -34,6 +34,7 @@ systemd_analyze_CFLAGS = \ $(MOUNT_CFLAGS) systemd_analyze_LDADD = \ + libsystemd-internal.la \ libcore.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-system/grp-utils/systemd-fstab-generator/Makefile b/src/grp-system/grp-utils/systemd-fstab-generator/Makefile index 43475f69e1..be9090654b 100644 --- a/src/grp-system/grp-utils/systemd-fstab-generator/Makefile +++ b/src/grp-system/grp-utils/systemd-fstab-generator/Makefile @@ -25,10 +25,10 @@ include $(topsrcdir)/build-aux/Makefile.head.mk systemgenerator_PROGRAMS += systemd-fstab-generator systemd_fstab_generator_SOURCES = \ - src/fstab-generator/fstab-generator.c \ - src/core/mount-setup.c + src/fstab-generator/fstab-generator.c systemd_fstab_generator_LDADD = \ + libcore.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-system/grp-utils/systemd-run/Makefile b/src/grp-system/grp-utils/systemd-run/Makefile index 9664591eb6..48559f098e 100644 --- a/src/grp-system/grp-utils/systemd-run/Makefile +++ b/src/grp-system/grp-utils/systemd-run/Makefile @@ -28,6 +28,7 @@ systemd_run_SOURCES = \ src/run/run.c systemd_run_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-system/grp-utils/systemd-sysv-generator/Makefile b/src/grp-system/grp-utils/systemd-sysv-generator/Makefile index 9dec62efdc..dfb065af90 100644 --- a/src/grp-system/grp-utils/systemd-sysv-generator/Makefile +++ b/src/grp-system/grp-utils/systemd-sysv-generator/Makefile @@ -29,18 +29,10 @@ systemd_sysv_generator_SOURCES = \ systemd_sysv_generator_LDADD = \ libcore.la -ifneq ($(HAVE_SYSV_COMPAT),) sysvinit_DATA = \ docs/sysvinit/README -$(outdir)/README: docs/sysvinit/README.in - $(SED_PROCESS) - -CLEANFILES += \ - docs/sysvinit/README -endif # HAVE_SYSV_COMPAT - EXTRA_DIST += \ - docs/sysvinit/README.in + docs/sysvinit/README.in \ include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-system/libcore/include/core/bus-policy.h b/src/grp-system/libcore/include/core/bus-policy.h index a338f29af6..3fb64f0fd0 100644 --- a/src/grp-system/libcore/include/core/bus-policy.h +++ b/src/grp-system/libcore/include/core/bus-policy.h @@ -19,10 +19,11 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-bus/kdbus.h" #include "systemd-basic/list.h" #include "systemd-basic/macro.h" +struct kdbus_item; + typedef struct BusNamePolicy BusNamePolicy; typedef enum BusPolicyAccess { diff --git a/src/grp-system/libcore/include/core/busname.h b/src/grp-system/libcore/include/core/busname.h index aa7f0ecb1b..95a356bddc 100644 --- a/src/grp-system/libcore/include/core/busname.h +++ b/src/grp-system/libcore/include/core/busname.h @@ -20,7 +20,6 @@ ***/ typedef struct BusName BusName; -typedef struct BusNamePolicy BusNamePolicy; #include "bus-policy.h" #include "unit.h" diff --git a/src/grp-system/libcore/include/core/device.h b/src/grp-system/libcore/include/core/device.h index 184a1a349b..60d5122966 100644 --- a/src/grp-system/libcore/include/core/device.h +++ b/src/grp-system/libcore/include/core/device.h @@ -21,6 +21,8 @@ typedef struct Device Device; +#include "unit.h" + typedef enum DeviceFound { DEVICE_NOT_FOUND = 0, DEVICE_FOUND_UDEV = 1, diff --git a/src/grp-system/libcore/include/core/killall.h b/src/grp-system/libcore/include/core/killall.h index acc2439f00..bbb101c863 100644 --- a/src/grp-system/libcore/include/core/killall.h +++ b/src/grp-system/libcore/include/core/killall.h @@ -19,4 +19,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <stdbool.h> + void broadcast_signal(int sig, bool wait_for_exit, bool send_sighup); diff --git a/src/grp-system/libcore/include/core/machine-id-setup.h b/src/grp-system/libcore/include/core/machine-id-setup.h index 29f4620646..88830ecc42 100644 --- a/src/grp-system/libcore/include/core/machine-id-setup.h +++ b/src/grp-system/libcore/include/core/machine-id-setup.h @@ -19,5 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <systemd/sd-id128.h> + int machine_id_commit(const char *root); int machine_id_setup(const char *root, sd_id128_t requested, sd_id128_t *ret); diff --git a/src/grp-system/libcore/include/core/mount.h b/src/grp-system/libcore/include/core/mount.h index 148fedf354..7e200e418e 100644 --- a/src/grp-system/libcore/include/core/mount.h +++ b/src/grp-system/libcore/include/core/mount.h @@ -21,6 +21,7 @@ typedef struct Mount Mount; +#include "cgroup.h" #include "dynamic-user.h" #include "kill.h" diff --git a/src/grp-system/libcore/include/core/service.h b/src/grp-system/libcore/include/core/service.h index 1ebf62eed6..7e4763a0ae 100644 --- a/src/grp-system/libcore/include/core/service.h +++ b/src/grp-system/libcore/include/core/service.h @@ -27,6 +27,7 @@ typedef struct ServiceFDStore ServiceFDStore; #include "kill.h" #include "path.h" +#include "socket.h" typedef enum ServiceRestart { SERVICE_RESTART_NO, @@ -203,7 +204,7 @@ struct Service { extern const UnitVTable service_vtable; -int service_set_socket_fd(Service *s, int fd, struct Socket *socket, bool selinux_context_net); +int service_set_socket_fd(Service *s, int fd, Socket *socket, bool selinux_context_net); void service_close_socket_fd(Service *s); const char* service_restart_to_string(ServiceRestart i) _const_; diff --git a/src/grp-system/libcore/include/core/slice.h b/src/grp-system/libcore/include/core/slice.h index c9f3f61067..71e05a4d6a 100644 --- a/src/grp-system/libcore/include/core/slice.h +++ b/src/grp-system/libcore/include/core/slice.h @@ -21,6 +21,8 @@ typedef struct Slice Slice; +#include "unit.h" + struct Slice { Unit meta; diff --git a/src/grp-system/libcore/include/core/smack-setup.h b/src/grp-system/libcore/include/core/smack-setup.h index 78164c85e6..f8c62ce067 100644 --- a/src/grp-system/libcore/include/core/smack-setup.h +++ b/src/grp-system/libcore/include/core/smack-setup.h @@ -21,4 +21,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <stdbool.h> + int mac_smack_setup(bool *loaded_policy); diff --git a/src/grp-system/libcore/include/core/socket.h b/src/grp-system/libcore/include/core/socket.h index feba21dab3..d17bf70f18 100644 --- a/src/grp-system/libcore/include/core/socket.h +++ b/src/grp-system/libcore/include/core/socket.h @@ -24,7 +24,6 @@ typedef struct Socket Socket; typedef struct SocketPeer SocketPeer; -#include "mount.h" #include "service.h" typedef enum SocketExecCommand { diff --git a/src/grp-system/libcore/include/core/swap.h b/src/grp-system/libcore/include/core/swap.h index 64db3267b2..e0c204a062 100644 --- a/src/grp-system/libcore/include/core/swap.h +++ b/src/grp-system/libcore/include/core/swap.h @@ -24,6 +24,8 @@ typedef struct Swap Swap; +#include "unit.h" + typedef enum SwapExecCommand { SWAP_EXEC_ACTIVATE, SWAP_EXEC_DEACTIVATE, diff --git a/src/grp-system/libcore/include/core/target.h b/src/grp-system/libcore/include/core/target.h index 339aea154e..406b80019c 100644 --- a/src/grp-system/libcore/include/core/target.h +++ b/src/grp-system/libcore/include/core/target.h @@ -21,6 +21,8 @@ typedef struct Target Target; +#include "unit.h" + struct Target { Unit meta; diff --git a/src/grp-system/libcore/include/core/timer.h b/src/grp-system/libcore/include/core/timer.h index 9cb30249e3..4195423a61 100644 --- a/src/grp-system/libcore/include/core/timer.h +++ b/src/grp-system/libcore/include/core/timer.h @@ -23,6 +23,8 @@ typedef struct Timer Timer; +#include "unit.h" + typedef enum TimerBase { TIMER_ACTIVE, TIMER_BOOT, diff --git a/src/grp-system/libcore/include/core/unit.h b/src/grp-system/libcore/include/core/unit.h index 6864b71183..f40b23828a 100644 --- a/src/grp-system/libcore/include/core/unit.h +++ b/src/grp-system/libcore/include/core/unit.h @@ -278,8 +278,10 @@ typedef enum UnitSetPropertiesMode { #include "automount.h" #include "busname.h" #include "device.h" +#include "mount.h" #include "path.h" #include "scope.h" +#include "service.h" #include "slice.h" #include "socket.h" #include "swap.h" diff --git a/src/grp-system/libcore/src/Makefile b/src/grp-system/libcore/src/Makefile index cd63651f2a..ab731a5b4f 100644 --- a/src/grp-system/libcore/src/Makefile +++ b/src/grp-system/libcore/src/Makefile @@ -157,6 +157,7 @@ libcore_la_CFLAGS = \ $(SECCOMP_CFLAGS) libcore_la_LIBADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ $(PAM_LIBS) \ $(AUDIT_LIBS) \ @@ -164,7 +165,12 @@ libcore_la_LIBADD = \ $(APPARMOR_LIBS) \ $(MOUNT_LIBS) -$(outdir)/load-fragment-gperf-nulstr.c: src/core/load-fragment-gperf.gperf +$(outdir)/load-fragment-gperf-nulstr.c: $(outdir)/load-fragment-gperf.gperf $(AM_V_GEN)$(AWK) 'BEGIN{ keywords=0 ; FS="," ; print "extern const char load_fragment_gperf_nulstr[];" ; print "const char load_fragment_gperf_nulstr[] ="} ; keyword==1 { print "\"" $$1 "\\0\"" } ; /%%/ { keyword=1} ; END { print ";" }' < $< > $@ +sd.CPPFLAGS += -DMOUNT_PATH=\"$(MOUNT_PATH)\" +sd.CPPFLAGS += -DUMOUNT_PATH=\"$(UMOUNT_PATH)\" +sd.CPPFLAGS += -DSYSTEMD_CGROUP_AGENT_PATH=\"$(libexecdir)/systemd-cgroups-agent\" +sd.CPPFLAGS += -DSYSTEMD_BINARY_PATH=\"$(libexecdir)/systemd\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-system/libcore/src/dbus-automount.h b/src/grp-system/libcore/src/dbus-automount.h index f41adda2a6..5131d747d4 100644 --- a/src/grp-system/libcore/src/dbus-automount.h +++ b/src/grp-system/libcore/src/dbus-automount.h @@ -19,6 +19,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <systemd/sd-bus.h> + +#include "core/unit.h" extern const sd_bus_vtable bus_automount_vtable[]; diff --git a/src/grp-system/libcore/src/dbus-busname.h b/src/grp-system/libcore/src/dbus-busname.h index 8643d1a404..c6aa90a424 100644 --- a/src/grp-system/libcore/src/dbus-busname.h +++ b/src/grp-system/libcore/src/dbus-busname.h @@ -19,5 +19,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <systemd/sd-bus.h> extern const sd_bus_vtable bus_busname_vtable[]; diff --git a/src/grp-system/libcore/src/dbus-path.h b/src/grp-system/libcore/src/dbus-path.h index d3c19e0c2b..f24b1d5d3d 100644 --- a/src/grp-system/libcore/src/dbus-path.h +++ b/src/grp-system/libcore/src/dbus-path.h @@ -19,6 +19,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ - +#include <systemd/sd-bus.h> extern const sd_bus_vtable bus_path_vtable[]; diff --git a/src/grp-system/libcore/src/linux/auto_dev-ioctl.h b/src/grp-system/libcore/src/linux/auto_dev-ioctl.h index aeaeb3ea7a..56ab047141 100644 --- a/src/grp-system/libcore/src/linux/auto_dev-ioctl.h +++ b/src/grp-system/libcore/src/linux/auto_dev-ioctl.h @@ -10,6 +10,7 @@ #ifndef _LINUX_AUTO_DEV_IOCTL_H #define _LINUX_AUTO_DEV_IOCTL_H +#include <linux/limits.h> #include <linux/auto_fs.h> #ifdef __KERNEL__ diff --git a/src/grp-system/libcore/src/loopback-setup.c b/src/grp-system/libcore/src/loopback-setup.c index 8eb6251bd7..d7085640e1 100644 --- a/src/grp-system/libcore/src/loopback-setup.c +++ b/src/grp-system/libcore/src/loopback-setup.c @@ -21,7 +21,6 @@ #include <stdlib.h> #include "core/loopback-setup.h" -#include "sd-netlink/netlink-util.h" #include "systemd-basic/missing.h" #include "systemd-staging/sd-netlink.h" diff --git a/src/grp-system/libcore/src/target.c b/src/grp-system/libcore/src/target.c index 1e5212d75d..717dee06a9 100644 --- a/src/grp-system/libcore/src/target.c +++ b/src/grp-system/libcore/src/target.c @@ -17,7 +17,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "core/target.h" #include "core/unit.h" #include "systemd-basic/log.h" #include "systemd-basic/special.h" diff --git a/src/grp-system/systemctl/.gitignore b/src/grp-system/systemctl/.gitignore index ebd59d3c9e..89c7427edd 100644 --- a/src/grp-system/systemctl/.gitignore +++ b/src/grp-system/systemctl/.gitignore @@ -1,2 +1,2 @@ -/systemctl -/_systemctl +/systemctl.completion.bash +/systemctl.completion.zsh diff --git a/src/grp-system/systemctl/Makefile b/src/grp-system/systemctl/Makefile index 3551118514..5931d4dcbc 100644 --- a/src/grp-system/systemctl/Makefile +++ b/src/grp-system/systemctl/Makefile @@ -28,6 +28,15 @@ systemctl_SOURCES = \ src/systemctl/systemctl.c systemctl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la +files.out.all += systemctl.completion.bash +files.out.all += systemctl.completion.zsh +sd.sed_files += systemctl.completion.bash +sd.sed_files += systemctl.completion.zsh +sd.CPPFLAGS += -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" +sd.CPPFLAGS += -DSYSTEM_SYSVINIT_PATH=\"$(SYSTEM_SYSVINIT_PATH)\" +sd.CPPFLAGS += -DSYSTEMD_BINARY_PATH=\"$(rootlibexecdir)/systemd\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-system/systemd-shutdown/Makefile b/src/grp-system/systemd-shutdown/Makefile index f68758174a..619f1bbdb5 100644 --- a/src/grp-system/systemd-shutdown/Makefile +++ b/src/grp-system/systemd-shutdown/Makefile @@ -27,13 +27,13 @@ rootlibexec_PROGRAMS += systemd-shutdown systemd_shutdown_SOURCES = \ src/core/umount.c \ src/core/umount.h \ - src/core/shutdown.c \ - src/core/mount-setup.c \ - src/core/mount-setup.h \ - src/core/killall.h \ - src/core/killall.c + src/core/shutdown.c systemd_shutdown_LDADD = \ + libcore.la \ libsystemd-shared.la +sd.CPPFLAGS += -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" +sd.CPPFLAGS += -DKEXEC=\"$(KEXEC)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-system/systemd-shutdown/systemd-shutdown.xml b/src/grp-system/systemd-shutdown/systemd-shutdown.xml index d16e5d628f..b1d1f87ce9 100644 --- a/src/grp-system/systemd-shutdown/systemd-shutdown.xml +++ b/src/grp-system/systemd-shutdown/systemd-shutdown.xml @@ -21,10 +21,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="systemd-halt.service"> +<refentry id="systemd-shutdown"> <refentryinfo> - <title>systemd-halt.service</title> + <title>systemd-shutdown</title> <productname>systemd</productname> <authorgroup> @@ -38,7 +38,7 @@ </refentryinfo> <refmeta> - <refentrytitle>systemd-halt.service</refentrytitle> + <refentrytitle>systemd-shutdown</refentrytitle> <manvolnum>8</manvolnum> </refmeta> diff --git a/src/grp-system/systemd-shutdown/umount.h b/src/grp-system/systemd-shutdown/umount.h index 4e2215a47d..ce2fd9ec58 100644 --- a/src/grp-system/systemd-shutdown/umount.h +++ b/src/grp-system/systemd-shutdown/umount.h @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <stdbool.h> + int umount_all(bool *changed); int swapoff_all(bool *changed); diff --git a/src/grp-system/systemd/50-systemd-user.xorg b/src/grp-system/systemd/50-systemd-user.xinitrc index 4d49767228..4d49767228 100755 --- a/src/grp-system/systemd/50-systemd-user.xorg +++ b/src/grp-system/systemd/50-systemd-user.xinitrc diff --git a/src/grp-system/systemd/Makefile b/src/grp-system/systemd/Makefile index 7f7fbb963e..ab2a5fa7c8 100644 --- a/src/grp-system/systemd/Makefile +++ b/src/grp-system/systemd/Makefile @@ -32,7 +32,12 @@ systemd_CFLAGS = \ $(MOUNT_CFLAGS) systemd_LDADD = \ - libcore.la + libcore.la \ + libsystemd-internal.la + +dist_tmpfiles_DATA = \ + tmpfiles.d/systemd.conf \ + systemd-tmpfs.conf dist_pkgsysconf_DATA += \ src/core/system.conf \ @@ -70,4 +75,10 @@ dist_systemunit_DATA_busnames += \ BUSNAMES_TARGET_WANTS += \ org.freedesktop.systemd1.busname +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" + +sd.CPPFLAGS += -DSYSTEMD_BINARY_PATH=\"$(rootlibexecdir)/systemd\" +sd.CPPFLAGS += -DSYSTEMD_SHUTDOWN_BINARY_PATH=\"$(rootlibexecdir)/systemd-shutdown\" +sd.CPPFLAGS += -DSYSTEMCTL_BINARY_PATH=\"$(rootbindir)/systemctl\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-timedate/systemd-timedated/Makefile b/src/grp-timedate/systemd-timedated/Makefile index d06142536e..7478f8e568 100644 --- a/src/grp-timedate/systemd-timedated/Makefile +++ b/src/grp-timedate/systemd-timedated/Makefile @@ -28,6 +28,7 @@ systemd_timedated_SOURCES = \ src/timedate/timedated.c systemd_timedated_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la rootlibexec_PROGRAMS += \ diff --git a/src/grp-timedate/timedatectl/Makefile b/src/grp-timedate/timedatectl/Makefile index b1093dad9b..4bb965d6c0 100644 --- a/src/grp-timedate/timedatectl/Makefile +++ b/src/grp-timedate/timedatectl/Makefile @@ -28,6 +28,7 @@ timedatectl_SOURCES = \ src/timedate/timedatectl.c timedatectl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la bin_PROGRAMS += \ diff --git a/src/grp-udev/libudev-core/Makefile b/src/grp-udev/libudev-core/Makefile index 14d4e827a0..54a61b24ce 100644 --- a/src/grp-udev/libudev-core/Makefile +++ b/src/grp-udev/libudev-core/Makefile @@ -26,7 +26,7 @@ include $(topsrcdir)/build-aux/Makefile.head.mk noinst_LTLIBRARIES += \ libudev-core.la -$(outdir)/keyboard-keys-list.txt: +$(outdir)/keyboard-keys-list.txt: | $(outdir)/$(DEPDIR) $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include linux/input.h - < /dev/null | $(AWK) '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9K]/ { if ($$2 != "KEY_MAX") { print $$2 } }' > $@ $(outdir)/keyboard-keys-from-name.gperf: $(outdir)/keyboard-keys-list.txt @@ -38,7 +38,7 @@ $(outdir)/keyboard-keys-from-name.h: $(outdir)/keyboard-keys-from-name.gperf gperf_txt_sources += \ src/udev/keyboard-keys-list.txt -libudev_core_la_SOURCES = \ +_libudev_core_la_SOURCES = \ src/udev/udev.h \ src/udev/udev-event.c \ src/udev/udev-watch.c \ @@ -59,7 +59,7 @@ libudev_core_la_SOURCES = \ src/udev/net/ethtool-util.h \ src/udev/net/ethtool-util.c -nodist_libudev_core_la_SOURCES = \ +_nodist_libudev_core_la_SOURCES = \ src/udev/keyboard-keys-from-name.h \ src/udev/net/link-config-gperf.c @@ -71,6 +71,9 @@ libudev_core_la_CFLAGS = \ $(KMOD_CFLAGS) libudev_core_la_LIBADD = \ + libsystemd-internal.la \ + libsystemd-basic.la \ + libsystemd-staging.la \ libsystemd-network.la \ libsystemd-shared.la \ $(BLKID_LIBS) \ @@ -94,6 +97,11 @@ libudev_core_la_SOURCES += \ src/systemd/sd-login.h endif # HAVE_ACL +sd.libudev-core_SOURCES = $(patsubst src/udev/%,%,$(filter %.c,$(_libudev_core_la_SOURCES) $(_nodist_libudev_core_la_SOURCES))) +$(outdir)/libudev-core.la: $(addprefix $(outdir)/,$(sd.libudev-core_SOURCES:.c=.lo)) +$(outdir)/udev-builtin-keyboard.lo: $(outdir)/keyboard-keys-from-name.h +sd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" + nested.subdirs += net include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-udev/libudev-core/net/Makefile b/src/grp-udev/libudev-core/net/Makefile index ac615aad3b..afe70e8a3d 100644 --- a/src/grp-udev/libudev-core/net/Makefile +++ b/src/grp-udev/libudev-core/net/Makefile @@ -23,7 +23,10 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -sd.CPPFLAGS += $(libsystemd-shared.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-internal.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS) sd.CPPFLAGS += $(libsystemd-network.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-shared.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-staging.CPPFLAGS) include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-udev/libudev-core/udev-builtin-input_id.c b/src/grp-udev/libudev-core/udev-builtin-input_id.c index d4ba49addd..e34b761cd1 100644 --- a/src/grp-udev/libudev-core/udev-builtin-input_id.c +++ b/src/grp-udev/libudev-core/udev-builtin-input_id.c @@ -28,8 +28,8 @@ #include <string.h> #include <unistd.h> -#include <linux/limits.h> #include <linux/input.h> +#include <linux/limits.h> #include "systemd-basic/fd-util.h" #include "systemd-basic/stdio-util.h" diff --git a/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c b/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c index 38d0955f3d..b64ea049ec 100644 --- a/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c +++ b/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c @@ -17,11 +17,12 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "link-config.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/log.h" #include "udev.h" +#include "net/link-config.h" + static link_config_ctx *ctx = NULL; static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv, bool test) { diff --git a/src/grp-udev/mtd_probe/Makefile b/src/grp-udev/mtd_probe/Makefile index d7392a8a3b..dc408a7d4e 100644 --- a/src/grp-udev/mtd_probe/Makefile +++ b/src/grp-udev/mtd_probe/Makefile @@ -34,4 +34,6 @@ dist_udevrules_DATA += \ udevlibexec_PROGRAMS += \ mtd_probe +mtd_probe_LDADD += libsystemd-basic.la + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-udev/scsi_id/scsi.h b/src/grp-udev/scsi_id/scsi.h index a27a84a40a..497cfe3e31 100644 --- a/src/grp-udev/scsi_id/scsi.h +++ b/src/grp-udev/scsi_id/scsi.h @@ -13,6 +13,7 @@ */ #include <scsi/scsi.h> +#include <sys/types.h> struct scsi_ioctl_command { unsigned int inlen; /* excluding scsi command length */ diff --git a/src/grp-udev/scsi_id/scsi_id.h b/src/grp-udev/scsi_id/scsi_id.h index 5c2e1c28ee..86d56a0c3f 100644 --- a/src/grp-udev/scsi_id/scsi_id.h +++ b/src/grp-udev/scsi_id/scsi_id.h @@ -17,6 +17,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <libudev.h> + #define MAX_PATH_LEN 512 /* diff --git a/src/grp-udev/systemd-hwdb/Makefile b/src/grp-udev/systemd-hwdb/Makefile index 6f6731b3be..901753bdf0 100644 --- a/src/grp-udev/systemd-hwdb/Makefile +++ b/src/grp-udev/systemd-hwdb/Makefile @@ -32,6 +32,7 @@ systemd_hwdb_SOURCES = \ src/hwdb/hwdb.c systemd_hwdb_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la rootbin_PROGRAMS += \ @@ -45,4 +46,6 @@ endif # ENABLE_HWDB EXTRA_DIST += \ units/systemd-hwdb-update.service.in +sd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-udev/systemd-hwdb/systemd-hwdb.completion.bash b/src/grp-udev/systemd-hwdb/systemd-hwdb.completion.bash new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-udev/systemd-hwdb/systemd-hwdb.completion.bash diff --git a/src/grp-udev/systemd-hwdb/systemd-hwdb.completion.zsh b/src/grp-udev/systemd-hwdb/systemd-hwdb.completion.zsh new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-udev/systemd-hwdb/systemd-hwdb.completion.zsh diff --git a/src/grp-udev/systemd-udevd/udevd.c b/src/grp-udev/systemd-udevd/udevd.c index ce50235c1b..942d733ee8 100644 --- a/src/grp-udev/systemd-udevd/udevd.c +++ b/src/grp-udev/systemd-udevd/udevd.c @@ -43,7 +43,6 @@ #include <systemd/sd-daemon.h> #include <systemd/sd-event.h> -#include "sd-netlink/netlink-util.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/cgroup-util.h" #include "systemd-basic/cpu-set-util.h" diff --git a/src/grp-udev/udevadm/Makefile b/src/grp-udev/udevadm/Makefile index 8f723e3a58..537dbcc5b2 100644 --- a/src/grp-udev/udevadm/Makefile +++ b/src/grp-udev/udevadm/Makefile @@ -41,6 +41,9 @@ udevadm_SOURCES = \ udevadm_LDADD = \ libudev-core.la \ + libsystemd-internal.la \ libsystemd-basic.la +sd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-utils/systemd-escape/systemd-escape.completion.bash b/src/grp-utils/systemd-escape/systemd-escape.completion.bash new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-utils/systemd-escape/systemd-escape.completion.bash diff --git a/src/grp-utils/systemd-escape/systemd-escape.completion.zsh b/src/grp-utils/systemd-escape/systemd-escape.completion.zsh new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-utils/systemd-escape/systemd-escape.completion.zsh diff --git a/src/grp-utils/systemd-path/Makefile b/src/grp-utils/systemd-path/Makefile index e2e40e0121..d8abf0f2ee 100644 --- a/src/grp-utils/systemd-path/Makefile +++ b/src/grp-utils/systemd-path/Makefile @@ -26,9 +26,13 @@ include $(topsrcdir)/build-aux/Makefile.head.mk bin_PROGRAMS += systemd-path systemd_path_SOURCES = \ + sd-path.c \ src/path/path.c systemd_path_LDADD = \ - libsystemd-shared.la + libsystemd-basic.la + +sd.CPPFLAGS += -DLIBDIR=\"$(libdir)\" +sd.CPPFLAGS += -DROOTLIBDIR=\"$(rootlibdir)\" include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-utils/systemd-path/systemd-path.completion.zsh b/src/grp-utils/systemd-path/systemd-path.completion.zsh new file mode 100644 index 0000000000..4919cf4250 --- /dev/null +++ b/src/grp-utils/systemd-path/systemd-path.completion.zsh @@ -0,0 +1,18 @@ +#compdef systemd-path + +__get_names() { + systemd-path | { while IFS=: read -r a b; do echo " $a"; done; } +} + +__names() { + local -a _names + _names=(${(fo)"$(__get_names)"}) + typeset -U _names + _describe 'names' _names +} + +_arguments \ + {-h,--help}'[Show help message]' \ + '--version[Show package version]' \ + '--host=[Sufix to append to paths]:suffix' \ + '*:name:__names' diff --git a/src/grp-utils/systemd-socket-activate/systemd-socket-activate.completion.bash b/src/grp-utils/systemd-socket-activate/systemd-socket-activate.completion.bash new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-utils/systemd-socket-activate/systemd-socket-activate.completion.bash diff --git a/src/grp-utils/systemd-socket-activate/systemd-socket-activate.completion.zsh b/src/grp-utils/systemd-socket-activate/systemd-socket-activate.completion.zsh new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/grp-utils/systemd-socket-activate/systemd-socket-activate.completion.zsh diff --git a/src/libsystemd-basic/include/systemd-basic/btrfs-ctree.h b/src/libsystemd-basic/include/systemd-basic/btrfs-ctree.h index 66bdf9736e..15e6d5582c 100644 --- a/src/libsystemd-basic/include/systemd-basic/btrfs-ctree.h +++ b/src/libsystemd-basic/include/systemd-basic/btrfs-ctree.h @@ -1,6 +1,7 @@ #pragma once #include "macro.h" +#include "missing.h" /* for BTRFS_UUID_SIZE */ #include "sparse-endian.h" /* Stolen from btrfs' ctree.h */ diff --git a/src/libsystemd-basic/include/systemd-basic/missing_syscall.h b/src/libsystemd-basic/include/systemd-basic/missing_syscall.h index e6fd67cb9d..9afba975fb 100644 --- a/src/libsystemd-basic/include/systemd-basic/missing_syscall.h +++ b/src/libsystemd-basic/include/systemd-basic/missing_syscall.h @@ -22,6 +22,10 @@ /* Missing glibc definitions to access certain kernel APIs */ +#if __INCLUDE_LEVEL__ <= 1 +#error "Do not include missing_syscall.h directly; include it through missing.h." +#endif + #if !HAVE_DECL_PIVOT_ROOT static inline int pivot_root(const char *new_root, const char *put_old) { return syscall(SYS_pivot_root, new_root, put_old); diff --git a/src/libsystemd-basic/include/systemd-basic/proc-cmdline.h b/src/libsystemd-basic/include/systemd-basic/proc-cmdline.h index 6d6ee95c11..5419d71dc7 100644 --- a/src/libsystemd-basic/include/systemd-basic/proc-cmdline.h +++ b/src/libsystemd-basic/include/systemd-basic/proc-cmdline.h @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <stdbool.h> + int proc_cmdline(char **ret); int parse_proc_cmdline(int (*parse_item)(const char *key, const char *value, void *data), void *data, diff --git a/src/libsystemd-basic/include/systemd-basic/raw-clone.h b/src/libsystemd-basic/include/systemd-basic/raw-clone.h index d473828999..33fdf02f09 100644 --- a/src/libsystemd-basic/include/systemd-basic/raw-clone.h +++ b/src/libsystemd-basic/include/systemd-basic/raw-clone.h @@ -21,6 +21,7 @@ #include <sched.h> #include <sys/syscall.h> +#include <unistd.h> #include "log.h" #include "macro.h" diff --git a/src/libsystemd-basic/include/systemd-basic/rm-rf.h b/src/libsystemd-basic/include/systemd-basic/rm-rf.h index f693a5bb7c..8d315792ac 100644 --- a/src/libsystemd-basic/include/systemd-basic/rm-rf.h +++ b/src/libsystemd-basic/include/systemd-basic/rm-rf.h @@ -19,8 +19,11 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <stdlib.h> #include <sys/stat.h> +#include "macro.h" + typedef enum RemoveFlags { REMOVE_ONLY_DIRECTORIES = 1, REMOVE_ROOT = 2, diff --git a/src/libsystemd-basic/include/systemd-basic/socket-util.h b/src/libsystemd-basic/include/systemd-basic/socket-util.h index 7f1a87bc3e..f0f12c8c2e 100644 --- a/src/libsystemd-basic/include/systemd-basic/socket-util.h +++ b/src/libsystemd-basic/include/systemd-basic/socket-util.h @@ -27,8 +27,8 @@ #include <sys/types.h> #include <sys/un.h> -#include <linux/netlink.h> #include <linux/if_packet.h> +#include <linux/netlink.h> #include "macro.h" #include "util.h" diff --git a/src/libsystemd-basic/include/systemd-basic/time-util.h b/src/libsystemd-basic/include/systemd-basic/time-util.h index 558b0b5b7f..977f7b6bc5 100644 --- a/src/libsystemd-basic/include/systemd-basic/time-util.h +++ b/src/libsystemd-basic/include/systemd-basic/time-util.h @@ -26,6 +26,8 @@ #include <stdio.h> #include <time.h> +#include "macro.h" + typedef uint64_t usec_t; typedef uint64_t nsec_t; diff --git a/src/libsystemd-basic/src/Makefile b/src/libsystemd-basic/src/Makefile index 76336dca63..fd72f23308 100644 --- a/src/libsystemd-basic/src/Makefile +++ b/src/libsystemd-basic/src/Makefile @@ -23,7 +23,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -noinst_LTLIBRARIES += \ +rootlibexec_LTLIBRARIES += \ libsystemd-basic.la libsystemd_basic_la_SOURCES = \ @@ -238,19 +238,19 @@ libsystemd_basic_la_LIBADD = \ -lrt \ -lm -$(outdir)/errno-list.txt: +$(outdir)/errno-list.txt: | $(outdir)/$(DEPDIR) $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@ $(outdir)/errno-to-name.h: $(outdir)/errno-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@ -$(outdir)/af-list.txt: +$(outdir)/af-list.txt: | $(outdir)/$(DEPDIR) $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include sys/socket.h - </dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' >$@ $(outdir)/af-to-name.h: $(outdir)/af-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const af_names[] = { "} !/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@ -$(outdir)/arphrd-list.txt: +$(outdir)/arphrd-list.txt: | $(outdir)/$(DEPDIR) $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include net/if_arp.h - </dev/null | $(AWK) '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $$2; }' | sed -e 's/ARPHRD_//' >$@ $(outdir)/arphrd-to-name.h: $(outdir)/arphrd-list.txt @@ -259,8 +259,8 @@ $(outdir)/arphrd-to-name.h: $(outdir)/arphrd-list.txt $(outdir)/arphrd-from-name.gperf: $(outdir)/arphrd-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct arphrd_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, ARPHRD_%s\n", $$1, $$1 }' <$< >$@ -$(outdir)/cap-list.txt: - $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include linux/capability.h -include missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@ +$(outdir)/cap-list.txt: | $(outdir)/$(DEPDIR) + $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include linux/capability.h -include systemd-basic/missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@ $(outdir)/cap-to-name.h: $(outdir)/cap-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@ @@ -271,4 +271,10 @@ $(outdir)/cap-from-name.gperf: $(outdir)/cap-list.txt $(outdir)/cap-from-name.h: $(outdir)/cap-from-name.gperf $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@ +$(outdir)/af-list.lo: $(outdir)/af-from-name.h $(outdir)/af-to-name.h +$(outdir)/arphrd-list.lo: $(outdir)/arphrd-from-name.h $(outdir)/arphrd-to-name.h +$(outdir)/cap-list.lo: $(outdir)/cap-from-name.h $(outdir)/cap-to-name.h +$(outdir)/errno-list.lo: $(outdir)/errno-from-name.h $(outdir)/errno-to-name.h +sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS) + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd-firewall/src/Makefile b/src/libsystemd-firewall/src/Makefile index b52d1fdad0..577cbb7a9f 100644 --- a/src/libsystemd-firewall/src/Makefile +++ b/src/libsystemd-firewall/src/Makefile @@ -24,7 +24,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk ifneq ($(HAVE_LIBIPTC),) -noinst_LTLIBRARIES += \ +rootlibexec_LTLIBRARIES += \ libsystemd-firewall.la libsystemd_firewall_la_SOURCES = \ @@ -35,6 +35,7 @@ libsystemd_firewall_la_CFLAGS = \ $(LIBIPTC_CFLAGS) libsystemd_firewall_la_LIBADD = \ + libsystemd-basic.la \ $(LIBIPTC_LIBS) endif # HAVE_LIBIPTC diff --git a/src/libsystemd-gcrypt/src/Makefile b/src/libsystemd-gcrypt/src/Makefile index 8166d5a253..6ed001dded 100644 --- a/src/libsystemd-gcrypt/src/Makefile +++ b/src/libsystemd-gcrypt/src/Makefile @@ -23,4 +23,18 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk +rootlibexec_LTLIBRARIES += \ + libsystemd-gcrypt.la + +libsystemd_gcrypt_la_SOURCES = \ + src/shared/gcrypt-util.h \ + src/shared/gcrypt-util.c + +libsystemd_gcrypt_la_CFLAGS = \ + $(GCRYPT_CFLAGS) + +libsystemd_gcrypt_la_LIBADD = \ + libsystemd-basic.la \ + $(GCRYPT_LIBS) + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd-network/src/Makefile b/src/libsystemd-network/src/Makefile index c636e3cab1..3e89f7ca4f 100644 --- a/src/libsystemd-network/src/Makefile +++ b/src/libsystemd-network/src/Makefile @@ -23,7 +23,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -noinst_LTLIBRARIES += \ +rootlibexec_LTLIBRARIES += \ libsystemd-network.la libsystemd_network_la_CFLAGS = \ @@ -78,6 +78,9 @@ libsystemd_network_la_SOURCES = \ src/libsystemd-network/sd-lldp.c libsystemd_network_la_LIBADD = \ + libsystemd-basic.la \ + libsystemd.la \ + libsystemd-shared.la \ $(KMOD_LIBS) include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd-shared/Makefile b/src/libsystemd-shared/Makefile index 369b265ff7..8ba25db413 100644 --- a/src/libsystemd-shared/Makefile +++ b/src/libsystemd-shared/Makefile @@ -24,5 +24,6 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk nested.subdirs += src +nested.subdirs += test include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/src/sd-netlink/local-addresses.h b/src/libsystemd-shared/include/systemd-shared/local-addresses.h index f1e91ccfd2..f1e91ccfd2 100644 --- a/src/libsystemd/src/sd-netlink/local-addresses.h +++ b/src/libsystemd-shared/include/systemd-shared/local-addresses.h diff --git a/src/libsystemd-shared/include/systemd-shared/test-tables.h b/src/libsystemd-shared/include/systemd-shared/test-tables.h index 228e510104..83d3345e68 100644 --- a/src/libsystemd-shared/include/systemd-shared/test-tables.h +++ b/src/libsystemd-shared/include/systemd-shared/test-tables.h @@ -20,6 +20,8 @@ #include <stdio.h> #include <stdlib.h> +#include "systemd-basic/macro.h" + typedef const char* (*lookup_t)(int); typedef int (*reverse_t)(const char*); diff --git a/src/libsystemd-shared/src/Makefile b/src/libsystemd-shared/src/Makefile index 601daf855c..c718f18269 100644 --- a/src/libsystemd-shared/src/Makefile +++ b/src/libsystemd-shared/src/Makefile @@ -23,10 +23,12 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -noinst_LTLIBRARIES += \ +rootlibexec_LTLIBRARIES += \ libsystemd-shared.la libsystemd_shared_la_SOURCES = \ + src/libsystemd/sd-netlink/local-addresses.h \ + src/libsystemd/sd-netlink/local-addresses.c \ src/shared/output-mode.h \ src/shared/output-mode.c \ src/shared/gpt.h \ @@ -94,8 +96,6 @@ libsystemd_shared_la_SOURCES = \ src/shared/import-util.h \ src/shared/sysctl-util.c \ src/shared/sysctl-util.h \ - src/shared/bus-util.c \ - src/shared/bus-util.h \ src/shared/logs-show.c \ src/shared/logs-show.h \ src/shared/machine-image.c \ @@ -135,48 +135,38 @@ libsystemd_shared_la_CFLAGS = \ $(LIBIDN_CFLAGS) \ $(SECCOMP_CFLAGS) +# We can't use libshared.la here because it would +# pull in libsystemd*-internal.la +# -- Felipe Sateler +# What? We're pulling in libsystemd-internal.la +# anyway! +# -- Luke Shumaker libsystemd_shared_la_LIBADD = \ libsystemd-internal.la \ libsystemd-basic.la \ - libsystemd-journal-internal.la \ libudev-internal.la \ $(ACL_LIBS) \ $(LIBIDN_LIBS) \ $(SECCOMP_LIBS) -rootlibexec_LTLIBRARIES += \ - libsystemd-shared.la +libsystemd_shared_la_LDFLAGS = \ + -release $(PACKAGE_VERSION) -libsystemd_shared_la_SOURCES = \ - $(libsystemd_basic_la_SOURCES) \ - $(libsystemd_shared_la_SOURCES) \ - $(libsystemd_internal_la_SOURCES) \ - $(libsystemd_journal_internal_la_SOURCES) \ - $(libudev_internal_la_SOURCES) +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" +sd.CPPFLAGS += -DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" +sd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" +sd.CPPFLAGS += -DSYSTEM_SYSVINIT_PATH=\"$(SYSTEM_SYSVINIT_PATH)\" +sd.CPPFLAGS += -DSYSTEM_SYSVRCND_PATH=\"$(SYSTEM_SYSVRCND_PATH)\" +sd.CPPFLAGS += -DUSER_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/user\" +sd.CPPFLAGS += -DUSER_DATA_UNIT_PATH=\"$(userunitdir)\" -libsystemd_shared_la_CFLAGS = \ - $(libsystemd_basic_la_CFLAGS) \ - $(libsystemd_shared_la_CFLAGS) \ - $(libsystemd_internal_la_CFLAGS) \ - $(libsystemd_journal_internal_la_CFLAGS) \ - $(libudev_internal_la_CFLAGS) \ - $(ACL_CFLAGS) \ - $(LIBIDN_CFLAGS) \ - $(SECCOMP_CFLAGS) \ - -fvisibility=default +sd.CPPFLAGS += -DSYSTEMD_FSCK_PATH=\"$(libexecdir)/systemd-fsck\" -# We can't use libsystemd_shared_la_LIBADD here because it would -# pull in libsystemd*-internal.la -libsystemd_shared_la_LIBADD = \ - libsystemd-basic.la \ - libsystemd_internal.la \ - libsystemd_journal_internal.la \ - libudev_internal.la \ - $(ACL_LIBS) \ - $(LIBIDN_LIBS) \ - $(SECCOMP_LIBS) +sd.CPPFLAGS += -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"$(bindir)/systemd-tty-ask-password-agent\" -libsystemd_shared_la_LDFLAGS = \ - -release $(PACKAGE_VERSION) +sd.CPPFLAGS += -DSYSTEM_GENERATOR_PATH=\"$(systemgeneratordir)\" +sd.CPPFLAGS += -DUSER_GENERATOR_PATH=\"$(usergeneratordir)\" + +sd.CPPFLAGS += -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/src/sd-netlink/local-addresses.c b/src/libsystemd-shared/src/local-addresses.c index 74e1b2c2bf..d417320ad3 100644 --- a/src/libsystemd/src/sd-netlink/local-addresses.c +++ b/src/libsystemd-shared/src/local-addresses.c @@ -20,11 +20,9 @@ #include "systemd-basic/alloc-util.h" #include "systemd-basic/macro.h" +#include "systemd-shared/local-addresses.h" #include "systemd-staging/sd-netlink.h" -#include "local-addresses.h" -#include "netlink-util.h" - static int address_compare(const void *_a, const void *_b) { const struct local_address *a = _a, *b = _b; diff --git a/src/libsystemd-shared/test/GNUmakefile b/src/libsystemd-shared/test/GNUmakefile new file mode 120000 index 0000000000..95e5924740 --- /dev/null +++ b/src/libsystemd-shared/test/GNUmakefile @@ -0,0 +1 @@ +../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd-shared/test/Makefile b/src/libsystemd-shared/test/Makefile new file mode 100644 index 0000000000..131958f906 --- /dev/null +++ b/src/libsystemd-shared/test/Makefile @@ -0,0 +1,34 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. +include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +tests += test-local-addreses + +test_local_addresses_SOURCES = \ + src/libsystemd/sd-netlink/test-local-addresses.c + +test_local_addresses_LDADD = \ + libsystemd-shared.la + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/src/sd-netlink/test-local-addresses.c b/src/libsystemd-shared/test/test-local-addresses.c index b08cac9907..d639fd019b 100644 --- a/src/libsystemd/src/sd-netlink/test-local-addresses.c +++ b/src/libsystemd-shared/test/test-local-addresses.c @@ -20,8 +20,7 @@ #include "systemd-basic/af-list.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/in-addr-util.h" - -#include "local-addresses.h" +#include "systemd-shared/local-addresses.h" static void print_local_addresses(struct local_address *a, unsigned n) { unsigned i; diff --git a/src/libsystemd/Makefile b/src/libsystemd/Makefile index be66c9c898..b31fbb3d37 100644 --- a/src/libsystemd/Makefile +++ b/src/libsystemd/Makefile @@ -39,14 +39,14 @@ libsystemd_la_LDFLAGS = \ -Wl,--version-script=$(srcdir)/libsystemd.sym libsystemd_la_LIBADD = \ - libsystemd-internal.la \ - libsystemd-basic.la \ - libsystemd-journal-internal.la + libsystemd-internal.la + +libsystemd_la_LIBADD = $(libsystemd-internal.DEPENDS) pkgconfiglib_DATA += \ src/libsystemd/libsystemd.pc -pkginclude_HEADERS += \ +_pkginclude_HEADERS += \ src/systemd/sd-bus.h \ src/systemd/sd-bus-protocol.h \ src/systemd/sd-bus-vtable.h \ @@ -79,31 +79,36 @@ tests += \ test-bus-track \ test-event \ test-netlink \ - test-local-addresses \ test-resolve -pkginclude_HEADERS += \ +_pkginclude_HEADERS += \ src/systemd/sd-journal.h \ src/systemd/sd-messages.h \ src/systemd/_sd-common.h -test-libsystemd-sym.c: \ - $(top_builddir)/src/libsystemd/libsystemd.sym \ - src/systemd/sd-journal.h \ - src/systemd/sd-daemon.h \ - src/systemd/sd-login.h \ - src/systemd/sd-bus.h \ - src/systemd/sd-utf8.h \ - src/systemd/sd-resolve.h \ - src/systemd/sd-path.h \ - src/systemd/sd-event.h - $(generate-sym-test) +$(outdir)/test-libsystemd-sym.c: \ + $(srcdir)/include/systemd/sd-journal.h \ + $(srcdir)/include/systemd/sd-daemon.h \ + $(srcdir)/include/systemd/sd-login.h \ + $(srcdir)/include/systemd/sd-bus.h \ + $(srcdir)/include/systemd/sd-utf8.h \ + $(srcdir)/include/systemd/sd-resolve.h \ + $(srcdir)/include/systemd/sd-path.h \ + $(srcdir)/include/systemd/sd-event.h nodist_test_libsystemd_sym_SOURCES = \ test-libsystemd-sym.c test_libsystemd_sym_LDADD = \ libsystemd.la +$(DESTDIR)$(pkgincludedir)/%.h: $(srcdir)/include/systemd/%.h + @$(NORMAL_INSTALL) + @$(MKDIR_P) $(@D) + $(am.INSTALL_HEADERS) + +files.sys.all += $(addprefix $(pkgincludedir)/,$(notdir $(_pkginclude_HEADERS))) +$(outdir)/libsystemd.la: $(srcdir)/libsystemd.sym + nested.subdirs += src include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/include-staging/systemd-staging/sd-netlink.h b/src/libsystemd/include-staging/systemd-staging/sd-netlink.h index 8a8c85a004..7db35e1756 100644 --- a/src/libsystemd/include-staging/systemd-staging/sd-netlink.h +++ b/src/libsystemd/include-staging/systemd-staging/sd-netlink.h @@ -24,8 +24,8 @@ #include <netinet/ether.h> #include <netinet/in.h> -#include <linux/rtnetlink.h> #include <linux/neighbour.h> +#include <linux/rtnetlink.h> #include <systemd/_sd-common.h> #include <systemd/sd-event.h> diff --git a/src/libsystemd/include/systemd/sd-utf8.h b/src/libsystemd/include/systemd/sd-utf8.h deleted file mode 100644 index 6781983878..0000000000 --- a/src/libsystemd/include/systemd/sd-utf8.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef foosdutf8hfoo -#define foosdutf8hfoo - -/*** - This file is part of systemd. - - Copyright 2013 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. -***/ - -#include "_sd-common.h" - -_SD_BEGIN_DECLARATIONS; - -_sd_pure_ const char *sd_utf8_is_valid(const char *s); -_sd_pure_ const char *sd_ascii_is_valid(const char *s); - -_SD_END_DECLARATIONS; - -#endif diff --git a/src/libsystemd/sd_event_get_fd.xml b/src/libsystemd/sd_event_get_fd.xml index f68752dd0e..982f279657 100644 --- a/src/libsystemd/sd_event_get_fd.xml +++ b/src/libsystemd/sd_event_get_fd.xml @@ -119,7 +119,7 @@ <example> <title>Integration in the GLib event loop</title> - <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting> + <programlisting><xi:include href="sd_event_get_fd-glib-example.c" parse="text" /></programlisting> </example> </refsect1> diff --git a/src/libsystemd/sd_notify.xml b/src/libsystemd/sd_notify.xml index 94542b80b8..ef66e93ab9 100644 --- a/src/libsystemd/sd_notify.xml +++ b/src/libsystemd/sd_notify.xml @@ -307,8 +307,8 @@ code. If <varname>$NOTIFY_SOCKET</varname> was not set and hence no status data could be sent, 0 is returned. If the status was sent, these functions return with a positive return value. In - order to support both, init systems that implement this scheme and - those which do not, it is generally recommended to ignore the + order to support both init systems that implement this scheme and + those that do not, it is generally recommended to ignore the return value of this call.</para> </refsect1> diff --git a/src/libsystemd/src/Makefile b/src/libsystemd/src/Makefile index a7c1b4789a..49480d80c4 100644 --- a/src/libsystemd/src/Makefile +++ b/src/libsystemd/src/Makefile @@ -23,18 +23,16 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -libsystemd_internal_la_SOURCES = \ +_libsystemd_internal_la_SOURCES = \ src/systemd/sd-bus.h \ src/systemd/sd-bus-protocol.h \ src/systemd/sd-bus-vtable.h \ - src/systemd/sd-utf8.h \ src/systemd/sd-event.h \ src/systemd/sd-netlink.h \ src/systemd/sd-resolve.h \ src/systemd/sd-login.h \ src/systemd/sd-id128.h \ src/systemd/sd-daemon.h \ - src/systemd/sd-path.h \ src/systemd/sd-network.h \ src/systemd/sd-hwdb.h \ src/systemd/sd-device.h \ @@ -81,7 +79,8 @@ libsystemd_internal_la_SOURCES = \ src/libsystemd/sd-bus/kdbus.h \ src/libsystemd/sd-bus/bus-dump.c \ src/libsystemd/sd-bus/bus-dump.h \ - src/libsystemd/sd-utf8/sd-utf8.c \ + src/libsystemd/sd-bus/bus-util.c \ + src/libsystemd/sd-bus/bus-util.h \ src/libsystemd/sd-event/sd-event.c \ src/libsystemd/sd-netlink/sd-netlink.c \ src/libsystemd/sd-netlink/netlink-internal.h \ @@ -92,14 +91,11 @@ libsystemd_internal_la_SOURCES = \ src/libsystemd/sd-netlink/netlink-types.c \ src/libsystemd/sd-netlink/netlink-util.h \ src/libsystemd/sd-netlink/netlink-util.c \ - src/libsystemd/sd-netlink/local-addresses.h \ - src/libsystemd/sd-netlink/local-addresses.c \ src/libsystemd/sd-id128/sd-id128.c \ src/libsystemd/sd-id128/id128-util.h \ src/libsystemd/sd-id128/id128-util.c \ src/libsystemd/sd-daemon/sd-daemon.c \ src/libsystemd/sd-login/sd-login.c \ - src/libsystemd/sd-path/sd-path.c \ src/libsystemd/sd-network/sd-network.c \ src/libsystemd/sd-network/network-util.h \ src/libsystemd/sd-network/network-util.c \ @@ -118,10 +114,10 @@ libsystemd_internal_la_SOURCES = \ libsystemd_internal_la_LIBADD = \ -lresolv -noinst_LTLIBRARIES += \ +rootlibexec_LTLIBRARIES += \ libsystemd-internal.la -libsystemd_journal_internal_la_SOURCES = \ +_libsystemd_journal_internal_la_SOURCES = \ src/journal/sd-journal.c \ src/systemd/sd-journal.h \ src/systemd/_sd-common.h \ @@ -142,11 +138,9 @@ libsystemd_journal_internal_la_SOURCES = \ src/journal/mmap-cache.h \ src/journal/compress.c \ src/journal/audit-type.h \ - src/journal/audit-type.c \ - src/shared/gcrypt-util.h \ - src/shared/gcrypt-util.c + src/journal/audit-type.c -nodist_libsystemd_journal_internal_la_SOURCES = \ +#nodist_libsystemd_journal_internal_la_SOURCES = \ src/journal/audit_type-to-name.h gperf_txt_sources += \ @@ -174,7 +168,7 @@ libsystemd_journal_internal_la_LIBADD += \ endif # HAVE_LZ4 ifneq ($(HAVE_GCRYPT),) -libsystemd_journal_internal_la_SOURCES += \ +_libsystemd_journal_internal_la_SOURCES += \ src/journal/journal-authenticate.c \ src/journal/journal-authenticate.h \ src/journal/fsprg.c \ @@ -183,11 +177,30 @@ libsystemd_journal_internal_la_SOURCES += \ libsystemd_journal_internal_la_LIBADD += \ $(GCRYPT_LIBS) +libsystemd_journal_internal_la_CFLAGS += \ + $(GCRYPT_CFLAGS) endif # HAVE_GCRYPT -noinst_LTLIBRARIES += \ +#noinst_LTLIBRARIES += \ libsystemd-journal-internal.la +# Hook into the `am` module +libsystemd_internal_la_CFLAGS += $(libsystemd_journal_internal_la_CFLAGS) +libsystemd_internal_la_LIBADD += $(libsystemd_journal_internal_la_LIBADD) + +# Don't bother trying to hook into the `am` module for the sources; the only +# thing it adds over declaring the dependencies is adding the appropriate +# directories to am.subdirs=>at.subdirs; but we can do that here just as easily +# with nested.subdirs. +sd.libsystemd_SOURCES = +sd.libsystemd_SOURCES += $(patsubst src/libsystemd/%,%,$(filter %.c,$(_libsystemd_internal_la_SOURCES))) +sd.libsystemd_SOURCES += $(addprefix sd-journal/,$(notdir $(filter %.c,$(_libsystemd_journal_internal_la_SOURCES)))) +$(outdir)/libsystemd-internal.la: $(addprefix $(outdir)/,$(sd.libsystemd_SOURCES:.c=.lo)) + +libsystemd_internal_la_LIBADD += \ + libsystemd-basic.la \ + libsystemd-gcrypt.la + nested.subdirs += sd-bus nested.subdirs += sd-daemon nested.subdirs += sd-device diff --git a/src/libsystemd/src/sd-bus/Makefile b/src/libsystemd/src/sd-bus/Makefile index 60150788d8..a483e31fd1 100644 --- a/src/libsystemd/src/sd-bus/Makefile +++ b/src/libsystemd/src/sd-bus/Makefile @@ -20,7 +20,11 @@ # # 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 +sd.CPPFLAGS += $(libsystemd.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS) + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/src/sd-bus/bus-signature.h b/src/libsystemd/src/sd-bus/bus-signature.h index 1e0cd7f587..8b7a45cef5 100644 --- a/src/libsystemd/src/sd-bus/bus-signature.h +++ b/src/libsystemd/src/sd-bus/bus-signature.h @@ -20,6 +20,7 @@ ***/ #include <stdbool.h> +#include <sys/types.h> bool signature_is_single(const char *s, bool allow_dict_entry); bool signature_is_pair(const char *s); diff --git a/src/libsystemd/src/sd-bus/bus-socket.h b/src/libsystemd/src/sd-bus/bus-socket.h index 6e1d32e6a7..712e37bcc0 100644 --- a/src/libsystemd/src/sd-bus/bus-socket.h +++ b/src/libsystemd/src/sd-bus/bus-socket.h @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <stdbool.h> + #include <systemd/sd-bus.h> void bus_socket_setup(sd_bus *b); diff --git a/src/libsystemd/src/sd-bus/bus-track.h b/src/libsystemd/src/sd-bus/bus-track.h index 26bd05f5c7..68398281ae 100644 --- a/src/libsystemd/src/sd-bus/bus-track.h +++ b/src/libsystemd/src/sd-bus/bus-track.h @@ -19,5 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <systemd/sd-bus.h> + void bus_track_dispatch(sd_bus_track *track); void bus_track_close(sd_bus_track *track); diff --git a/src/libsystemd/src/sd-daemon/GNUmakefile b/src/libsystemd/src/sd-daemon/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-daemon/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-daemon/sd-daemon.c b/src/libsystemd/src/sd-daemon/sd-daemon.c index 1424d60a78..e272d91bfc 100644 --- a/src/libsystemd/src/sd-daemon/sd-daemon.c +++ b/src/libsystemd/src/sd-daemon/sd-daemon.c @@ -463,7 +463,7 @@ _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char have_pid = pid != 0 && pid != getpid(); if (n_fds > 0 || have_pid) { - /* CMSG_SPACE(0) may return value different than zero, which results in miscalculated controllen. */ + /* CMSG_SPACE(0) returns a value greater than zero, hence the ternary on n_fds. */ msghdr.msg_controllen = (n_fds > 0 ? CMSG_SPACE(sizeof(int) * n_fds) : 0) + (have_pid ? CMSG_SPACE(sizeof(struct ucred)) : 0); diff --git a/src/libsystemd/src/sd-device/GNUmakefile b/src/libsystemd/src/sd-device/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-device/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-device/device-internal.h b/src/libsystemd/src/sd-device/device-internal.h index c2539feb89..c23e329ed4 100644 --- a/src/libsystemd/src/sd-device/device-internal.h +++ b/src/libsystemd/src/sd-device/device-internal.h @@ -22,6 +22,7 @@ #include "systemd-basic/hashmap.h" #include "systemd-basic/set.h" +#include "systemd-staging/sd-device.h" struct sd_device { uint64_t n_ref; diff --git a/src/libsystemd/src/sd-event/GNUmakefile b/src/libsystemd/src/sd-event/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-event/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-hwdb/Makefile b/src/libsystemd/src/sd-hwdb/Makefile index 60150788d8..a2696e2976 100644 --- a/src/libsystemd/src/sd-hwdb/Makefile +++ b/src/libsystemd/src/sd-hwdb/Makefile @@ -20,7 +20,13 @@ # # 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 +sd.CPPFLAGS += $(libsystemd.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-staging.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS) +sd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/src/sd-id128/GNUmakefile b/src/libsystemd/src/sd-id128/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-id128/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-journal/Makefile b/src/libsystemd/src/sd-journal/Makefile index d0415fb0d3..10cd8c45bb 100644 --- a/src/libsystemd/src/sd-journal/Makefile +++ b/src/libsystemd/src/sd-journal/Makefile @@ -23,20 +23,25 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -audit_list_includes = -include linux/audit.h -include missing.h +audit_list_includes = -include linux/audit.h -include systemd-basic/missing.h ifneq ($(HAVE_AUDIT),) audit_list_includes += -include libaudit.h endif # HAVE_AUDIT -$(outdir)/audit_type-list.txt: +$(outdir)/audit_type-list.txt: | $(outdir)/$(DEPDIR) $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM $(audit_list_includes) - </dev/null | grep -vE 'AUDIT_.*(FIRST|LAST)_' | $(SED) -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | sort -k2 >$@ $(outdir)/audit_type-to-name.h: $(outdir)/audit_type-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *audit_type_to_string(int type) {\n\tswitch(type) {" } {printf " case AUDIT_%s: return \"%s\";\n", $$1, $$1 } END{ print " default: return NULL;\n\t}\n}\n" }' <$< >$@ # fsprg.c is a drop-in file using void pointer arithmetic -libsystemd_journal_internal_la_CFLAGS += \ - $(GCRYPT_CFLAGS) \ - -Wno-pointer-arith +$(outdir)/fsprg.lo: sd.ALL_CFLAGS += -Wno-pointer-arith + +$(outdir)/audit-type.lo: $(outdir)/audit_type-to-name.h + +sd.CPPFLAGS += $(libsystemd.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-gcrypt.CPPFLAGS) +sd.CPPFLAGS += -DCATALOG_DATABASE=\"$(catalogstatedir)/database\" include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/src/sd-journal/mmap-cache.h b/src/libsystemd/src/sd-journal/mmap-cache.h index 199d944647..d7eca3c237 100644 --- a/src/libsystemd/src/sd-journal/mmap-cache.h +++ b/src/libsystemd/src/sd-journal/mmap-cache.h @@ -20,7 +20,9 @@ ***/ #include <stdbool.h> +#include <stdint.h> #include <sys/stat.h> +#include <sys/types.h> /* One context per object type, plus one of the header, plus one "additional" one */ #define MMAP_CACHE_MAX_CONTEXTS 9 diff --git a/src/libsystemd/src/sd-login/GNUmakefile b/src/libsystemd/src/sd-login/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-login/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-netlink/GNUmakefile b/src/libsystemd/src/sd-netlink/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-netlink/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-network/GNUmakefile b/src/libsystemd/src/sd-network/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-network/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-network/network-util.h b/src/libsystemd/src/sd-network/network-util.h index 4527ed7c0f..253a6b9934 100644 --- a/src/libsystemd/src/sd-network/network-util.h +++ b/src/libsystemd/src/sd-network/network-util.h @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <stdbool.h> + #include "systemd-staging/sd-network.h" bool network_is_online(void); diff --git a/src/libsystemd/src/sd-resolve/GNUmakefile b/src/libsystemd/src/sd-resolve/GNUmakefile new file mode 120000 index 0000000000..13308a50cd --- /dev/null +++ b/src/libsystemd/src/sd-resolve/GNUmakefile @@ -0,0 +1 @@ +../../../../GNUmakefile
\ No newline at end of file diff --git a/src/libsystemd/src/sd-utf8/sd-utf8.c b/src/libsystemd/src/sd-utf8/sd-utf8.c deleted file mode 100644 index e00ec94390..0000000000 --- a/src/libsystemd/src/sd-utf8/sd-utf8.c +++ /dev/null @@ -1,35 +0,0 @@ -/*** - This file is part of systemd. - - Copyright 2013 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. -***/ - -#include <systemd/sd-utf8.h> - -#include "systemd-basic/utf8.h" -#include "systemd-basic/util.h" - -_public_ const char *sd_utf8_is_valid(const char *s) { - assert_return(s, NULL); - - return utf8_is_valid(s); -} - -_public_ const char *sd_ascii_is_valid(const char *s) { - assert_return(s, NULL); - - return ascii_is_valid(s); -} diff --git a/src/libsystemd/src/subdir.mk b/src/libsystemd/src/subdir.mk index 605b592401..73c05740ce 100644 --- a/src/libsystemd/src/subdir.mk +++ b/src/libsystemd/src/subdir.mk @@ -20,10 +20,12 @@ # # 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -sd.CPPFLAGS += -DLIBDIR=\"$(libdir)\" -sd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" +sd.CPPFLAGS += $(libsystemd.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-staging.CPPFLAGS) +sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS) include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libsystemd/src/test.mk b/src/libsystemd/src/test.mk index c823a360f2..ffaff5c889 100644 --- a/src/libsystemd/src/test.mk +++ b/src/libsystemd/src/test.mk @@ -20,8 +20,6 @@ # # 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 test_bus_marshal_SOURCES = \ src/libsystemd/sd-bus/test-bus-marshal.c @@ -148,17 +146,8 @@ test_netlink_SOURCES = \ test_netlink_LDADD = \ libsystemd-shared.la -test_local_addresses_SOURCES = \ - src/libsystemd/sd-netlink/test-local-addresses.c - -test_local_addresses_LDADD = \ - libsystemd-shared.la - test_resolve_SOURCES = \ src/libsystemd/sd-resolve/test-resolve.c test_resolve_LDADD = \ libsystemd-shared.la - - -include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/libudev/Makefile b/src/libudev/Makefile index 737a750e3a..cf4745cc7e 100644 --- a/src/libudev/Makefile +++ b/src/libudev/Makefile @@ -47,10 +47,8 @@ pkgconfiglib_DATA += \ EXTRA_DIST += \ src/libudev/libudev.pc.in -test-libudev-sym.c: \ - src/libudev/libudev.sym \ - src/udev/udev.h - $(generate-sym-test) +$(outdir)/test-libudev-sym.c: \ + $(srcdir)/udev.h nodist_test_libudev_sym_SOURCES = \ test-libudev-sym.c diff --git a/src/libudev/src/Makefile b/src/libudev/src/Makefile index 46f122d52d..3f2f59ed39 100644 --- a/src/libudev/src/Makefile +++ b/src/libudev/src/Makefile @@ -23,7 +23,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk -libudev_la_SOURCES =\ +libudev_internal_la_SOURCES =\ src/libudev/libudev.sym \ src/libudev/libudev-private.h \ src/libudev/libudev-device-internal.h \ @@ -36,10 +36,11 @@ libudev_la_SOURCES =\ src/libudev/libudev-monitor.c \ src/libudev/libudev-queue.c \ src/libudev/libudev-hwdb.c + +libudev_internal_la_LIBADD = \ + libsystemd-internal.la + noinst_LTLIBRARIES += \ libudev-internal.la -libudev_internal_la_SOURCES =\ - $(libudev_la_SOURCES) - include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/nss-myhostname/Makefile b/src/nss-myhostname/Makefile index 3f87158794..172758048b 100644 --- a/src/nss-myhostname/Makefile +++ b/src/nss-myhostname/Makefile @@ -37,7 +37,7 @@ libnss_myhostname_la_LDFLAGS = \ -Wl,--version-script=$(srcdir)/nss-myhostname.sym libnss_myhostname_la_LIBADD = \ - libsystemd-internal.la \ + libsystemd-shared.la \ libsystemd-basic.la rootlib_LTLIBRARIES += \ diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c index 862ad2fcb5..c8858a00d2 100644 --- a/src/nss-myhostname/nss-myhostname.c +++ b/src/nss-myhostname/nss-myhostname.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <string.h> -#include "sd-netlink/local-addresses.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/hostname-util.h" #include "systemd-basic/macro.h" @@ -32,6 +31,7 @@ #include "systemd-basic/signal-util.h" #include "systemd-basic/string-util.h" #include "systemd-basic/util.h" +#include "systemd-shared/local-addresses.h" /* We use 127.0.0.2 as IPv4 address. This has the advantage over * 127.0.0.1 that it can be translated back to the local hostname. For diff --git a/src/systemd-cgls/Makefile b/src/systemd-cgls/Makefile index 1ef82d8aef..9289eee967 100644 --- a/src/systemd-cgls/Makefile +++ b/src/systemd-cgls/Makefile @@ -28,6 +28,7 @@ systemd_cgls_SOURCES = \ src/cgls/cgls.c systemd_cgls_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-cgtop/Makefile b/src/systemd-cgtop/Makefile index abebe7f3d0..5400436100 100644 --- a/src/systemd-cgtop/Makefile +++ b/src/systemd-cgtop/Makefile @@ -28,6 +28,7 @@ systemd_cgtop_SOURCES = \ src/cgtop/cgtop.c systemd_cgtop_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-cryptsetup/Makefile b/src/systemd-cryptsetup/Makefile index f4c8afad96..1fdfe19a5d 100644 --- a/src/systemd-cryptsetup/Makefile +++ b/src/systemd-cryptsetup/Makefile @@ -41,6 +41,7 @@ systemd_cryptsetup_CFLAGS = \ $(LIBCRYPTSETUP_CFLAGS) systemd_cryptsetup_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la \ $(LIBCRYPTSETUP_LIBS) @@ -55,4 +56,6 @@ SYSINIT_TARGET_WANTS += \ endif # HAVE_LIBCRYPTSETUP +sd.CPPFLAGS += -DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-debug-generator/Makefile b/src/systemd-debug-generator/Makefile index 542d8b5a5a..a326353121 100644 --- a/src/systemd-debug-generator/Makefile +++ b/src/systemd-debug-generator/Makefile @@ -31,4 +31,6 @@ systemd_debug_generator_SOURCES = \ systemd_debug_generator_LDADD = \ libsystemd-shared.la +sd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-getty-generator/Makefile b/src/systemd-getty-generator/Makefile index 645dc189f7..4f90ae05ed 100644 --- a/src/systemd-getty-generator/Makefile +++ b/src/systemd-getty-generator/Makefile @@ -30,4 +30,6 @@ systemd_getty_generator_SOURCES = \ systemd_getty_generator_LDADD = \ libsystemd-shared.la +sd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-gpt-auto-generator/Makefile b/src/systemd-gpt-auto-generator/Makefile index ce6b56f998..73283847bc 100644 --- a/src/systemd-gpt-auto-generator/Makefile +++ b/src/systemd-gpt-auto-generator/Makefile @@ -32,6 +32,7 @@ systemd_gpt_auto_generator_SOURCES = \ src/basic/blkid-util.h systemd_gpt_auto_generator_LDADD = \ + libsystemd-blkid.la \ libsystemd-shared.la \ $(BLKID_LIBS) @@ -39,4 +40,6 @@ systemd_gpt_auto_generator_CFLAGS = \ $(BLKID_CFLAGS) endif # HAVE_BLKID +sd.CPPFLAGS += -DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-initctl/Makefile b/src/systemd-initctl/Makefile index 18d66993b7..0df78e788e 100644 --- a/src/systemd-initctl/Makefile +++ b/src/systemd-initctl/Makefile @@ -28,6 +28,7 @@ systemd_initctl_SOURCES = \ src/initctl/initctl.c systemd_initctl_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-machine-id-setup/Makefile b/src/systemd-machine-id-setup/Makefile index 4cbba418ff..97f9087ac6 100644 --- a/src/systemd-machine-id-setup/Makefile +++ b/src/systemd-machine-id-setup/Makefile @@ -25,12 +25,11 @@ include $(topsrcdir)/build-aux/Makefile.head.mk rootbin_PROGRAMS += systemd-machine-id-setup systemd_machine_id_setup_SOURCES = \ - src/machine-id-setup/machine-id-setup-main.c \ - src/core/machine-id-setup.c \ - src/core/machine-id-setup.h + src/machine-id-setup/machine-id-setup-main.c systemd_machine_id_setup_LDADD = \ - libsystemd-shared.la + libsystemd-basic.la \ + libcore.la SYSINIT_TARGET_WANTS += \ systemd-machine-id-commit.service diff --git a/src/systemd-mount/Makefile b/src/systemd-mount/Makefile index cbaa737f70..3a3eaaeb67 100644 --- a/src/systemd-mount/Makefile +++ b/src/systemd-mount/Makefile @@ -28,6 +28,7 @@ systemd_mount_SOURCES = \ src/mount/mount-tool.c systemd_mount_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-nspawn/Makefile b/src/systemd-nspawn/Makefile index c0fc3bd98e..e43f5a2493 100644 --- a/src/systemd-nspawn/Makefile +++ b/src/systemd-nspawn/Makefile @@ -45,11 +45,7 @@ systemd_nspawn_SOURCES = \ src/nspawn/nspawn-stub-pid1.c \ src/nspawn/nspawn-stub-pid1.h \ src/nspawn/nspawn-patch-uid.c \ - src/nspawn/nspawn-patch-uid.h \ - src/core/mount-setup.c \ - src/core/mount-setup.h \ - src/core/loopback-setup.c \ - src/core/loopback-setup.h + src/nspawn/nspawn-patch-uid.h nodist_systemd_nspawn_SOURCES = \ src/nspawn/nspawn-gperf.c @@ -64,6 +60,9 @@ systemd_nspawn_CFLAGS = \ $(SELINUX_CFLAGS) systemd_nspawn_LDADD = \ + libcore.la \ + libsystemd-blkid.la \ + libsystemd-internal.la \ libsystemd-shared.la \ $(ACL_LIBS) \ $(BLKID_LIBS) \ @@ -90,4 +89,7 @@ test_patch_uid_LDADD = \ manual_tests += \ test-patch-uid +dist_tmpfiles_DATA = \ + tmpfiles.d/systemd-nspawn.conf + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-nspawn/nspawn-expose-ports.c b/src/systemd-nspawn/nspawn-expose-ports.c index 1ecebe8e30..b5c4942907 100644 --- a/src/systemd-nspawn/nspawn-expose-ports.c +++ b/src/systemd-nspawn/nspawn-expose-ports.c @@ -17,8 +17,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-netlink/local-addresses.h" -#include "sd-netlink/netlink-util.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/fd-util.h" #include "systemd-basic/in-addr-util.h" @@ -27,6 +25,7 @@ #include "systemd-basic/string-util.h" #include "systemd-basic/util.h" #include "systemd-firewall/firewall-util.h" +#include "systemd-shared/local-addresses.h" #include "systemd-staging/sd-netlink.h" #include "nspawn-expose-ports.h" diff --git a/src/systemd-nspawn/nspawn-mount.h b/src/systemd-nspawn/nspawn-mount.h index 0d58439df3..8601dfdad3 100644 --- a/src/systemd-nspawn/nspawn-mount.h +++ b/src/systemd-nspawn/nspawn-mount.h @@ -20,6 +20,7 @@ ***/ #include <stdbool.h> +#include <sys/types.h> #include "systemd-basic/cgroup-util.h" diff --git a/src/systemd-nspawn/nspawn-network.c b/src/systemd-nspawn/nspawn-network.c index 2e0760ec86..2fae23376c 100644 --- a/src/systemd-nspawn/nspawn-network.c +++ b/src/systemd-nspawn/nspawn-network.c @@ -24,7 +24,6 @@ #include <libudev.h> #include <systemd/sd-id128.h> -#include "sd-netlink/netlink-util.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/ether-addr-util.h" #include "systemd-basic/lockfile-util.h" diff --git a/src/systemd-nspawn/nspawn-register.c b/src/systemd-nspawn/nspawn-register.c index de3ee23f09..1e45b8e58f 100644 --- a/src/systemd-nspawn/nspawn-register.c +++ b/src/systemd-nspawn/nspawn-register.c @@ -19,7 +19,7 @@ #include <systemd/sd-bus.h> -#include "sd-bus/bus-error.h" +#include "sd-bus/bus-error.h" /* for bus_error_message */ #include "sd-bus/bus-util.h" #include "systemd-basic/stat-util.h" #include "systemd-basic/strv.h" diff --git a/src/systemd-nspawn/nspawn-seccomp.h b/src/systemd-nspawn/nspawn-seccomp.h index 5bde16faf9..a01e110c70 100644 --- a/src/systemd-nspawn/nspawn-seccomp.h +++ b/src/systemd-nspawn/nspawn-seccomp.h @@ -19,6 +19,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <sys/types.h> +#include <stdint.h> int setup_seccomp(uint64_t cap_list_retain); diff --git a/src/systemd-nspawn/nspawn-setuid.c b/src/systemd-nspawn/nspawn-setuid.c index 129d3acc5f..7d0d47c5b1 100644 --- a/src/systemd-nspawn/nspawn-setuid.c +++ b/src/systemd-nspawn/nspawn-setuid.c @@ -18,6 +18,8 @@ ***/ #include <grp.h> +#include <pwd.h> +#include <stdio.h> #include <sys/types.h> #include <unistd.h> @@ -88,7 +90,8 @@ static int spawn_getent(const char *database, const char *key, pid_t *rpid) { } int change_uid_gid(const char *user, char **_home) { - char line[LINE_MAX], *x, *u, *g, *h; + char line[LINE_MAX], *x; + struct passwd *pw; const char *word, *state; _cleanup_free_ uid_t *uids = NULL; _cleanup_free_ char *home = NULL; @@ -124,8 +127,9 @@ int change_uid_gid(const char *user, char **_home) { return log_oom(); fd = -1; - if (!fgets(line, sizeof(line), f)) { - if (!ferror(f)) { + errno = 0; + if (!(pw = fgetpwent(f))) { + if (!errno) { log_error("Failed to resolve user %s.", user); return -ESRCH; } @@ -133,66 +137,11 @@ int change_uid_gid(const char *user, char **_home) { return log_error_errno(errno, "Failed to read from getent: %m"); } - truncate_nl(line); - wait_for_terminate_and_warn("getent passwd", pid, true); - x = strchr(line, ':'); - if (!x) { - log_error("/etc/passwd entry has invalid user field."); - return -EIO; - } - - u = strchr(x+1, ':'); - if (!u) { - log_error("/etc/passwd entry has invalid password field."); - return -EIO; - } - - u++; - g = strchr(u, ':'); - if (!g) { - log_error("/etc/passwd entry has invalid UID field."); - return -EIO; - } - - *g = 0; - g++; - x = strchr(g, ':'); - if (!x) { - log_error("/etc/passwd entry has invalid GID field."); - return -EIO; - } - - *x = 0; - h = strchr(x+1, ':'); - if (!h) { - log_error("/etc/passwd entry has invalid GECOS field."); - return -EIO; - } - - h++; - x = strchr(h, ':'); - if (!x) { - log_error("/etc/passwd entry has invalid home directory field."); - return -EIO; - } - - *x = 0; - - r = parse_uid(u, &uid); - if (r < 0) { - log_error("Failed to parse UID of user."); - return -EIO; - } - - r = parse_gid(g, &gid); - if (r < 0) { - log_error("Failed to parse GID of user."); - return -EIO; - } - - home = strdup(h); + uid = pw->pw_uid; + gid = pw->pw_gid; + home = strdup(pw->pw_dir); if (!home) return log_oom(); diff --git a/src/systemd-nspawn/nspawn-stub-pid1.c b/src/systemd-nspawn/nspawn-stub-pid1.c index 36d7bfc7c4..208c6f30aa 100644 --- a/src/systemd-nspawn/nspawn-stub-pid1.c +++ b/src/systemd-nspawn/nspawn-stub-pid1.c @@ -42,8 +42,8 @@ int stub_pid1(void) { pid_t pid; int r; - /* Implements a stub PID 1, that reaps all processes and processes a couple of standard signals. This is useful - * for allowing arbitrary processes run in a container, and still have all zombies reaped. */ + /* Implements a stub PID 1, that reaps all processes and handles a couple of standard signals. This is useful + * for allowing arbitrary processes to run in a container, and still have all zombies reaped. */ assert_se(sigfillset(&fullmask) >= 0); assert_se(sigprocmask(SIG_BLOCK, &fullmask, &oldmask) >= 0); diff --git a/src/systemd-nspawn/nspawn.c b/src/systemd-nspawn/nspawn.c index 5a3624fad1..9514152b5b 100644 --- a/src/systemd-nspawn/nspawn.c +++ b/src/systemd-nspawn/nspawn.c @@ -46,7 +46,6 @@ #include "core/loopback-setup.h" #include "sd-id128/id128-util.h" -#include "sd-netlink/netlink-util.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/barrier.h" #include "systemd-basic/btrfs-util.h" diff --git a/src/systemd-remount-fs/Makefile b/src/systemd-remount-fs/Makefile index 55cc776cdb..76f4941afb 100644 --- a/src/systemd-remount-fs/Makefile +++ b/src/systemd-remount-fs/Makefile @@ -25,11 +25,13 @@ include $(topsrcdir)/build-aux/Makefile.head.mk rootlibexec_PROGRAMS += systemd-remount-fs systemd_remount_fs_SOURCES = \ - src/remount-fs/remount-fs.c \ - src/core/mount-setup.c \ - src/core/mount-setup.h + src/remount-fs/remount-fs.c systemd_remount_fs_LDADD = \ + libcore.la \ libsystemd-shared.la +sd.CPPFLAGS += -DMOUNT_PATH=\"$(MOUNT_PATH)\" +sd.CPPFLAGS += -DUMOUNT_PATH=\"$(UMOUNT_PATH)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-stdio-bridge/Makefile b/src/systemd-stdio-bridge/Makefile index 096d94b90a..cd15120b23 100644 --- a/src/systemd-stdio-bridge/Makefile +++ b/src/systemd-stdio-bridge/Makefile @@ -28,6 +28,7 @@ systemd_stdio_bridge_SOURCES = \ src/stdio-bridge/stdio-bridge.c systemd_stdio_bridge_LDADD = \ + libsystemd-internal.la \ libsystemd-shared.la include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-stdio-bridge/systemd-stdio-bridge.completion.bash b/src/systemd-stdio-bridge/systemd-stdio-bridge.completion.bash new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/systemd-stdio-bridge/systemd-stdio-bridge.completion.bash diff --git a/src/systemd-stdio-bridge/systemd-stdio-bridge.completion.zsh b/src/systemd-stdio-bridge/systemd-stdio-bridge.completion.zsh new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/systemd-stdio-bridge/systemd-stdio-bridge.completion.zsh diff --git a/src/systemd-system-update-generator/Makefile b/src/systemd-system-update-generator/Makefile index 5e66309753..45504681b5 100644 --- a/src/systemd-system-update-generator/Makefile +++ b/src/systemd-system-update-generator/Makefile @@ -30,4 +30,6 @@ systemd_system_update_generator_SOURCES = \ systemd_system_update_generator_LDADD = \ libsystemd-shared.la +sd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-timesyncd/Makefile b/src/systemd-timesyncd/Makefile index 8bea585e8c..698dce7044 100644 --- a/src/systemd-timesyncd/Makefile +++ b/src/systemd-timesyncd/Makefile @@ -37,6 +37,7 @@ nodist_systemd_timesyncd_SOURCES = \ src/timesync/timesyncd-gperf.c systemd_timesyncd_LDADD = \ + libsystemd-internal.la \ libsystemd-network.la \ libsystemd-shared.la \ -lm @@ -62,4 +63,9 @@ EXTRA_DIST += \ units/systemd-timesyncd.service.in \ src/timesync/timesyncd.conf.in +dist_systempreset_DATA = \ + 90-timesyncd.preset + +sd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/systemd-tty-ask-password-agent/Makefile b/src/systemd-tty-ask-password-agent/Makefile index 3091527a7f..beba28d912 100644 --- a/src/systemd-tty-ask-password-agent/Makefile +++ b/src/systemd-tty-ask-password-agent/Makefile @@ -30,4 +30,6 @@ systemd_tty_ask_password_agent_SOURCES = \ systemd_tty_ask_password_agent_LDADD = \ libsystemd-shared.la +sd.CPPFLAGS += -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"$(rootbindir)/systemd-tty-ask-password-agent\" + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/test/test-netlink-manual.c b/src/test/test-netlink-manual.c index 3e82a7cc96..abe705f58e 100644 --- a/src/test/test-netlink-manual.c +++ b/src/test/test-netlink-manual.c @@ -21,8 +21,8 @@ #include <libkmod.h> #include <net/if.h> -#include <linux/ip.h> #include <linux/if_tunnel.h> +#include <linux/ip.h> #include "systemd-basic/macro.h" #include "systemd-basic/util.h" diff --git a/src/test/test-nss.c b/src/test/test-nss.c index 1ccd0def3f..9826e8982c 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -21,7 +21,6 @@ #include <net/if.h> #include <stdlib.h> -#include "sd-netlink/local-addresses.h" #include "systemd-basic/af-list.h" #include "systemd-basic/alloc-util.h" #include "systemd-basic/errno-list.h" @@ -34,6 +33,7 @@ #include "systemd-basic/stdio-util.h" #include "systemd-basic/string-util.h" #include "systemd-basic/strv.h" +#include "systemd-shared/local-addresses.h" static const char* nss_status_to_string(enum nss_status status, char *buf, size_t buf_len) { switch (status) { diff --git a/sysctl.d/.gitignore b/sysctl.d/.gitignore deleted file mode 100644 index e326c180c3..0000000000 --- a/sysctl.d/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/50-coredump.conf diff --git a/tmpfiles.d/.gitignore b/tmpfiles.d/.gitignore deleted file mode 100644 index c8c9fe059b..0000000000 --- a/tmpfiles.d/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/etc.conf -/systemd-journald.conf diff --git a/tools/git-prune b/tools/git-prune new file mode 100755 index 0000000000..d5a36dd4ee --- /dev/null +++ b/tools/git-prune @@ -0,0 +1,2 @@ +#!/bin/sh +git tag|grep '^elogind/v[0-9]*$'|xargs -n1 git tag -d diff --git a/tools/make-man-rules.py b/tools/make-man-rules.py index 5e61917d60..0b73ab04f7 100644 --- a/tools/make-man-rules.py +++ b/tools/make-man-rules.py @@ -24,16 +24,16 @@ import os.path from xml_helper import * SECTION = '''\ -MANPAGES += \\ +sdman.MANPAGES += \\ {manpages} -MANPAGES_ALIAS += \\ +sdman.MANPAGES_ALIAS += \\ {aliases} {rules} {htmlrules} ''' CONDITIONAL = '''\ -if {conditional} +ifneq ($({conditional}),) ''' \ + SECTION + \ '''\ @@ -54,7 +54,7 @@ HEADER = '''\ HTML_ALIAS_RULE = '''\ {}.html: {}.html - $(html-alias) + $(sdman.html-alias) ''' FOOTER = '''\ diff --git a/tools/test-header.sh b/tools/test-header.sh index b11285af7d..d63177bde0 100755 --- a/tools/test-header.sh +++ b/tools/test-header.sh @@ -1,2 +1,2 @@ #!/bin/bash -gcc -c -o /dev/null -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/libmount $(find src -type d |sed 's|^|-I&|') -include ./config.h -include "$(realpath -- "$1")" test-header.c +gcc -c -o /dev/null -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/libmount $(find src -type d |sed 's|^|-I&|') -include ./config.h -include "$(realpath -- "$1")" "$(dirname -- "$0")"/test-header.c |