/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-11-21 19:30:47 UTC
  • Revision ID: teddy@recompile.se-20191121193047-nszsowvqcvk081p2
Makefile: Use target-specific variables

Instead of overriding a whole rule and invoking $(LINK.c) explicitly
for certain targets (in order to append special compilation flags),
set CFLAGS and LDLIBS as target-specific variables on those targets.

* Makefile (plugins.d/mandos-client): Replace with a target-specific
  variable setting.
  (plugin-helpers/mandos-client-iprouteadddel): - ''-
  (dracut-module/password-agent): - '' -

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.9
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
298
293
 
299
294
# Need to add the GLib and pthread libraries
300
295
dracut-module/password-agent: CFLAGS += $(GLIB_CFLAGS)
301
 
# Note: -lpthread is unnecessary with the GNU C library 2.34 or later
302
296
dracut-module/password-agent: LDLIBS += $(GLIB_LIBS) -lpthread
303
297
 
304
 
.PHONY: clean
 
298
.PHONY : all doc html clean distclean mostlyclean maintainer-clean \
 
299
        check run-client run-server install install-html \
 
300
        install-server install-client-nokey install-client uninstall \
 
301
        uninstall-server uninstall-client purge purge-server \
 
302
        purge-client
 
303
 
305
304
clean:
306
305
        -rm --force $(CPROGS) $(objects) $(htmldocs) $(DOCS) core
307
306
 
308
 
.PHONY: distclean
309
307
distclean: clean
310
 
.PHONY: mostlyclean
311
308
mostlyclean: clean
312
 
.PHONY: maintainer-clean
313
309
maintainer-clean: clean
314
310
        -rm --force --recursive keydir confdir statedir
315
311
 
316
 
.PHONY: check
317
312
check: all
318
313
        ./mandos --check
319
314
        ./mandos-ctl --check
323
318
        ./dracut-module/password-agent --test
324
319
 
325
320
# Run the client with a local config and key
326
 
.PHONY: run-client
327
321
run-client: all keydir/seckey.txt keydir/pubkey.txt \
328
322
                        keydir/tls-privkey.pem keydir/tls-pubkey.pem
329
323
        @echo '######################################################'
357
351
keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem: mandos-keygen
358
352
        install --directory keydir
359
353
        ./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
354
 
367
355
# Run the server with a local config
368
 
.PHONY: run-server
369
356
run-server: confdir/mandos.conf confdir/clients.conf statedir
370
357
        ./mandos --debug --no-dbus --configdir=confdir \
371
358
                --statedir=statedir $(SERVERARGS)
382
369
statedir:
383
370
        install --directory statedir
384
371
 
385
 
.PHONY: install
386
372
install: install-server install-client-nokey
387
373
 
388
 
.PHONY: install-html
389
374
install-html: html
390
375
        install --directory $(htmldir)
391
376
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
392
377
                $(htmldocs)
393
378
 
394
 
.PHONY: install-server
395
379
install-server: doc
396
380
        install --directory $(CONFDIR)
397
381
        if install --directory --mode=u=rwx --owner=$(USER) \
444
428
        gzip --best --to-stdout intro.8mandos \
445
429
                > $(MANDIR)/man8/intro.8mandos.gz
446
430
 
447
 
.PHONY: install-client-nokey
448
431
install-client-nokey: all doc
449
432
        install --directory $(LIBDIR)/mandos $(CONFDIR)
450
433
        install --directory --mode=u=rwx $(KEYDIR) \
529
512
        gzip --best --to-stdout dracut-module/password-agent.8mandos \
530
513
                > $(MANDIR)/man8/password-agent.8mandos.gz
531
514
 
532
 
.PHONY: install-client
533
515
install-client: install-client-nokey
534
516
# Post-installation stuff
535
517
        -$(PREFIX)/sbin/mandos-keygen --dir "$(KEYDIR)"
545
527
        fi
546
528
        echo "Now run mandos-keygen --password --dir $(KEYDIR)"
547
529
 
548
 
.PHONY: uninstall
549
530
uninstall: uninstall-server uninstall-client
550
531
 
551
 
.PHONY: uninstall-server
552
532
uninstall-server:
553
533
        -rm --force $(PREFIX)/sbin/mandos \
554
534
                $(PREFIX)/sbin/mandos-ctl \
561
541
        update-rc.d -f mandos remove
562
542
        -rmdir $(CONFDIR)
563
543
 
564
 
.PHONY: uninstall-client
565
544
uninstall-client:
566
545
# Refuse to uninstall client if /etc/crypttab is explicitly configured
567
546
# to use it.
603
582
            done; \
604
583
        fi
605
584
 
606
 
.PHONY: purge
607
585
purge: purge-server purge-client
608
586
 
609
 
.PHONY: purge-server
610
587
purge-server: uninstall-server
611
588
        -rm --force $(CONFDIR)/mandos.conf $(CONFDIR)/clients.conf \
612
589
                $(DESTDIR)/etc/dbus-1/system.d/mandos.conf
617
594
                $(DESTDIR)/var/run/mandos.pid
618
595
        -rmdir $(CONFDIR)
619
596
 
620
 
.PHONY: purge-client
621
597
purge-client: uninstall-client
622
598
        -shred --remove $(KEYDIR)/seckey.txt $(KEYDIR)/tls-privkey.pem
623
599
        -rm --force $(CONFDIR)/plugin-runner.conf \