/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: 2019-08-18 00:42:22 UTC
  • Revision ID: teddy@recompile.se-20190818004222-lfrgtnmqz766a08e
Client: Use the systemd sysusers.d mechanism, if present

* Makefile (install-client-nokey): Also install sysusers.d file, if
                                   $(SYSUSERS) exists.
* sysusers.d-mandos.conf: Adjust comment to match reality.

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:=-D_FORTIFY_SOURCE=3 -fstack-protector-all -fPIC
 
32
FORTIFY:=-D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIC
33
33
LINK_FORTIFY_LD:=-z relro -z now
34
34
LINK_FORTIFY:=
35
35
 
43
43
LANGUAGE:=-std=gnu11
44
44
FEATURES:=-D_FILE_OFFSET_BITS=64
45
45
htmldir:=man
46
 
version:=1.8.15
 
46
version:=1.8.7
47
47
SED:=sed
48
48
PKG_CONFIG?=pkg-config
49
49
 
96
96
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
97
97
AVAHI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I avahi-core)
98
98
AVAHI_LIBS:=$(shell $(PKG_CONFIG) --libs avahi-core)
99
 
GPGME_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gpgme 2>/dev/null \
100
 
        || gpgme-config --cflags; getconf LFS_CFLAGS)
101
 
GPGME_LIBS:=$(shell $(PKG_CONFIG) --libs gpgme 2>/dev/null \
102
 
        || 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; \
103
101
        getconf LFS_LDFLAGS)
104
102
LIBNL3_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I libnl-route-3.0)
105
103
LIBNL3_LIBS:=$(shell $(PKG_CONFIG) --libs libnl-route-3.0)
158
156
 
159
157
objects:=$(addsuffix .o,$(CPROGS))
160
158
 
161
 
.PHONY: all
162
159
all: $(PROGS) mandos.lsm
163
160
 
164
 
.PHONY: doc
165
161
doc: $(DOCS)
166
162
 
167
 
.PHONY: html
168
163
html: $(htmldocs)
169
164
 
170
165
%.5: %.xml common.ent legalnotice.xml
287
282
                $@)
288
283
 
289
284
# Need to add the GnuTLS, Avahi and GPGME libraries
290
 
plugins.d/mandos-client: CFLAGS += $(GNUTLS_CFLAGS) $(strip \
291
 
        ) $(AVAHI_CFLAGS) $(GPGME_CFLAGS)
292
 
plugins.d/mandos-client: LDLIBS += $(GNUTLS_LIBS) $(strip \
293
 
        ) $(AVAHI_LIBS) $(GPGME_LIBS)
 
285
plugins.d/mandos-client: plugins.d/mandos-client.c
 
286
        $(LINK.c) $^ $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(strip\
 
287
                ) $(GPGME_CFLAGS) $(GNUTLS_LIBS) $(strip\
 
288
                ) $(AVAHI_LIBS) $(GPGME_LIBS) $(LOADLIBES) $(strip\
 
289
                ) $(LDLIBS) -o $@
294
290
 
295
291
# Need to add the libnl-route library
296
 
plugin-helpers/mandos-client-iprouteadddel: CFLAGS += $(LIBNL3_CFLAGS)
297
 
plugin-helpers/mandos-client-iprouteadddel: LDLIBS += $(LIBNL3_LIBS)
 
292
plugin-helpers/mandos-client-iprouteadddel: plugin-helpers/mandos-client-iprouteadddel.c
 
293
        $(LINK.c) $(LIBNL3_CFLAGS) $^ $(LIBNL3_LIBS) $(strip\
 
294
                ) $(LOADLIBES) $(LDLIBS) -o $@
298
295
 
299
296
# Need to add the GLib and pthread libraries
300
 
dracut-module/password-agent: CFLAGS += $(GLIB_CFLAGS)
301
 
# Note: -lpthread is unnecessary with the GNU C library 2.34 or later
302
 
dracut-module/password-agent: LDLIBS += $(GLIB_LIBS) -lpthread
303
 
 
304
 
.PHONY: clean
 
297
dracut-module/password-agent: dracut-module/password-agent.c
 
298
        $(LINK.c) $(GLIB_CFLAGS) $^ $(GLIB_LIBS) -lpthread $(strip\
 
299
                ) $(LOADLIBES) $(LDLIBS) -o $@
 
300
 
 
301
.PHONY : all doc html clean distclean mostlyclean maintainer-clean \
 
302
        check run-client run-server install install-html \
 
303
        install-server install-client-nokey install-client uninstall \
 
304
        uninstall-server uninstall-client purge purge-server \
 
305
        purge-client
 
306
 
305
307
clean:
306
308
        -rm --force $(CPROGS) $(objects) $(htmldocs) $(DOCS) core
307
309
 
308
 
.PHONY: distclean
309
310
distclean: clean
310
 
.PHONY: mostlyclean
311
311
mostlyclean: clean
312
 
.PHONY: maintainer-clean
313
312
maintainer-clean: clean
314
313
        -rm --force --recursive keydir confdir statedir
315
314
 
316
 
.PHONY: check
317
315
check: all
318
316
        ./mandos --check
319
317
        ./mandos-ctl --check
323
321
        ./dracut-module/password-agent --test
324
322
 
325
323
# Run the client with a local config and key
326
 
.PHONY: run-client
327
324
run-client: all keydir/seckey.txt keydir/pubkey.txt \
328
325
                        keydir/tls-privkey.pem keydir/tls-pubkey.pem
329
326
        @echo '######################################################'
357
354
keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem: mandos-keygen
358
355
        install --directory keydir
359
356
        ./mandos-keygen --dir keydir --force
360
 
        if ! [ -e keydir/tls-privkey.pem ]; then \
361
 
                install --mode=u=rw /dev/null keydir/tls-privkey.pem; \
362
 
        fi
363
 
        if ! [ -e keydir/tls-pubkey.pem ]; then \
364
 
                install --mode=u=rw /dev/null keydir/tls-pubkey.pem; \
365
 
        fi
366
357
 
367
358
# Run the server with a local config
368
 
.PHONY: run-server
369
359
run-server: confdir/mandos.conf confdir/clients.conf statedir
370
360
        ./mandos --debug --no-dbus --configdir=confdir \
371
361
                --statedir=statedir $(SERVERARGS)
382
372
statedir:
383
373
        install --directory statedir
384
374
 
385
 
.PHONY: install
386
375
install: install-server install-client-nokey
387
376
 
388
 
.PHONY: install-html
389
377
install-html: html
390
378
        install --directory $(htmldir)
391
379
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
392
380
                $(htmldocs)
393
381
 
394
 
.PHONY: install-server
395
382
install-server: doc
396
383
        install --directory $(CONFDIR)
397
384
        if install --directory --mode=u=rwx --owner=$(USER) \
444
431
        gzip --best --to-stdout intro.8mandos \
445
432
                > $(MANDIR)/man8/intro.8mandos.gz
446
433
 
447
 
.PHONY: install-client-nokey
448
434
install-client-nokey: all doc
449
435
        install --directory $(LIBDIR)/mandos $(CONFDIR)
450
436
        install --directory --mode=u=rwx $(KEYDIR) \
529
515
        gzip --best --to-stdout dracut-module/password-agent.8mandos \
530
516
                > $(MANDIR)/man8/password-agent.8mandos.gz
531
517
 
532
 
.PHONY: install-client
533
518
install-client: install-client-nokey
534
519
# Post-installation stuff
535
520
        -$(PREFIX)/sbin/mandos-keygen --dir "$(KEYDIR)"
545
530
        fi
546
531
        echo "Now run mandos-keygen --password --dir $(KEYDIR)"
547
532
 
548
 
.PHONY: uninstall
549
533
uninstall: uninstall-server uninstall-client
550
534
 
551
 
.PHONY: uninstall-server
552
535
uninstall-server:
553
536
        -rm --force $(PREFIX)/sbin/mandos \
554
537
                $(PREFIX)/sbin/mandos-ctl \
561
544
        update-rc.d -f mandos remove
562
545
        -rmdir $(CONFDIR)
563
546
 
564
 
.PHONY: uninstall-client
565
547
uninstall-client:
566
548
# Refuse to uninstall client if /etc/crypttab is explicitly configured
567
549
# to use it.
603
585
            done; \
604
586
        fi
605
587
 
606
 
.PHONY: purge
607
588
purge: purge-server purge-client
608
589
 
609
 
.PHONY: purge-server
610
590
purge-server: uninstall-server
611
591
        -rm --force $(CONFDIR)/mandos.conf $(CONFDIR)/clients.conf \
612
592
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
617
597
                $(DESTDIR)/var/run/mandos.pid
618
598
        -rmdir $(CONFDIR)
619
599
 
620
 
.PHONY: purge-client
621
600
purge-client: uninstall-client
622
601
        -shred --remove $(KEYDIR)/seckey.txt $(KEYDIR)/tls-privkey.pem
623
602
        -rm --force $(CONFDIR)/plugin-runner.conf \