41
41
#COVERAGE=--coverage
42
42
OPTIMIZE:=-Os -fno-strict-aliasing
43
43
LANGUAGE:=-std=gnu11
44
FEATURES:=-D_FILE_OFFSET_BITS=64
48
PKG_CONFIG?=pkg-config
50
48
USER:=$(firstword $(subst :, ,$(shell getent passwd _mandos \
51
49
|| getent passwd nobody || echo 65534)))
52
50
GROUP:=$(firstword $(subst :, ,$(shell getent group _mandos \
53
51
|| getent group nogroup || echo 65534)))
55
LINUXVERSION:=$(shell uname --kernel-release)
57
53
## Use these settings for a traditional /usr/local install
58
54
# PREFIX:=$(DESTDIR)/usr/local
59
55
# CONFDIR:=$(DESTDIR)/etc/mandos
75
71
STATEDIR:=$(DESTDIR)/var/lib/mandos
78
"/usr/lib/`dpkg-architecture \
79
-qDEB_HOST_MULTIARCH 2>/dev/null`" \
74
"/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null`" \
80
75
"`rpm --eval='%{_libdir}' 2>/dev/null`" /usr/lib; do \
81
76
if [ -d "$$d" -a "$$d" = "$${d%/}" ]; then \
82
77
echo "$(DESTDIR)$$d"; \
88
SYSTEMD:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
89
--variable=systemdsystemunitdir)
90
TMPFILES:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
91
--variable=tmpfilesdir)
83
SYSTEMD:=$(DESTDIR)$(shell pkg-config systemd --variable=systemdsystemunitdir)
84
TMPFILES:=$(DESTDIR)$(shell pkg-config systemd --variable=tmpfilesdir)
93
GNUTLS_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gnutls)
94
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
95
AVAHI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I avahi-core)
96
AVAHI_LIBS:=$(shell $(PKG_CONFIG) --libs avahi-core)
86
GNUTLS_CFLAGS:=$(shell pkg-config --cflags-only-I gnutls)
87
GNUTLS_LIBS:=$(shell pkg-config --libs gnutls)
88
AVAHI_CFLAGS:=$(shell pkg-config --cflags-only-I avahi-core)
89
AVAHI_LIBS:=$(shell pkg-config --libs avahi-core)
97
90
GPGME_CFLAGS:=$(shell gpgme-config --cflags; getconf LFS_CFLAGS)
98
91
GPGME_LIBS:=$(shell gpgme-config --libs; getconf LFS_LIBS; \
99
92
getconf LFS_LDFLAGS)
100
LIBNL3_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I libnl-route-3.0)
101
LIBNL3_LIBS:=$(shell $(PKG_CONFIG) --libs libnl-route-3.0)
102
GLIB_CFLAGS:=$(shell $(PKG_CONFIG) --cflags glib-2.0)
103
GLIB_LIBS:=$(shell $(PKG_CONFIG) --libs glib-2.0)
93
LIBNL3_CFLAGS:=$(shell pkg-config --cflags-only-I libnl-route-3.0)
94
LIBNL3_LIBS:=$(shell pkg-config --libs libnl-route-3.0)
95
GLIB_CFLAGS:=$(shell pkg-config --cflags glib-2.0)
96
GLIB_LIBS:=$(shell pkg-config --libs glib-2.0)
105
98
# Do not change these two
106
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
107
$(LANGUAGE) $(FEATURES) -DVERSION='"$(version)"'
99
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) \
100
$(OPTIMIZE) $(LANGUAGE) -DVERSION='"$(version)"'
108
101
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(strip \
109
102
) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
319
312
./dracut-module/password-agent --test
321
314
# Run the client with a local config and key
322
run-client: all keydir/seckey.txt keydir/pubkey.txt \
323
keydir/tls-privkey.pem keydir/tls-pubkey.pem
324
@echo '######################################################'
325
@echo '# The following error messages are harmless and can #'
326
@echo '# be safely ignored: #'
327
@echo '## From plugin-runner: #'
328
@echo '# setgid: Operation not permitted #'
329
@echo '# setuid: Operation not permitted #'
330
@echo '## From askpass-fifo: #'
331
@echo '# mkfifo: Permission denied #'
332
@echo '## From mandos-client: #'
333
@echo '# Failed to raise privileges: Operation not permi... #'
334
@echo '# Warning: network hook "*" exited with status * #'
335
@echo '# ioctl SIOCSIFFLAGS +IFF_UP: Operation not permi... #'
336
@echo '# Failed to bring up interface "*": Operation not... #'
338
@echo '# (The messages are caused by not running as root, #'
339
@echo '# but you should NOT run "make run-client" as root #'
340
@echo '# unless you also unpacked and compiled Mandos as #'
341
@echo '# root, which is also NOT recommended.) #'
342
@echo '######################################################'
315
run-client: all keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem
316
@echo "###################################################################"
317
@echo "# The following error messages are harmless and can be safely #"
319
@echo "# From plugin-runner: setgid: Operation not permitted #"
320
@echo "# setuid: Operation not permitted #"
321
@echo "# From askpass-fifo: mkfifo: Permission denied #"
322
@echo "# From mandos-client: #"
323
@echo "# Failed to raise privileges: Operation not permitted #"
324
@echo "# Warning: network hook \"*\" exited with status * #"
326
@echo "# (The messages are caused by not running as root, but you should #"
327
@echo "# NOT run \"make run-client\" as root unless you also unpacked and #"
328
@echo "# compiled Mandos as root, which is also NOT recommended.) #"
329
@echo "###################################################################"
343
330
# We set GNOME_KEYRING_CONTROL to block pam_gnome_keyring
344
331
./plugin-runner --plugin-dir=plugins.d \
345
332
--plugin-helper-dir=plugin-helpers \
385
372
elif install --directory --mode=u=rwx $(STATEDIR); then \
386
373
chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
388
if [ "$(TMPFILES)" != "$(DESTDIR)" \
389
-a -d "$(TMPFILES)" ]; then \
375
if [ "$(TMPFILES)" != "$(DESTDIR)" -a -d "$(TMPFILES)" ]; then \
390
376
install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
391
377
$(TMPFILES)/mandos.conf; \
439
425
install --mode=u=rwx,go=rx \
440
426
--target-directory=$(LIBDIR)/mandos plugin-runner
441
427
install --mode=u=rwx,go=rx \
442
--target-directory=$(LIBDIR)/mandos \
443
mandos-to-cryptroot-unlock
428
--target-directory=$(LIBDIR)/mandos mandos-to-cryptroot-unlock
444
429
install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
446
431
install --mode=u=rwx,go=rx \
509
494
if command -v update-initramfs >/dev/null; then \
510
495
update-initramfs -k all -u; \
511
496
elif command -v dracut >/dev/null; then \
512
for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
497
for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
513
498
if [ -w "$$initrd" ]; then \
514
499
chmod go-r "$$initrd"; \
515
500
dracut --force "$$initrd"; \
568
553
if command -v update-initramfs >/dev/null; then \
569
554
update-initramfs -k all -u; \
570
555
elif command -v dracut >/dev/null; then \
571
for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
556
for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
572
557
test -w "$$initrd" && dracut --force "$$initrd"; \