From 87f6c19079b53220f91dfe2159b77ae005e6a721 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 14 Feb 2022 10:05:35 +0100 Subject: [PATCH] Makefile: build with systemd when available Signed-off-by: Giuseppe Scrivano --- Makefile | 2 +- hack/systemd_tag.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 hack/systemd_tag.sh diff --git a/Makefile b/Makefile index f3d1ee817..8a10dfa05 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ export GOPROXY=https://proxy.golang.org APPARMORTAG := $(shell hack/apparmor_tag.sh) STORAGETAGS := $(shell ./btrfs_tag.sh) $(shell ./btrfs_installed_tag.sh) $(shell ./libdm_tag.sh) $(shell ./hack/libsubid_tag.sh) SECURITYTAGS ?= seccomp $(APPARMORTAG) -TAGS ?= $(SECURITYTAGS) $(STORAGETAGS) +TAGS ?= $(SECURITYTAGS) $(STORAGETAGS) $(shell ./hack/systemd_tag.sh) BUILDTAGS += $(TAGS) PREFIX := /usr/local BINDIR := $(PREFIX)/bin diff --git a/hack/systemd_tag.sh b/hack/systemd_tag.sh new file mode 100755 index 000000000..5af322881 --- /dev/null +++ b/hack/systemd_tag.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF +#include +EOF +if test $? -eq 0 ; then + echo systemd +fi