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