/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Teddy Hogeborn
  • Date: 2016-03-19 03:51:23 UTC
  • Revision ID: teddy@recompile.se-20160319035123-53w4dbzdyjef29m1
Server: New tmpfiles.d file for persistent state directory

Provide a tmpfiles.d(5) file for systemd to create persistent state
directory on so-called "volatile" systems.

* Makefile (TMPFILES): New.
  (install-server): Also install "tmpfiles.d-mandos.conf" file as
                    "/usr/lib/tmpfiles.d/mandos.conf".
* tmpfiles.d-mandos.conf: New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# For info about _FORTIFY_SOURCE, see feature_test_macros(7)
15
15
# and <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html>.
16
16
FORTIFY=-D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIC
 
17
# <https://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/>
 
18
ALL_SANITIZE_OPTIONS:=-fsanitize=address -fsanitize=undefined \
 
19
        -fsanitize=shift -fsanitize=integer-divide-by-zero \
 
20
        -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=null \
 
21
        -fsanitize=return -fsanitize=signed-integer-overflow \
 
22
        -fsanitize=bounds -fsanitize=alignment \
 
23
        -fsanitize=object-size -fsanitize=float-divide-by-zero \
 
24
        -fsanitize=float-cast-overflow -fsanitize=nonnull-attribute \
 
25
        -fsanitize=returns-nonnull-attribute -fsanitize=bool \
 
26
        -fsanitize=enum
 
27
# Check which sanitizing options can be used
 
28
SANITIZE:=$(foreach option,$(ALL_SANITIZE_OPTIONS),$(shell \
 
29
        echo 'int main(){}' | $(CC) --language=c $(option) /dev/stdin \
 
30
        -o /dev/null >/dev/null 2>&1 && echo $(option)))
17
31
LINK_FORTIFY_LD=-z relro -z now
18
32
LINK_FORTIFY=
19
33
 
26
40
OPTIMIZE=-Os -fno-strict-aliasing
27
41
LANGUAGE=-std=gnu11
28
42
htmldir=man
29
 
version=1.7.1
 
43
version=1.7.6
30
44
SED=sed
31
45
 
32
46
USER=$(firstword $(subst :, ,$(shell getent passwd _mandos || getent passwd nobody || echo 65534)))
33
 
GROUP=$(firstword $(subst :, ,$(shell getent group _mandos || getent group nobody || echo 65534)))
 
47
GROUP=$(firstword $(subst :, ,$(shell getent group _mandos || getent group nogroup || echo 65534)))
34
48
 
35
49
## Use these settings for a traditional /usr/local install
36
50
# PREFIX=$(DESTDIR)/usr/local
61
75
##
62
76
 
63
77
SYSTEMD=$(DESTDIR)$(shell pkg-config systemd --variable=systemdsystemunitdir)
 
78
TMPFILES=$(DESTDIR)$(shell pkg-config systemd --variable=tmpfilesdir)
64
79
 
65
80
GNUTLS_CFLAGS=$(shell pkg-config --cflags-only-I gnutls)
66
81
GNUTLS_LIBS=$(shell pkg-config --libs gnutls)
73
88
LIBNL3_LIBS=$(shell pkg-config --libs libnl-route-3.0)
74
89
 
75
90
# Do not change these two
76
 
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
77
 
        $(LANGUAGE) $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(GPGME_CFLAGS) \
78
 
        -DVERSION='"$(version)"'
 
91
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(SANITIZE) $(COVERAGE) \
 
92
        $(OPTIMIZE) $(LANGUAGE) $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) \
 
93
        $(GPGME_CFLAGS) -DVERSION='"$(version)"'
79
94
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
80
95
 
81
96
# Commands to format a DocBook <refentry> document into a manual page
323
338
        elif install --directory --mode=u=rwx $(STATEDIR); then \
324
339
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
325
340
        fi
 
341
        if [ "$(TMPFILES)" != "$(DESTDIR)" -a -d "$(TMPFILES)" ]; then \
 
342
                install --mode=u=rwx,go=r tmpfiles.d-mandos.conf \
 
343
                        $(TMPFILES)/mandos.conf; \
 
344
        fi
326
345
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
327
346
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
328
347
                mandos-ctl
391
410
        install --mode=u=rwxs,go=rx \
392
411
                --target-directory=$(LIBDIR)/mandos/plugins.d \
393
412
                plugins.d/plymouth
394
 
        install --mode=u=rwxs,go=rx \
 
413
        install --mode=u=rwx,go=rx \
395
414
                --target-directory=$(LIBDIR)/mandos/plugin-helpers \
396
415
                plugin-helpers/mandos-client-iprouteadddel
397
416
        install initramfs-tools-hook \