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)
92
SYSUSERS:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
93
--variable=sysusersdir)
83
SYSTEMD:=$(DESTDIR)$(shell pkg-config systemd --variable=systemdsystemunitdir)
84
TMPFILES:=$(DESTDIR)$(shell pkg-config systemd --variable=tmpfilesdir)
95
GNUTLS_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gnutls)
96
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
97
AVAHI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I avahi-core)
98
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)
99
90
GPGME_CFLAGS:=$(shell gpgme-config --cflags; getconf LFS_CFLAGS)
100
91
GPGME_LIBS:=$(shell gpgme-config --libs; getconf LFS_LIBS; \
101
92
getconf LFS_LDFLAGS)
102
LIBNL3_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I libnl-route-3.0)
103
LIBNL3_LIBS:=$(shell $(PKG_CONFIG) --libs libnl-route-3.0)
104
GLIB_CFLAGS:=$(shell $(PKG_CONFIG) --cflags glib-2.0)
105
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)
107
98
# Do not change these two
108
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
109
$(LANGUAGE) $(FEATURES) -DVERSION='"$(version)"'
99
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) \
100
$(OPTIMIZE) $(LANGUAGE) -DVERSION='"$(version)"'
110
101
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(strip \
111
102
) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
321
312
./dracut-module/password-agent --test
323
314
# Run the client with a local config and key
324
run-client: all keydir/seckey.txt keydir/pubkey.txt \
325
keydir/tls-privkey.pem keydir/tls-pubkey.pem
326
@echo '######################################################'
327
@echo '# The following error messages are harmless and can #'
328
@echo '# be safely ignored: #'
329
@echo '## From plugin-runner: #'
330
@echo '# setgid: Operation not permitted #'
331
@echo '# setuid: Operation not permitted #'
332
@echo '## From askpass-fifo: #'
333
@echo '# mkfifo: Permission denied #'
334
@echo '## From mandos-client: #'
335
@echo '# Failed to raise privileges: Operation not permi... #'
336
@echo '# Warning: network hook "*" exited with status * #'
337
@echo '# ioctl SIOCSIFFLAGS +IFF_UP: Operation not permi... #'
338
@echo '# Failed to bring up interface "*": Operation not... #'
340
@echo '# (The messages are caused by not running as root, #'
341
@echo '# but you should NOT run "make run-client" as root #'
342
@echo '# unless you also unpacked and compiled Mandos as #'
343
@echo '# root, which is also NOT recommended.) #'
344
@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 "###################################################################"
345
330
# We set GNOME_KEYRING_CONTROL to block pam_gnome_keyring
346
331
./plugin-runner --plugin-dir=plugins.d \
347
332
--plugin-helper-dir=plugin-helpers \
387
372
elif install --directory --mode=u=rwx $(STATEDIR); then \
388
373
chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
390
if [ "$(TMPFILES)" != "$(DESTDIR)" \
391
-a -d "$(TMPFILES)" ]; then \
375
if [ "$(TMPFILES)" != "$(DESTDIR)" -a -d "$(TMPFILES)" ]; then \
392
376
install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
393
377
$(TMPFILES)/mandos.conf; \
395
if [ "$(SYSUSERS)" != "$(DESTDIR)" \
396
-a -d "$(SYSUSERS)" ]; then \
397
install --mode=u=rw,go=r sysusers.d-mandos.conf \
398
$(SYSUSERS)/mandos.conf; \
400
379
install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
401
380
install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
436
415
install --directory --mode=u=rwx $(KEYDIR) \
437
416
$(LIBDIR)/mandos/plugins.d \
438
417
$(LIBDIR)/mandos/plugin-helpers
439
if [ "$(SYSUSERS)" != "$(DESTDIR)" \
440
-a -d "$(SYSUSERS)" ]; then \
441
install --mode=u=rw,go=r sysusers.d-mandos.conf \
442
$(SYSUSERS)/mandos-client.conf; \
444
418
if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
445
419
install --mode=u=rwx \
446
420
--directory "$(CONFDIR)/plugins.d" \
451
425
install --mode=u=rwx,go=rx \
452
426
--target-directory=$(LIBDIR)/mandos plugin-runner
453
427
install --mode=u=rwx,go=rx \
454
--target-directory=$(LIBDIR)/mandos \
455
mandos-to-cryptroot-unlock
428
--target-directory=$(LIBDIR)/mandos mandos-to-cryptroot-unlock
456
429
install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
458
431
install --mode=u=rwx,go=rx \
521
494
if command -v update-initramfs >/dev/null; then \
522
495
update-initramfs -k all -u; \
523
496
elif command -v dracut >/dev/null; then \
524
for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
497
for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
525
498
if [ -w "$$initrd" ]; then \
526
499
chmod go-r "$$initrd"; \
527
500
dracut --force "$$initrd"; \
580
553
if command -v update-initramfs >/dev/null; then \
581
554
update-initramfs -k all -u; \
582
555
elif command -v dracut >/dev/null; then \
583
for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
556
for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
584
557
test -w "$$initrd" && dracut --force "$$initrd"; \