aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-09-22 13:14:30 -0400
committerRob Austein <sra@hactrn.net>2015-09-22 13:14:30 -0400
commita927c24d7cc3bed9fe64907afacee39c7756872c (patch)
treeeee34a639266671cb8cff30090041bcc5b768f62 /GNUmakefile
parentd52b9d3acb8e613b388bccd3192d30fff3957718 (diff)
Makefile cleanup.
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile36
1 files changed, 24 insertions, 12 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 77daebd..477d26d 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -29,17 +29,25 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Whether to enable threading. Main reason for being able to turn it
-# off is that gdb on the Novena goes bananas when threading is enabled.
+# off is that gdb on the Novena (sometimes) goes bananas when
+# threading is enabled.
ifndef ENABLE_THREADS
ENABLE_THREADS := yes
endif
+# Whether to enable debugging code that prints diagnostic information
+# to stderr on various conditions (mostly failures).
+
+ifndef ENABLE_DEBUGGING
+ ENABLE_DEBUGGING := no
+endif
+
LIBHAL_DIR = ../libhal
LIBTFM_DIR = ../thirdparty/libtfm
SQLITE3_DIR = ../thirdparty/sqlite3
-CFLAGS := -g3 -fPIC -Wall -std=c99 -I${LIBHAL_DIR} -I${SQLITE3_DIR} -DDEBUG_PKCS11=0
+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
@@ -49,6 +57,10 @@ else
CFLAGS += -DUSE_PTHREADS=0
endif
+ifeq "${ENABLE_DEBUGGING}" "yes"
+ CFLAGS += -DDEBUG_HAL=1 -DDEBUG_PKCS11=1
+endif
+
ifndef OBJCOPY
OBJCOPY := objcopy
endif
@@ -90,26 +102,26 @@ tags: TAGS
TAGS: *.[ch]
etags $^
+# Basic testing, via the Python unittest library and our py11 interface code
+
test: all
sudo python unit_tests.py
-# Kudge for testing, gussy this up if we decide to keep it
+# Further testing using hsmbully, if we can find a copy of it.
HSMBULLY := $(firstword $(wildcard $(addsuffix /hsmbully,$(subst :, ,.:${PATH}))))
ifneq "${HSMBULLY}" ""
-HSMBULLY_OPTIONS := \
+ HSMBULLY_OPTIONS := \
--pin fnord --so-pin fnord --pkcs11lib $(abspath libpkcs11.so) \
--verbose=9 --fast-and-frivolous --skip-fragmentation --skip-keysizing
-export PKCS11_DATABASE=$(abspath .pkcs11.db)
-
-SQLITE3_CMD := $(abspath ../sqlite3/build/sqlite3)
-
-bully: all
- rm -f ${PKCS11_DATABASE} ${PKCS11_DATABASE}-journal
- (echo fnord; echo fnord) | sudo -E ./p11util --set-so-pin --set-user-pin --pin-from-stdin
- sudo -E ${HSMBULLY} ${HSMBULLY_OPTIONS}
+ bully: all
+ export PKCS11_DATABASE=$(abspath hsmbully.pkcs11.db); \
+ sudo -E rm -f ${PKCS11_DATABASE} ${PKCS11_DATABASE}-journal; \
+ (echo fnord; echo fnord) | sudo -E ./p11util --set-so-pin --set-user-pin --pin-from-stdin; \
+ sudo -E ${HSMBULLY} ${HSMBULLY_OPTIONS}; \
+ sudo -E rm -f ${PKCS11_DATABASE} ${PKCS11_DATABASE}-journal
endif