aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:43:26 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:43:26 +0200
commit546936d181527ebf4e2b5c5a9b51bec36ab2966a (patch)
tree001f56796cac8d04085a48ace0808c1cf66b2c0e /Makefile
parentac0b2f6380b0c85e4e2102edac6e5872703bdf5d (diff)
downloadudev-block-notify-546936d181527ebf4e2b5c5a9b51bec36ab2966a.tar.gz
udev-block-notify-546936d181527ebf4e2b5c5a9b51bec36ab2966a.tar.zst
fix compiler and linker flags and produce binaries with full RELRO
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 2a002ab..956defd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,18 @@
# udev-block-notify - Notify about udev block events
+# 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
CFLAGS += $(shell pkg-config --cflags --libs libudev)
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.9
@@ -15,7 +20,7 @@ VERSION := 0.7.9
all: udev-block-notify README.html
udev-block-notify: udev-block-notify.c config.h version.h
- $(CC) $(CFLAGS) -o udev-block-notify udev-block-notify.c
+ $(CC) $(CFLAGS) $(LDFLAGS) -o udev-block-notify udev-block-notify.c
config.h: config.def.h
$(CP) config.def.h config.h