aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Makefile
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:15:18 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-03 21:15:18 +0200
commitde5cecd9bd63c0f7732fe266ee95e878d33ba61f (patch)
tree343301168ff149c65664aac64ef419c66509d9af /lib/Makefile
parent5c3b36d4dc52c83d0ff22f166175bd980b139e49 (diff)
downloadcqrlogo-de5cecd9bd63c0f7732fe266ee95e878d33ba61f.tar.gz
cqrlogo-de5cecd9bd63c0f7732fe266ee95e878d33ba61f.tar.zst
fix compiler and linker flags and produce binaries with full RELRO
Diffstat (limited to 'lib/Makefile')
-rw-r--r--lib/Makefile12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 256f60b..9cd78c5 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,20 +1,24 @@
# cqrlogo - CGI QR-Code logo for web services
+# commands
CC := gcc
LN := ln
-CFLAGS += -std=c11 -O2 -fpic -pie -Wall -Werror
+
+# flags
+CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror
CFLAGS += -liniparser
CFLAGS += $(shell pkg-config --cflags --libs libpng)
CFLAGS += $(shell pkg-config --cflags --libs zlib)
CFLAGS += $(shell pkg-config --cflags --libs libqrencode)
+LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
all: libcqrlogo.so
libcqrlogo.o: libcqrlogo.c libcqrlogo.h ../config.h ../version.h Makefile
- $(CC) -c $(CFLAGS) $(LDFLAGS) -fPIC -o libcqrlogo.o libcqrlogo.c
+ $(CC) $(CFLAGS) -c -o libcqrlogo.o libcqrlogo.c
-libcqrlogo.so: libcqrlogo.o
- $(CC) $(CFLAGS) $(LDFLAGS) -shared -fPIC -Wl,-soname,libcqrlogo.so.$(SOVERSION) -o libcqrlogo.so.$(SOVERSION) libcqrlogo.o
+libcqrlogo.so: libcqrlogo.c libcqrlogo.h ../config.h ../version.h Makefile
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,libcqrlogo.so.$(SOVERSION) -o libcqrlogo.so.$(SOVERSION) libcqrlogo.c
$(LN) -sf libcqrlogo.so.$(SOVERSION) libcqrlogo.so
clean: