]> git.codecow.com Git - Monocypher.git/commitdiff
makefile: Honor LDFLAGS variable if given
authorFabio Scotoni <34964387+fscoto@users.noreply.github.com>
Thu, 12 Dec 2019 08:48:36 +0000 (09:48 +0100)
committerFabio Scotoni <34964387+fscoto@users.noreply.github.com>
Thu, 12 Dec 2019 08:48:36 +0000 (09:48 +0100)
This allows specifying e.g. hardening options like -Wl,-z,relro
for link-time options.
It *is* normally possible to add these to CFLAGS,
but LDFLAGS is the established way to do this and tooling expects
it to work.
See also POSIX on make(1), whose default rules use LDFLAGS.

makefile

index bb258305bcfdf57a2a04993eeb30c13154d2b4dc..b17092e1eb1d654c0ce6e2ac1f3a6b6e34144777 100644 (file)
--- a/makefile
+++ b/makefile
@@ -100,7 +100,7 @@ lib/libmonocypher.so: lib/$(SONAME)
        ln -sf `basename $<` $@
 lib/$(SONAME): lib/monocypher.o $(LINK_ED25519)
        @mkdir -p $(@D)
-       $(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^
+       $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^
 lib/monocypher-ed25519.o: src/optional/monocypher-ed25519.c \
                           src/optional/monocypher-ed25519.h
 lib/chacha20.o  : src/deprecated/chacha20.c  src/deprecated/chacha20.h