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