aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-06-23 13:38:54 -0400
committerRob Austein <sra@hactrn.net>2016-06-23 13:38:54 -0400
commitea4c71c075df677cd9f559ca06c79e9202630510 (patch)
tree9d9befc8d014009dd002fd11d5989dd4168bfeba /GNUmakefile
parent6e7aabc780ff9f70bf05d41b97cc973451e0b2ee (diff)
Support use of system sqlite3 library instead of our own; various other tweaks Lintian wanted.
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile34
1 files changed, 25 insertions, 9 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 212409a..77e8748 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,7 +1,7 @@
# (GNU) Makefile for Cryptech PKCS #11 implementation.
#
# Author: Rob Austein
-# Copyright (c) 2015, NORDUnet A/S
+# Copyright (c) 2015-2016, NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,13 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Locations of libraries on which this code depends.
+# This will probably need to change if we go to VPATHs.
+
+LIBHAL_DIR = ../libhal
+LIBTFM_DIR = ../thirdparty/libtfm
+SQLITE3_DIR = ../thirdparty/sqlite3
+
# Whether to enable threading. Main reason for being able to turn it
# off is that gdb on the Novena (sometimes) goes bananas when
# threading is enabled.
@@ -53,13 +60,15 @@ ifndef ENABLE_FOOTNOTE_WARNINGS
ENABLE_FOOTNOTE_WARNINGS := yes
endif
-LIBHAL_DIR = ../libhal
-LIBTFM_DIR = ../thirdparty/libtfm
-SQLITE3_DIR = ../thirdparty/sqlite3
+# Whether to build and use our own copy of the sqlite3 library.
+
+ifndef ENABLE_OWN_SQLITE_LIBRARY
+ ENABLE_OWN_SQLITE_LIBRARY := $(if $(wildcard ${SQLITE3_DIR}),yes,no)
+endif
-CFLAGS := -g3 -fPIC -Wall -std=c99 -I${LIBHAL_DIR} -I${SQLITE3_DIR}
-SOFLAGS := -Wl,-Bsymbolic-functions -Wl,-Bsymbolic -Wl,-z,noexecstack
-LIBS := ${LIBHAL_DIR}/libhal.a ${LIBTFM_DIR}/libtfm.a ${SQLITE3_DIR}/libsqlite3.a
+CFLAGS := -g3 -fPIC -Wall -std=c99 -I${LIBHAL_DIR}
+SOFLAGS := -Wl,-Bsymbolic-functions -Wl,-Bsymbolic -Wl,-z,noexecstack -Wl,-soname,libpkcs11.so.0
+LIBS := ${LIBHAL_DIR}/libhal.a ${LIBTFM_DIR}/libtfm.a
ifeq "${ENABLE_FOOTNOTE_WARNINGS}" "no"
CFLAGS += -Wno-\#warnings -Wno-cpp
@@ -75,6 +84,13 @@ ifeq "${ENABLE_DEBUGGING}" "yes"
CFLAGS += -DDEBUG_HAL=1 -DDEBUG_PKCS11=1
endif
+ifeq "${ENABLE_OWN_SQLITE_LIBRARY}" "yes"
+ CFLAGS += -I${SQLITE3_DIR}
+ SOFLAGS += ${SQLITE3_DIR}/libsqlite3.a
+else
+ SOFLAGS += -lsqlite3
+endif
+
ifndef OBJCOPY
OBJCOPY := objcopy
endif
@@ -100,7 +116,7 @@ pkcs11.o: pkcs11.c schema.h attributes.h
${CC} ${CFLAGS} -c $<
pkcs11.so: pkcs11.o ${LIBS}
- ${CC} ${CFLAGS} -shared -o $@ ${SOFLAGS} $^
+ ${CC} ${CFLAGS} -shared -o $@ ${SOFLAGS} ${LDFLAGS} $^
libpkcs11.so: pkcs11.so
${OBJCOPY} -w -G 'C_*' $< $@
@@ -109,7 +125,7 @@ p11util.o: p11util.c schema.h
${CC} ${CFLAGS} -c $<
p11util: p11util.o ${LIBS}
- ${CC} ${CFLAGS} -o $@ $^
+ ${CC} ${CFLAGS} -o $@ ${LDFLAGS} $^
tags: TAGS