aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:28:20 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:28:20 +0200
commitaa50460e28b790329ed0e4530a35b85936aaf73a (patch)
tree8ff5aad8d3f7882341e4d1bf64043eaa28ff3ed2 /Makefile
parent0b6af3ed1afa424579b389296cef2072eaee53db (diff)
downloadnthash-aa50460e28b790329ed0e4530a35b85936aaf73a.tar.gz
nthash-aa50460e28b790329ed0e4530a35b85936aaf73a.tar.zst
fix compiler and linker flags and produce binaries with full RELRO
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 10 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 26bd783..d3c93db 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,30 @@
# nthash - Generate NT Hash
PREFIX := /usr
+
+# commands
CC := gcc
MD := markdown
ECHO := echo
GREP := grep
INSTALL := install
RM := rm
-CFLAGS += -std=c11 -O2 -Wall -Werror
+
+# flags
+CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror
# Debian has the libs but no pkg-config file. Fall back to hard coded
# "-lnettle" if pkg-config fails.
CFLAGS += $(shell pkg-config --cflags --libs nettle 2>/dev/null || echo "-lnettle")
+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.6
all: nthash README.html
nthash: nthash.c
- $(CC) $(CFLAGS) -o nthash $(LDFLAGS) nthash.c
+ $(CC) $(CFLAGS) $(LDFLAGS) -o nthash nthash.c
README.html: README.md
$(MD) README.md > README.html