/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: 2024-09-09 04:24:39 UTC
  • Revision ID: teddy@recompile.se-20240909042439-j85mr20uli2hnyis
Eliminate compiler warnings

Many programs use nested functions, which now result in a linker
warning about executable stack.  Hide this warning.  Also, rewrite a
loop in the plymouth plugin to avoid warning about signed overflow.
This change also makes the plugin pick the alphabetically first
process entry instead of the last, in case many plymouth processes are
found (which should be unlikely).

* Makefile (plugin-runner, dracut-module/password-agent,
  plugins.d/password-prompt, plugins.d/mandos-client,
  plugins.d/plymouth): New target; set LDFLAGS to add "-Xlinker
  --no-warn-execstack".
* plugins.d/plymouth.c (get_pid): When no pid files are found, and we
  are looking through the process list, go though it from the start
  instead of from the end, i.e. in normal alphabetical order and not
  in reverse order.

Show diffs side-by-side

added added

removed removed

Lines of Context:
289
289
                --expression='s/\(mandos_\)[0-9.]\+\(\.orig\.tar\.gz\)/\1$(version)\2/' \
290
290
                $@)
291
291
 
 
292
# Uses nested functions
 
293
plugin-runner: LDFLAGS += -Xlinker --no-warn-execstack
 
294
dracut-module/password-agent: LDFLAGS += -Xlinker --no-warn-execstack
 
295
plugins.d/password-prompt: LDFLAGS += -Xlinker --no-warn-execstack
 
296
plugins.d/mandos-client: LDFLAGS += -Xlinker --no-warn-execstack
 
297
plugins.d/plymouth: LDFLAGS += -Xlinker --no-warn-execstack
 
298
 
292
299
# Need to add the GnuTLS, Avahi and GPGME libraries
293
300
plugins.d/mandos-client: CFLAGS += $(GNUTLS_CFLAGS) $(strip \
294
301
        ) $(AVAHI_CFLAGS) $(GPGME_CFLAGS)
375
382
 
376
383
# Used by run-server
377
384
confdir/mandos.conf: mandos.conf
378
 
        install --directory confdir
379
 
        install --mode=u=rw,go=r $^ $@
 
385
        install -D --mode=u=rw,go=r $^ $@
380
386
confdir/clients.conf: clients.conf keydir/seckey.txt keydir/tls-pubkey.pem
381
 
        install --directory confdir
382
 
        install --mode=u=rw $< $@
 
387
        install -D --mode=u=rw $< $@
383
388
# Add a client password
384
389
        ./mandos-keygen --dir keydir --password --no-ssh >> $@
385
390
statedir:
390
395
 
391
396
.PHONY: install-html
392
397
install-html: html
393
 
        install --directory $(htmldir)
394
 
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
 
398
        install -D --mode=u=rw,go=r --target-directory=$(htmldir) \
395
399
                $(htmldocs)
396
400
 
397
401
.PHONY: install-server
398
402
install-server: doc
399
 
        install --directory $(CONFDIR)
400
403
        if install --directory --mode=u=rwx --owner=$(USER) \
401
404
                --group=$(GROUP) $(STATEDIR); then \
402
405
                :; \
403
406
        elif install --directory --mode=u=rwx $(STATEDIR); then \
404
407
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
405
408
        fi
406
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
407
 
                        -a -d "$(TMPFILES)" ]; then \
408
 
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
 
409
        if [ "$(TMPFILES)" != "$(DESTDIR)" ]; then \
 
410
                install -D --mode=u=rw,go=r tmpfiles.d-mandos.conf \
409
411
                        $(TMPFILES)/mandos.conf; \
410
412
        fi
411
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
412
 
                        -a -d "$(SYSUSERS)" ]; then \
413
 
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
 
413
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
 
414
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
414
415
                        $(SYSUSERS)/mandos.conf; \
415
416
        fi
416
 
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
 
417
        install --directory $(PREFIX)/sbin
 
418
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
 
419
                mandos
417
420
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
418
421
                mandos-ctl
419
422
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
420
423
                mandos-monitor
 
424
        install --directory $(CONFDIR)
421
425
        install --mode=u=rw,go=r --target-directory=$(CONFDIR) \
422
426
                mandos.conf
423
427
        install --mode=u=rw --target-directory=$(CONFDIR) \
424
428
                clients.conf
425
 
        install --mode=u=rw,go=r dbus-mandos.conf \
 
429
        install -D --mode=u=rw,go=r dbus-mandos.conf \
426
430
                $(DBUSPOLICYDIR)/mandos.conf
427
 
        install --mode=u=rwx,go=rx init.d-mandos \
 
431
        install -D --mode=u=rwx,go=rx init.d-mandos \
428
432
                $(DESTDIR)/etc/init.d/mandos
429
 
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
430
 
                install --mode=u=rw,go=r mandos.service $(SYSTEMD); \
 
433
        if [ "$(SYSTEMD)" != "$(DESTDIR)" ]; then \
 
434
                install -D --mode=u=rw,go=r mandos.service \
 
435
                        $(SYSTEMD); \
431
436
        fi
432
 
        install --mode=u=rw,go=r default-mandos \
 
437
        install -D --mode=u=rw,go=r default-mandos \
433
438
                $(DESTDIR)/etc/default/mandos
434
439
        if [ -z $(DESTDIR) ]; then \
435
440
                update-rc.d mandos defaults 25 15;\
436
441
        fi
 
442
        install --directory $(MANDIR)/man8 $(MANDIR)/man5
437
443
        gzip --best --to-stdout mandos.8 \
438
444
                > $(MANDIR)/man8/mandos.8.gz
439
445
        gzip --best --to-stdout mandos-monitor.8 \
449
455
 
450
456
.PHONY: install-client-nokey
451
457
install-client-nokey: all doc
452
 
        install --directory $(LIBDIR)/mandos $(CONFDIR)
453
458
        install --directory --mode=u=rwx $(KEYDIR) \
454
459
                $(LIBDIR)/mandos/plugins.d \
455
460
                $(LIBDIR)/mandos/plugin-helpers
456
 
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
457
 
                        -a -d "$(SYSUSERS)" ]; then \
458
 
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
 
461
        if [ "$(SYSUSERS)" != "$(DESTDIR)" ]; then \
 
462
                install -D --mode=u=rw,go=r sysusers.d-mandos.conf \
459
463
                        $(SYSUSERS)/mandos-client.conf; \
460
464
        fi
461
465
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
462
 
                install --mode=u=rwx \
463
 
                        --directory "$(CONFDIR)/plugins.d" \
 
466
                install --directory \
 
467
                        --mode=u=rwx "$(CONFDIR)/plugins.d" \
464
468
                        "$(CONFDIR)/plugin-helpers"; \
465
469
        fi
466
 
        install --mode=u=rwx,go=rx --directory \
 
470
        install --directory --mode=u=rwx,go=rx \
467
471
                "$(CONFDIR)/network-hooks.d"
468
472
        install --mode=u=rwx,go=rx \
469
473
                --target-directory=$(LIBDIR)/mandos plugin-runner
470
474
        install --mode=u=rwx,go=rx \
471
475
                --target-directory=$(LIBDIR)/mandos \
472
476
                mandos-to-cryptroot-unlock
 
477
        install --directory $(PREFIX)/sbin
473
478
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
474
479
                mandos-keygen
475
480
        install --mode=u=rwx,go=rx \
493
498
        install --mode=u=rwx,go=rx \
494
499
                --target-directory=$(LIBDIR)/mandos/plugin-helpers \
495
500
                plugin-helpers/mandos-client-iprouteadddel
496
 
        install initramfs-tools-hook \
 
501
        install -D initramfs-tools-hook \
497
502
                $(INITRAMFSTOOLS)/hooks/mandos
498
 
        install --mode=u=rw,go=r initramfs-tools-conf \
 
503
        install -D --mode=u=rw,go=r initramfs-tools-conf \
499
504
                $(INITRAMFSTOOLS)/conf.d/mandos-conf
500
 
        install --mode=u=rw,go=r initramfs-tools-conf-hook \
 
505
        install -D --mode=u=rw,go=r initramfs-tools-conf-hook \
501
506
                $(INITRAMFSTOOLS)/conf-hooks.d/zz-mandos
502
 
        install initramfs-tools-script \
 
507
        install -D initramfs-tools-script \
503
508
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
504
 
        install initramfs-tools-script-stop \
 
509
        install -D initramfs-tools-script-stop \
505
510
                $(INITRAMFSTOOLS)/scripts/local-premount/mandos
506
 
        install --directory $(DRACUTMODULE)
507
 
        install --mode=u=rw,go=r --target-directory=$(DRACUTMODULE) \
 
511
        install -D --mode=u=rw,go=r \
 
512
                --target-directory=$(DRACUTMODULE) \
508
513
                dracut-module/ask-password-mandos.path \
509
514
                dracut-module/ask-password-mandos.service
510
515
        install --mode=u=rwxs,go=rx \
513
518
                dracut-module/cmdline-mandos.sh \
514
519
                dracut-module/password-agent
515
520
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
 
521
        install --directory $(MANDIR)/man8
516
522
        gzip --best --to-stdout mandos-keygen.8 \
517
523
                > $(MANDIR)/man8/mandos-keygen.8.gz
518
524
        gzip --best --to-stdout plugin-runner.8mandos \
615
621
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
616
622
                $(DESTDIR)/etc/default/mandos \
617
623
                $(DESTDIR)/etc/init.d/mandos \
618
 
                $(SYSTEMD)/mandos.service \
619
624
                $(DESTDIR)/run/mandos.pid \
620
625
                $(DESTDIR)/var/run/mandos.pid
 
626
        if [ "$(SYSTEMD)" != "$(DESTDIR)" -a -d "$(SYSTEMD)" ]; then \
 
627
                -rm --force -- $(SYSTEMD)/mandos.service; \
 
628
        fi
621
629
        -rmdir $(CONFDIR)
622
630
 
623
631
.PHONY: purge-client