summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-07-10 18:24:23 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-07-10 18:24:23 +0000
commit95e4e9c963ecf42fd1eb5ad91d0867abc031fbaa (patch)
treeb5861421746e192cdaf29f14ad2b9d2198ef214f
parent3a31e61ef7834baad64300f86374bf54b87bb250 (diff)
downloadmandoc-95e4e9c963ecf42fd1eb5ad91d0867abc031fbaa.tar.gz
support LDFLAGS;
suggested by Christian Neukirchen <chneukirchen at gmail dot com>
-rw-r--r--Makefile10
-rwxr-xr-xconfigure2
-rw-r--r--configure.local.example9
3 files changed, 15 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index b42b3709..89dcc440 100644
--- a/Makefile
+++ b/Makefile
@@ -408,19 +408,19 @@ libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
ar rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
mandoc: $(MAIN_OBJS) libmandoc.a
- $(CC) -o $@ $(MAIN_OBJS) libmandoc.a $(LDADD)
+ $(CC) -o $@ $(LDFLAGS) $(MAIN_OBJS) libmandoc.a $(LDADD)
manpage: $(MANPAGE_OBJS) libmandoc.a
- $(CC) -o $@ $(MANPAGE_OBJS) libmandoc.a $(LDADD)
+ $(CC) -o $@ $(LDFLAGS) $(MANPAGE_OBJS) libmandoc.a $(LDADD)
man.cgi: $(CGI_OBJS) libmandoc.a
- $(CC) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(LDADD)
+ $(CC) $(STATIC) -o $@ $(LDFLAGS) $(CGI_OBJS) libmandoc.a $(LDADD)
demandoc: $(DEMANDOC_OBJS) libmandoc.a
- $(CC) -o $@ $(DEMANDOC_OBJS) libmandoc.a $(LDADD)
+ $(CC) -o $@ $(LDFLAGS) $(DEMANDOC_OBJS) libmandoc.a $(LDADD)
soelim: $(SOELIM_OBJS)
- $(CC) -o $@ $(SOELIM_OBJS)
+ $(CC) -o $@ $(LDFLAGS) $(SOELIM_OBJS)
# --- maintainer targets ---
diff --git a/configure b/configure
index e167056b..13fd1409 100755
--- a/configure
+++ b/configure
@@ -37,6 +37,7 @@ OSNAME=
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make -f -`
CFLAGS="-g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings"
LDADD=
+LDFLAGS=
LD_OHASH=
LD_SQLITE3=
STATIC="-static"
@@ -428,6 +429,7 @@ INSTALL_TARGETS = ${INSTALL_TARGETS}
CC = ${CC}
CFLAGS = ${CFLAGS}
LDADD = ${LDADD}
+LDFLAGS = ${LDFLAGS}
STATIC = ${STATIC}
PREFIX = ${PREFIX}
BINDIR = ${BINDIR}
diff --git a/configure.local.example b/configure.local.example
index 61913d06..ae340842 100644
--- a/configure.local.example
+++ b/configure.local.example
@@ -131,11 +131,18 @@ BINM_SOELIM=msoelim # default is "soelim"
LD_OHASH="-lutil"
-# Some platforms may need additional linker flags that are not autodetected.
+# Some platforms may need additional linker flags to link against libmandoc
+# that are not autodetected.
# For example, Solaris 9 and 10 need -lrt for nanosleep(2).
LDADD="-lrt"
+# Some systems may want to set additional linker flags for all the
+# binaries, not only for those using libmandoc, for example for
+# hardening options.
+
+LDFLAGS="-Wl,-z,relro"
+
# It is possible to change the utility program used for installation
# and the modes files are installed with. The defaults are: