aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--lib/Makefile12
2 files changed, 15 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 1763dd0..0447956 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@
PREFIX := /usr
APACHECONF := /etc/httpd/conf/extra/
LIGHTTPDCONF := /etc/lighttpd/conf.d/
+
# commands
CC := gcc
CP := cp
@@ -16,19 +17,24 @@ RM := rm
SED := sed
PNGCHK := pngcheck
ZBARIMG := zbarimg
+
# flags
-CFLAGS += -std=c11 -O2 -fpic -pie -Wall -Werror
+CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror
CFLAGSSTATIC = $(CFLAGS)
CFLAGSSTATIC += -liniparser
CFLAGSSTATIC += $(shell pkg-config --cflags --libs libpng)
CFLAGSSTATIC += $(shell pkg-config --cflags --libs zlib)
CFLAGSSTATIC += $(shell pkg-config --cflags --libs libqrencode)
+LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
+
# calls to compiled binary files
CQRLOGO_CGI += LD_LIBRARY_PATH=lib/ ./cqrlogo.cgi
CQRLOGO_FCGI += LD_LIBRARY_PATH=lib/ ./cqrlogo.fcgi
+
# this is just a fallback in case you do not use git but downloaded
# a release tarball...
VERSION := 0.5.3
+
# library abi version
SOVERSION := 0
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: