/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 at recompile
  • Date: 2020-02-09 03:42:50 UTC
  • Revision ID: teddy@recompile.se-20200209034250-dxkkuq0eevnzk8py
Update formatting in TODO file

* TODO: Add markup, links and a file-wide tag.

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.9
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
360
354
keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem: mandos-keygen
361
355
        install --directory keydir
362
356
        ./mandos-keygen --dir keydir --force
363
 
        if ! [ -e keydir/tls-privkey.pem ]; then \
364
 
                install --mode=u=rw /dev/null keydir/tls-privkey.pem; \
365
 
        fi
366
 
        if ! [ -e keydir/tls-pubkey.pem ]; then \
367
 
                install --mode=u=rw /dev/null keydir/tls-pubkey.pem; \
368
 
        fi
369
357
 
370
358
# Run the server with a local config
371
359
.PHONY: run-server
375
363
 
376
364
# Used by run-server
377
365
confdir/mandos.conf: mandos.conf
378
 
        install -D --mode=u=rw,go=r $^ $@
 
366
        install --directory confdir
 
367
        install --mode=u=rw,go=r $^ $@
379
368
confdir/clients.conf: clients.conf keydir/seckey.txt keydir/tls-pubkey.pem
380
 
        install -D --mode=u=rw $< $@
 
369
        install --directory confdir
 
370
        install --mode=u=rw $< $@
381
371
# Add a client password
382
372
        ./mandos-keygen --dir keydir --password --no-ssh >> $@
383
373
statedir:
388
378
 
389
379
.PHONY: install-html
390
380
install-html: html
391
 
        install -D --mode=u=rw,go=r --target-directory=$(htmldir) \
 
381
        install --directory $(htmldir)
 
382
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
392
383
                $(htmldocs)
393
384
 
394
385
.PHONY: install-server
395
386
install-server: doc
 
387
        install --directory $(CONFDIR)
396
388
        if install --directory --mode=u=rwx --owner=$(USER) \
397
389
                --group=$(GROUP) $(STATEDIR); then \
398
390
                :; \
399
391
        elif install --directory --mode=u=rwx $(STATEDIR); then \
400
392
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
401
393
        fi
402
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" ]; then \
403
 
                install -D --mode=u=rw,go=r tmpfiles.d-mandos.conf \
 
394
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
 
395
                        -a -d "$(TMPFILES)" ]; then \
 
396
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
404
397
                        $(TMPFILES)/mandos.conf; \
405
398
        fi
406
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
407
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
399
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
400
                        -a -d "$(SYSUSERS)" ]; then \
 
401
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
408
402
                        $(SYSUSERS)/mandos.conf; \
409
403
        fi
410
 
        install --directory $(PREFIX)/sbin
411
 
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
412
 
                mandos
 
404
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
413
405
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
414
406
                mandos-ctl
415
407
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
416
408
                mandos-monitor
417
 
        install --directory $(CONFDIR)
418
409
        install --mode=u=rw,go=r --target-directory=$(CONFDIR) \
419
410
                mandos.conf
420
411
        install --mode=u=rw --target-directory=$(CONFDIR) \
421
412
                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 \
 
413
        install --mode=u=rw,go=r dbus-mandos.conf \
 
414
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
 
415
        install --mode=u=rwx,go=rx init.d-mandos \
425
416
                $(DESTDIR)/etc/init.d/mandos
426
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" ]; then \
427
 
                install -D --mode=u=rw,go=r mandos.service \
428
 
                        $(SYSTEMD); \
 
417
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
 
418
                install --mode=u=rw,go=r mandos.service $(SYSTEMD); \
429
419
        fi
430
 
        install -D --mode=u=rw,go=r default-mandos \
 
420
        install --mode=u=rw,go=r default-mandos \
431
421
                $(DESTDIR)/etc/default/mandos
432
422
        if [ -z $(DESTDIR) ]; then \
433
423
                update-rc.d mandos defaults 25 15;\
434
424
        fi
435
 
        install --directory $(MANDIR)/man8 $(MANDIR)/man5
436
425
        gzip --best --to-stdout mandos.8 \
437
426
                > $(MANDIR)/man8/mandos.8.gz
438
427
        gzip --best --to-stdout mandos-monitor.8 \
448
437
 
449
438
.PHONY: install-client-nokey
450
439
install-client-nokey: all doc
 
440
        install --directory $(LIBDIR)/mandos $(CONFDIR)
451
441
        install --directory --mode=u=rwx $(KEYDIR) \
452
442
                $(LIBDIR)/mandos/plugins.d \
453
443
                $(LIBDIR)/mandos/plugin-helpers
454
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
455
 
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
 
444
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
445
                        -a -d "$(SYSUSERS)" ]; then \
 
446
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
456
447
                        $(SYSUSERS)/mandos-client.conf; \
457
448
        fi
458
449
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
459
 
                install --directory \
460
 
                        --mode=u=rwx "$(CONFDIR)/plugins.d" \
 
450
                install --mode=u=rwx \
 
451
                        --directory "$(CONFDIR)/plugins.d" \
461
452
                        "$(CONFDIR)/plugin-helpers"; \
462
453
        fi
463
 
        install --directory --mode=u=rwx,go=rx \
 
454
        install --mode=u=rwx,go=rx --directory \
464
455
                "$(CONFDIR)/network-hooks.d"
465
456
        install --mode=u=rwx,go=rx \
466
457
                --target-directory=$(LIBDIR)/mandos plugin-runner
467
458
        install --mode=u=rwx,go=rx \
468
459
                --target-directory=$(LIBDIR)/mandos \
469
460
                mandos-to-cryptroot-unlock
470
 
        install --directory $(PREFIX)/sbin
471
461
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
472
462
                mandos-keygen
473
463
        install --mode=u=rwx,go=rx \
491
481
        install --mode=u=rwx,go=rx \
492
482
                --target-directory=$(LIBDIR)/mandos/plugin-helpers \
493
483
                plugin-helpers/mandos-client-iprouteadddel
494
 
        install -D initramfs-tools-hook \
 
484
        install initramfs-tools-hook \
495
485
                $(INITRAMFSTOOLS)/hooks/mandos
496
 
        install -D --mode=u=rw,go=r initramfs-tools-conf \
 
486
        install --mode=u=rw,go=r initramfs-tools-conf \
497
487
                $(INITRAMFSTOOLS)/conf.d/mandos-conf
498
 
        install -D --mode=u=rw,go=r initramfs-tools-conf-hook \
 
488
        install --mode=u=rw,go=r initramfs-tools-conf-hook \
499
489
                $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos
500
 
        install -D initramfs-tools-script \
 
490
        install initramfs-tools-script \
501
491
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
502
 
        install -D initramfs-tools-script-stop \
 
492
        install initramfs-tools-script-stop \
503
493
                $(INITRAMFSTOOLS)/scripts/local-premount/mandos
504
 
        install -D --mode=u=rw,go=r \
505
 
                --target-directory=$(DRACUTMODULE) \
 
494
        install --directory $(DRACUTMODULE)
 
495
        install --mode=u=rw,go=r --target-directory=$(DRACUTMODULE) \
506
496
                dracut-module/ask-password-mandos.path \
507
497
                dracut-module/ask-password-mandos.service
508
498
        install --mode=u=rwxs,go=rx \
511
501
                dracut-module/cmdline-mandos.sh \
512
502
                dracut-module/password-agent
513
503
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
514
 
        install --directory $(MANDIR)/man8
515
504
        gzip --best --to-stdout mandos-keygen.8 \
516
505
                > $(MANDIR)/man8/mandos-keygen.8.gz
517
506
        gzip --best --to-stdout plugin-runner.8mandos \
614
603
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
615
604
                $(DESTDIR)/etc/default/mandos \
616
605
                $(DESTDIR)/etc/init.d/mandos \
 
606
                $(SYSTEMD)/mandos.service \
617
607
                $(DESTDIR)/run/mandos.pid \
618
608
                $(DESTDIR)/var/run/mandos.pid
619
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
620
 
                -rm --force -- $(SYSTEMD)/mandos.service; \
621
 
        fi
622
609
        -rmdir $(CONFDIR)
623
610
 
624
611
.PHONY: purge-client