[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [PATCHv2 3/6] Add GnuTLS infrastructure



Alex,

On Mon, Apr 11, 2016 at 06:15:36PM +0100, Alex Bligh wrote:
> diff --git a/Makefile.am b/Makefile.am
> index 304db6d..554860e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1,3 +1,10 @@
> +if GNUTLS
> +TLSSRC = crypto-gnutls.c crypto-gnutls.h buffer.c buffer.h
> +TLSEXTRA =
> +else
> +TLSSRC =
> +TLSEXTRA = crypto-gnutls.c crypto-gnutls.h buffer.c buffer.h
> +endif
>  SUBDIRS = . man doc tests gznbd
>  bin_PROGRAMS = nbd-server nbd-trdump
>  sbin_PROGRAMS = @NBD_CLIENT_NAME@
> @@ -5,8 +12,8 @@ EXTRA_PROGRAMS = nbd-client make-integrityhuge
>  noinst_LTLIBRARIES = libnbdsrv.la libcliserv.la
>  libcliserv_la_SOURCES = cliserv.h cliserv.c
>  libcliserv_la_CFLAGS = @CFLAGS@
> -nbd_client_SOURCES = nbd-client.c cliserv.h
> -nbd_server_SOURCES = nbd-server.c cliserv.h lfs.h nbd.h nbdsrv.h backend.h
> +nbd_client_SOURCES = nbd-client.c cliserv.h $(TLSSRC)
> +nbd_server_SOURCES = nbd-server.c cliserv.h lfs.h nbd.h nbdsrv.h backend.h $(TLSSRC)
>  nbd_trdump_SOURCES = nbd-trdump.c cliserv.h nbd.h
>  nbd_server_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@
>  nbd_trdump_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@
> @@ -16,4 +23,4 @@ nbd_client_LDADD = libcliserv.la
>  nbd_server_LDADD = @GLIB_LIBS@ libnbdsrv.la libcliserv.la
>  nbd_trdump_LDADD = libcliserv.la
>  make_integrityhuge_SOURCES = make-integrityhuge.c cliserv.h nbd.h nbd-debug.h
> -EXTRA_DIST = maketr CodingStyle autogen.sh README.md
> +EXTRA_DIST = maketr CodingStyle autogen.sh README.md $(TLSEXTRA)

This can be done more easily like so:


nbd_client_SOURCES = nbd-client.c cliserv.h
nbd_server_SOURCES = nbd-server.c cliserv.h lfs.h nbd.h nbdsrv.h backend.h
TLSSRC = crypto-gnutls.c crypto-gnutls.h
if GNUTLS
nbd_client_SOURCES += $(TLSSRC)
nbd_server_SOURCES += $(TLSSRC)
endif

Automake is smart enough about conditionals to realize that they might
add some extra files which need to be distributed, and so fiddling with
EXTRA_DIST isn't required (as per
https://www.gnu.org/software/automake/manual/html_node/Conditional-Sources.html#Conditional-Compilation-using-Automake-Conditionals)

[...]
-- 
< ron> I mean, the main *practical* problem with C++, is there's like a dozen
       people in the world who think they really understand all of its rules,
       and pretty much all of them are just lying to themselves too.
 -- #debian-devel, OFTC, 2016-02-12



Reply to: