summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:18:02 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:18:02 +0200
commite6bb81e68f2298f756272183ed5a742b82cb1d22 (patch)
tree619ec67e68919f62a03dd621f08f855385df6ae2 /Makefile
parent05216ad9063114e0917370c0fde90ffb722e4082 (diff)
downloaddyndhcpd-e6bb81e68f2298f756272183ed5a742b82cb1d22.tar.gz
dyndhcpd-e6bb81e68f2298f756272183ed5a742b82cb1d22.tar.zst
fix compiler and linker flags and produce binaries with full RELRO
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index bbac60c..318c368 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,16 @@
# dyndhcpd - Dynamically start DHCP Daemon
+# commands
CC := gcc
MD := markdown
INSTALL := install
RM := rm
CP := cp
-CFLAGS += -std=c11 -O2 -Wall -Werror
+
+# flags
+CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror
+LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
+
# this is just a fallback in case you do not use git but downloaded
# a release tarball...
VERSION := 0.1.3
@@ -21,7 +26,7 @@ version.h: $(wildcard .git/HEAD .git/index .git/refs/tags/*) Makefile
echo "#endif" >> $@
dyndhcpd: dyndhcpd.c dyndhcpd.h config.h version.h
- $(CC) $(CFLAGS) -o dyndhcpd dyndhcpd.c
+ $(CC) $(CFLAGS) $(LDFLAGS) -o dyndhcpd dyndhcpd.c
README.html: README.md
$(MD) README.md > README.html