aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:22:15 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:22:15 +0200
commitb4d66846dc0a74c261318f50166bc3d954dca10a (patch)
tree51c1da0f586fd269114dd8a277065dd9c60d6cdf
parentbd3c886c07ae4d1665b2341e96222d36c728fef4 (diff)
downloadjournal-notify-b4d66846dc0a74c261318f50166bc3d954dca10a.tar.gz
journal-notify-b4d66846dc0a74c261318f50166bc3d954dca10a.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 ffcd36d..f04bb82 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,18 @@
# journal-notify - Notify about journal log entries
+# 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 libsystemd)
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.1.0
@@ -15,7 +20,7 @@ VERSION := 0.1.0
all: journal-notify README.html
journal-notify: journal-notify.c journal-notify.h config.h version.h
- $(CC) $(CFLAGS) -o journal-notify journal-notify.c
+ $(CC) $(CFLAGS) $(LDFLAGS) -o journal-notify journal-notify.c
config.h:
$(CP) config.def.h config.h