From b08dc6a4023f5ee75b667d84712935b42f0381cd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 3 May 2016 21:26:05 +0200 Subject: fix compiler and linker flags and produce binaries with full RELRO --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 10f2635..37c1e85 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,18 @@ # netlink-notify - Notify about netlink changes +# commands CC := gcc MD := markdown CONVERT := convert -define png:compression-level=9 -background transparent INSTALL := install CP := cp RM := rm -CFLAGS += -std=c11 -O2 -Wall -Werror + +# flags +CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror CFLAGS += $(shell pkg-config --cflags --libs libnotify) +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.7.4 @@ -15,7 +20,7 @@ VERSION := 0.7.4 all: netlink-notify icons README.html netlink-notify: netlink-notify.c version.h config.h - $(CC) $(CFLAGS) -o netlink-notify netlink-notify.c + $(CC) $(CFLAGS) $(LDFLAGS) -o netlink-notify netlink-notify.c config.h: $(CP) config.def.h config.h -- cgit v1.2.3-70-g09d2