From ce3eb2e3c0df503a5903a673b2c1ed1f7c11125c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 3 May 2016 21:24:30 +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 43fe9df..d79350a 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,22 @@ # mpd-notification - Notify about tracks played by mpd +# commands CC := gcc MD := markdown 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 libmpdclient) CFLAGS += $(shell pkg-config --cflags --libs libnotify) LIBAV_CFLAGS := $(shell pkg-config --cflags --libs libavformat libavutil 2>/dev/null) ifneq ($(LIBAV_CFLAGS),) CFLAGS += -DHAVE_LIBAV $(LIBAV_CFLAGS) endif +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.3 @@ -19,7 +24,7 @@ VERSION := 0.7.3 all: mpd-notification README.html mpd-notification: mpd-notification.c config.h version.h - $(CC) $(CFLAGS) -o mpd-notification mpd-notification.c + $(CC) $(CFLAGS) $(LDFLAGS) -o mpd-notification mpd-notification.c config.h: $(CP) config.def.h config.h -- cgit v1.2.3-54-g00ecf