aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:24:30 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:24:30 +0200
commitce3eb2e3c0df503a5903a673b2c1ed1f7c11125c (patch)
treedaf57894ed1f9b64b093068e6812bfeb241c1892
parent45fc78d9e610adbe55ad5a4d0afd0f89aa669b5e (diff)
downloadmpd-notification-ce3eb2e3c0df503a5903a673b2c1ed1f7c11125c.tar.gz
mpd-notification-ce3eb2e3c0df503a5903a673b2c1ed1f7c11125c.tar.zst
fix compiler and linker flags and produce binaries with full RELRO
-rw-r--r--Makefile9
1 files 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