aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile43
-rw-r--r--libhal/Makefile14
-rw-r--r--libhal/tests/Makefile12
-rw-r--r--libhal/utils/Makefile12
4 files changed, 47 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 1479112..85a7552 100644
--- a/Makefile
+++ b/Makefile
@@ -36,10 +36,17 @@ ifndef CRYPTECH_ROOT
CRYPTECH_ROOT := $(abspath ../..)
endif
-PKCS11_DIR ?= ${CRYPTECH_ROOT}/sw/pkcs11
-LIBHAL_DIR ?= ${PKCS11_DIR}/libhal
-LIBTFM_DIR ?= ${PKCS11_DIR}/libtfm
-SQLITE3_DIR ?= ${PKCS11_DIR}/sqlite3
+PKCS11_DIR ?= ${CRYPTECH_ROOT}/sw/pkcs11
+
+LIBHAL_SRC ?= ${CRYPTECH_ROOT}/sw/libhal
+LIBHAL_BLD ?= ${PKCS11_DIR}/libhal
+
+LIBTFM_SRC ?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
+LIBTFM_BLD ?= ${PKCS11_DIR}/libtfm
+
+SQLITE3_SRC ?= ${CRYPTECH_ROOT}/sw/thirdparty/sqlite3
+SQLITE3_BLD ?= ${PKCS11_DIR}/sqlite3
+
# Whether to enable threading. Main reason for being able to turn it
# off is that gdb on the Novena (sometimes) goes bananas when
@@ -70,8 +77,8 @@ UNAME := $(shell uname)
# Compilation flags, etc.
-CFLAGS := -g3 -fPIC -Wall -std=c99 -I${CRYPTECH_ROOT}/sw/libhal
-LIBS := ${LIBHAL_DIR}/libhal.a ${LIBTFM_DIR}/libtfm.a
+CFLAGS := -g3 -fPIC -Wall -std=c99 -I${LIBHAL_SRC}
+LIBS := ${LIBHAL_BLD}/libhal.a ${LIBTFM_BLD}/libtfm.a
ifeq "${UNAME}" "Darwin"
SONAME := libpkcs11.dylib
@@ -96,8 +103,8 @@ ifeq "${ENABLE_DEBUGGING}" "yes"
endif
ifeq "${ENABLE_OWN_SQLITE_LIBRARY}" "yes"
- CFLAGS += -I${SQLITE3_DIR}
- SOFLAGS += ${SQLITE3_DIR}/libsqlite3.a
+ CFLAGS += -I${SQLITE3_BLD}
+ SOFLAGS += ${SQLITE3_BLD}/libsqlite3.a
else
SOFLAGS += -lsqlite3
endif
@@ -110,10 +117,10 @@ all: ${SONAME} p11util py11/attribute_map.py
clean:
rm -rf *.o ${SONAME}* p11util schema.h attributes.h
- cd libtfm; ${MAKE} $@
- cd libhal; ${MAKE} $@
+ ${MAKE} -C libtfm $@
+ ${MAKE} -C libhal $@
ifeq "${ENABLE_OWN_SQLITE_LIBRARY}" "yes"
- cd sqlite3; ${MAKE} $@
+ ${MAKE} -C sqlite3 $@
endif
distclean: clean
@@ -121,14 +128,14 @@ distclean: clean
.FORCE:
-${LIBTFM_DIR}/libtfm.a: .FORCE
- cd libtfm; ${MAKE}
+${LIBTFM_BLD}/libtfm.a: .FORCE
+ ${MAKE} -C libtfm
-${LIBHAL_DIR}/libhal.a: .FORCE ${LIBTFM_DIR}/libtfm.a
- cd libhal; ${MAKE} daemon
+${LIBHAL_BLD}/libhal.a: .FORCE ${LIBTFM_BLD}/libtfm.a
+ ${MAKE} -C libhal daemon
-${SQLITE3_DIR}/libsqlite3.a: .FORCE
- cd sqlite3; ${MAKE}
+${SQLITE3_BLD}/libsqlite3.a: .FORCE
+ ${MAKE} -C sqlite3
schema.h: schema.sql scripts/convert-schema.sed Makefile
sed -f scripts/convert-schema.sed <schema.sql >schema.h
@@ -143,7 +150,7 @@ pkcs11.o: pkcs11.c schema.h attributes.h ${LIBS}
${CC} ${CFLAGS} -c $<
ifeq "${ENABLE_OWN_SQLITE_LIBRARY}" "yes"
- pkcs11.o: ${SQLITE3_DIR}/libsqlite3.a
+ pkcs11.o: ${SQLITE3_BLD}/libsqlite3.a
endif
ifeq "${UNAME}" "Darwin"
diff --git a/libhal/Makefile b/libhal/Makefile
index 82fc389..9274dd9 100644
--- a/libhal/Makefile
+++ b/libhal/Makefile
@@ -2,14 +2,12 @@ ifndef CRYPTECH_ROOT
CRYPTECH_ROOT := $(abspath ../../..)
endif
-TFMDIR := $(abspath ../libtfm)
+LIBHAL_SRC ?= ${CRYPTECH_ROOT}/sw/libhal
+LIBTFM_BLD ?= $(abspath ../libtfm)
-INC = ${CRYPTECH_ROOT}/sw/libhal/hal.h
-LIB = ../libhal.a
+CFLAGS += -I${LIBHAL_SRC}
-CFLAGS += -I${CRYPTECH_ROOT}/sw/libhal
+vpath %.c ${LIBHAL_SRC}
+vpath %.h ${LIBHAL_SRC}:${LIBTFM_BLD}
-vpath %.c ${CRYPTECH_ROOT}/sw/libhal
-vpath %.h ${CRYPTECH_ROOT}/sw/libhal:${LIBTFM_DIR}
-
-include ${CRYPTECH_ROOT}/sw/libhal/Makefile
+include ${LIBHAL_SRC}/Makefile
diff --git a/libhal/tests/Makefile b/libhal/tests/Makefile
index 61ad8b8..4e44362 100644
--- a/libhal/tests/Makefile
+++ b/libhal/tests/Makefile
@@ -2,9 +2,13 @@ ifndef CRYPTECH_ROOT
CRYPTECH_ROOT := $(abspath ../../../..)
endif
-TFMDIR := $(abspath ../../libtfm)
+LIBHAL_SRC ?= ${CRYPTECH_ROOT}/sw/libhal
+LIBHAL_BLD ?= $(abspath ..)
-vpath %.c ${CRYPTECH_ROOT}/sw/libhal/tests
-vpath %.h ${CRYPTECH_ROOT}/sw/libhal/tests:${LIBTFM_DIR}
+LIBTFM_SRC ?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
+LIBTFM_BLD ?= $(abspath ../../libtfm)
-include ${CRYPTECH_ROOT}/sw/libhal/tests/Makefile
+vpath %.c ${LIBHAL_SRC}/tests
+vpath %.h ${LIBHAL_SRC}/tests:${LIBTFM_BLD}
+
+include ${LIBHAL_SRC}/tests/Makefile
diff --git a/libhal/utils/Makefile b/libhal/utils/Makefile
index b15a0c5..1b8b5a2 100644
--- a/libhal/utils/Makefile
+++ b/libhal/utils/Makefile
@@ -2,9 +2,13 @@ ifndef CRYPTECH_ROOT
CRYPTECH_ROOT := $(abspath ../../../..)
endif
-TFMDIR := $(abspath ../../libtfm)
+LIBHAL_SRC ?= ${CRYPTECH_ROOT}/sw/libhal
+LIBHAL_BLD ?= $(abspath ..)
-vpath %.c ${CRYPTECH_ROOT}/sw/libhal/utils
-vpath %.h ${CRYPTECH_ROOT}/sw/libhal/utils:${LIBTFM_DIR}
+LIBTFM_SRC ?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
+LIBTFM_BLD ?= $(abspath ../../libtfm)
-include ${CRYPTECH_ROOT}/sw/libhal/utils/Makefile
+vpath %.c ${LIBHAL_SRC}/utils
+vpath %.h ${LIBHAL_SRC}/utils:${LIBTFM_BLD}
+
+include ${LIBHAL_SRC}/utils/Makefile