/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: 2020-11-30 09:40:14 UTC
  • Revision ID: teddy@recompile.se-20201130094014-33tl5zzswqprc034
Revert commit 1222

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
# For info about _FORTIFY_SOURCE, see feature_test_macros(7)
31
31
# and <https://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html>.
32
 
FORTIFY:=-fstack-protector-all -fPIC
33
 
CPPFLAGS+=-D_FORTIFY_SOURCE=3
 
32
FORTIFY:=-D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIC
34
33
LINK_FORTIFY_LD:=-z relro -z now
35
34
LINK_FORTIFY:=
36
35
 
42
41
#COVERAGE=--coverage
43
42
OPTIMIZE:=-Os -fno-strict-aliasing
44
43
LANGUAGE:=-std=gnu11
45
 
CPPFLAGS+=-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
 
44
FEATURES:=-D_FILE_OFFSET_BITS=64
46
45
htmldir:=man
47
 
version:=1.8.16
 
46
version:=1.8.12
48
47
SED:=sed
49
48
PKG_CONFIG?=pkg-config
50
49
 
64
63
# DRACUTMODULE:=$(DESTDIR)/usr/lib/dracut/modules.d/90mandos
65
64
# STATEDIR:=$(DESTDIR)/var/lib/mandos
66
65
# LIBDIR:=$(PREFIX)/lib
67
 
# DBUSPOLICYDIR:=$(DESTDIR)/etc/dbus-1/system.d
68
66
##
69
67
 
70
68
## These settings are for a package-type install
85
83
                        break; \
86
84
                fi; \
87
85
        done)
88
 
DBUSPOLICYDIR:=$(DESTDIR)/usr/share/dbus-1/system.d
89
86
##
90
87
 
91
88
SYSTEMD:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
99
96
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
100
97
AVAHI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I avahi-core)
101
98
AVAHI_LIBS:=$(shell $(PKG_CONFIG) --libs avahi-core)
102
 
GPGME_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gpgme 2>/dev/null \
103
 
        || gpgme-config --cflags; getconf LFS_CFLAGS)
104
 
GPGME_LIBS:=$(shell $(PKG_CONFIG) --libs gpgme 2>/dev/null \
105
 
        || gpgme-config --libs; getconf LFS_LIBS; \
 
99
GPGME_CFLAGS:=$(shell gpgme-config --cflags; getconf LFS_CFLAGS)
 
100
GPGME_LIBS:=$(shell gpgme-config --libs; getconf LFS_LIBS; \
106
101
        getconf LFS_LDFLAGS)
107
102
LIBNL3_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I libnl-route-3.0)
108
103
LIBNL3_LIBS:=$(shell $(PKG_CONFIG) --libs libnl-route-3.0)
111
106
 
112
107
# Do not change these two
113
108
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
114
 
        $(LANGUAGE) -DVERSION='"$(version)"'
 
109
        $(LANGUAGE) $(FEATURES) -DVERSION='"$(version)"'
115
110
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(strip \
116
111
        ) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
117
112
 
301
296
 
302
297
# Need to add the GLib and pthread libraries
303
298
dracut-module/password-agent: CFLAGS += $(GLIB_CFLAGS)
304
 
# Note: -lpthread is unnecessary with the GNU C library 2.34 or later
305
299
dracut-module/password-agent: LDLIBS += $(GLIB_LIBS) -lpthread
306
300
 
307
301
.PHONY: clean
375
369
 
376
370
# Used by run-server
377
371
confdir/mandos.conf: mandos.conf
378
 
        install -D --mode=u=rw,go=r $^ $@
 
372
        install --directory confdir
 
373
        install --mode=u=rw,go=r $^ $@
379
374
confdir/clients.conf: clients.conf keydir/seckey.txt keydir/tls-pubkey.pem
380
 
        install -D --mode=u=rw $< $@
 
375
        install --directory confdir
 
376
        install --mode=u=rw $< $@
381
377
# Add a client password
382
378
        ./mandos-keygen --dir keydir --password --no-ssh >> $@
383
379
statedir:
388
384
 
389
385
.PHONY: install-html
390
386
install-html: html
391
 
        install -D --mode=u=rw,go=r --target-directory=$(htmldir) \
 
387
        install --directory $(htmldir)
 
388
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
392
389
                $(htmldocs)
393
390
 
394
391
.PHONY: install-server
395
392
install-server: doc
 
393
        install --directory $(CONFDIR)
396
394
        if install --directory --mode=u=rwx --owner=$(USER) \
397
395
                --group=$(GROUP) $(STATEDIR); then \
398
396
                :; \
399
397
        elif install --directory --mode=u=rwx $(STATEDIR); then \
400
398
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
401
399
        fi
402
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" ]; then \
403
 
                install -D --mode=u=rw,go=r tmpfiles.d-mandos.conf \
 
400
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
 
401
                        -a -d "$(TMPFILES)" ]; then \
 
402
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
404
403
                        $(TMPFILES)/mandos.conf; \
405
404
        fi
406
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
407
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
405
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
406
                        -a -d "$(SYSUSERS)" ]; then \
 
407
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
408
408
                        $(SYSUSERS)/mandos.conf; \
409
409
        fi
410
 
        install --directory $(PREFIX)/sbin
411
 
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
412
 
                mandos
 
410
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
413
411
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
414
412
                mandos-ctl
415
413
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
416
414
                mandos-monitor
417
 
        install --directory $(CONFDIR)
418
415
        install --mode=u=rw,go=r --target-directory=$(CONFDIR) \
419
416
                mandos.conf
420
417
        install --mode=u=rw --target-directory=$(CONFDIR) \
421
418
                clients.conf
422
 
        install -D --mode=u=rw,go=r dbus-mandos.conf \
423
 
                $(DBUSPOLICYDIR)/mandos.conf
424
 
        install -D --mode=u=rwx,go=rx init.d-mandos \
 
419
        install --mode=u=rw,go=r dbus-mandos.conf \
 
420
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
 
421
        install --mode=u=rwx,go=rx init.d-mandos \
425
422
                $(DESTDIR)/etc/init.d/mandos
426
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" ]; then \
427
 
                install -D --mode=u=rw,go=r mandos.service \
428
 
                        $(SYSTEMD); \
 
423
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
 
424
                install --mode=u=rw,go=r mandos.service $(SYSTEMD); \
429
425
        fi
430
 
        install -D --mode=u=rw,go=r default-mandos \
 
426
        install --mode=u=rw,go=r default-mandos \
431
427
                $(DESTDIR)/etc/default/mandos
432
428
        if [ -z $(DESTDIR) ]; then \
433
429
                update-rc.d mandos defaults 25 15;\
434
430
        fi
435
 
        install --directory $(MANDIR)/man8 $(MANDIR)/man5
436
431
        gzip --best --to-stdout mandos.8 \
437
432
                > $(MANDIR)/man8/mandos.8.gz
438
433
        gzip --best --to-stdout mandos-monitor.8 \
448
443
 
449
444
.PHONY: install-client-nokey
450
445
install-client-nokey: all doc
 
446
        install --directory $(LIBDIR)/mandos $(CONFDIR)
451
447
        install --directory --mode=u=rwx $(KEYDIR) \
452
448
                $(LIBDIR)/mandos/plugins.d \
453
449
                $(LIBDIR)/mandos/plugin-helpers
454
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
455
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
450
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
451
                        -a -d "$(SYSUSERS)" ]; then \
 
452
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
456
453
                        $(SYSUSERS)/mandos-client.conf; \
457
454
        fi
458
455
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
459
 
                install --directory \
460
 
                        --mode=u=rwx "$(CONFDIR)/plugins.d" \
 
456
                install --mode=u=rwx \
 
457
                        --directory "$(CONFDIR)/plugins.d" \
461
458
                        "$(CONFDIR)/plugin-helpers"; \
462
459
        fi
463
 
        install --directory --mode=u=rwx,go=rx \
 
460
        install --mode=u=rwx,go=rx --directory \
464
461
                "$(CONFDIR)/network-hooks.d"
465
462
        install --mode=u=rwx,go=rx \
466
463
                --target-directory=$(LIBDIR)/mandos plugin-runner
467
464
        install --mode=u=rwx,go=rx \
468
465
                --target-directory=$(LIBDIR)/mandos \
469
466
                mandos-to-cryptroot-unlock
470
 
        install --directory $(PREFIX)/sbin
471
467
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
472
468
                mandos-keygen
473
469
        install --mode=u=rwx,go=rx \
491
487
        install --mode=u=rwx,go=rx \
492
488
                --target-directory=$(LIBDIR)/mandos/plugin-helpers \
493
489
                plugin-helpers/mandos-client-iprouteadddel
494
 
        install -D initramfs-tools-hook \
 
490
        install initramfs-tools-hook \
495
491
                $(INITRAMFSTOOLS)/hooks/mandos
496
 
        install -D --mode=u=rw,go=r initramfs-tools-conf \
 
492
        install --mode=u=rw,go=r initramfs-tools-conf \
497
493
                $(INITRAMFSTOOLS)/conf.d/mandos-conf
498
 
        install -D --mode=u=rw,go=r initramfs-tools-conf-hook \
 
494
        install --mode=u=rw,go=r initramfs-tools-conf-hook \
499
495
                $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos
500
 
        install -D initramfs-tools-script \
 
496
        install initramfs-tools-script \
501
497
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
502
 
        install -D initramfs-tools-script-stop \
 
498
        install initramfs-tools-script-stop \
503
499
                $(INITRAMFSTOOLS)/scripts/local-premount/mandos
504
 
        install -D --mode=u=rw,go=r \
505
 
                --target-directory=$(DRACUTMODULE) \
 
500
        install --directory $(DRACUTMODULE)
 
501
        install --mode=u=rw,go=r --target-directory=$(DRACUTMODULE) \
506
502
                dracut-module/ask-password-mandos.path \
507
503
                dracut-module/ask-password-mandos.service
508
504
        install --mode=u=rwxs,go=rx \
511
507
                dracut-module/cmdline-mandos.sh \
512
508
                dracut-module/password-agent
513
509
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
514
 
        install --directory $(MANDIR)/man8
515
510
        gzip --best --to-stdout mandos-keygen.8 \
516
511
                > $(MANDIR)/man8/mandos-keygen.8.gz
517
512
        gzip --best --to-stdout plugin-runner.8mandos \
614
609
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
615
610
                $(DESTDIR)/etc/default/mandos \
616
611
                $(DESTDIR)/etc/init.d/mandos \
 
612
                $(SYSTEMD)/mandos.service \
617
613
                $(DESTDIR)/run/mandos.pid \
618
614
                $(DESTDIR)/var/run/mandos.pid
619
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
620
 
                -rm --force -- $(SYSTEMD)/mandos.service; \
621
 
        fi
622
615
        -rmdir $(CONFDIR)
623
616
 
624
617
.PHONY: purge-client