/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Teddy Hogeborn
  • Date: 2019-11-21 19:30:47 UTC
  • mto: This revision was merged to the branch mainline in revision 396.
  • 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:
41
41
#COVERAGE=--coverage
42
42
OPTIMIZE:=-Os -fno-strict-aliasing
43
43
LANGUAGE:=-std=gnu11
 
44
FEATURES:=-D_FILE_OFFSET_BITS=64
44
45
htmldir:=man
45
 
version:=1.8.5
 
46
version:=1.8.9
46
47
SED:=sed
47
48
PKG_CONFIG?=pkg-config
48
49
 
88
89
                        --variable=systemdsystemunitdir)
89
90
TMPFILES:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
90
91
                        --variable=tmpfilesdir)
 
92
SYSUSERS:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
 
93
                        --variable=sysusersdir)
91
94
 
92
95
GNUTLS_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gnutls)
93
96
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
102
105
GLIB_LIBS:=$(shell $(PKG_CONFIG) --libs glib-2.0)
103
106
 
104
107
# Do not change these two
105
 
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) \
106
 
        $(OPTIMIZE) $(LANGUAGE) -DVERSION='"$(version)"'
 
108
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
 
109
        $(LANGUAGE) $(FEATURES) -DVERSION='"$(version)"'
107
110
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(strip \
108
111
        ) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
109
112
 
279
282
                $@)
280
283
 
281
284
# Need to add the GnuTLS, Avahi and GPGME libraries
282
 
plugins.d/mandos-client: plugins.d/mandos-client.c
283
 
        $(LINK.c) $^ $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(strip\
284
 
                ) $(GPGME_CFLAGS) $(GNUTLS_LIBS) $(strip\
285
 
                ) $(AVAHI_LIBS) $(GPGME_LIBS) $(LOADLIBES) $(strip\
286
 
                ) $(LDLIBS) -o $@
 
285
plugins.d/mandos-client: CFLAGS += $(GNUTLS_CFLAGS) $(strip \
 
286
        ) $(AVAHI_CFLAGS) $(GPGME_CFLAGS)
 
287
plugins.d/mandos-client: LDLIBS += $(GNUTLS_LIBS) $(strip \
 
288
        ) $(AVAHI_LIBS) $(GPGME_LIBS)
287
289
 
288
290
# Need to add the libnl-route library
289
 
plugin-helpers/mandos-client-iprouteadddel: plugin-helpers/mandos-client-iprouteadddel.c
290
 
        $(LINK.c) $(LIBNL3_CFLAGS) $^ $(LIBNL3_LIBS) $(strip\
291
 
                ) $(LOADLIBES) $(LDLIBS) -o $@
 
291
plugin-helpers/mandos-client-iprouteadddel: CFLAGS += $(LIBNL3_CFLAGS)
 
292
plugin-helpers/mandos-client-iprouteadddel: LDLIBS += $(LIBNL3_LIBS)
292
293
 
293
294
# Need to add the GLib and pthread libraries
294
 
dracut-module/password-agent: dracut-module/password-agent.c
295
 
        $(LINK.c) $(GLIB_CFLAGS) $^ $(GLIB_LIBS) -lpthread $(strip\
296
 
                ) $(LOADLIBES) $(LDLIBS) -o $@
 
295
dracut-module/password-agent: CFLAGS += $(GLIB_CFLAGS)
 
296
dracut-module/password-agent: LDLIBS += $(GLIB_LIBS) -lpthread
297
297
 
298
298
.PHONY : all doc html clean distclean mostlyclean maintainer-clean \
299
299
        check run-client run-server install install-html \
389
389
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
390
390
                        $(TMPFILES)/mandos.conf; \
391
391
        fi
 
392
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
393
                        -a -d "$(SYSUSERS)" ]; then \
 
394
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
 
395
                        $(SYSUSERS)/mandos.conf; \
 
396
        fi
392
397
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
393
398
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
394
399
                mandos-ctl
428
433
        install --directory --mode=u=rwx $(KEYDIR) \
429
434
                $(LIBDIR)/mandos/plugins.d \
430
435
                $(LIBDIR)/mandos/plugin-helpers
 
436
        if [ "$(SYSUSERS)" != "$(DESTDIR)" \
 
437
                        -a -d "$(SYSUSERS)" ]; then \
 
438
                install --mode=u=rw,go=r sysusers.d-mandos.conf \
 
439
                        $(SYSUSERS)/mandos-client.conf; \
 
440
        fi
431
441
        if [ "$(CONFDIR)" != "$(LIBDIR)/mandos" ]; then \
432
442
                install --mode=u=rwx \
433
443
                        --directory "$(CONFDIR)/plugins.d" \