From e6bb81e68f2298f756272183ed5a742b82cb1d22 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 3 May 2016 21:18:02 +0200 Subject: fix compiler and linker flags and produce binaries with full RELRO --- Makefile | 9 +++++++-- 1 file 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 -- cgit v1.2.3-54-g00ecf