From 32af97395ea39b81434061a4e76fc9794e4f81ad Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 3 May 2016 21:19:50 +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 a082cb9..dc87898 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,17 @@ # extract-artwork - Extract artwork from media files +# 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 libavformat libavutil) +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.0.1 @@ -14,7 +19,7 @@ VERSION := 0.0.1 all: extract-artwork README.html extract-artwork: extract-artwork.c - $(CC) $(CFLAGS) -o extract-artwork extract-artwork.c + $(CC) $(CFLAGS) $(LDFLAGS) -o extract-artwork extract-artwork.c README.html: README.md $(MD) README.md > README.html -- cgit v1.2.3-70-g09d2