[Cryptech-Commits] [sw/libhal] 02/03: Simplify makefile to make them easier to use with non-default directory names

git at cryptech.is git at cryptech.is
Sun Aug 12 19:27:36 UTC 2018


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/libhal.

commit dfc25221fb6fa12d4523caf5aeaf400057e0ab7e
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Sun Aug 12 15:21:46 2018 -0400

    Simplify makefile to make them easier to use with non-default directory names
---
 Makefile       | 11 +++++++----
 tests/Makefile | 16 ++++------------
 utils/Makefile | 15 ++++-----------
 3 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index 6934f95..64391be 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2015-2017, NORDUnet A/S
+# Copyright (c) 2015-2018, NORDUnet A/S
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -207,6 +207,8 @@ ifndef CRYPTECH_ROOT
   CRYPTECH_ROOT := $(abspath ../..)
 endif
 
+LIBHAL_SRC	?= ${CRYPTECH_ROOT}/sw/libhal
+LIBHAL_BLD	?= ${LIBHAL_SRC}
 LIBTFM_SRC	?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
 LIBTFM_BLD	?= ${LIBTFM_SRC}
 
@@ -221,7 +223,7 @@ CFLAGS		+= -DHAL_STATIC_HASH_STATE_BLOCKS=${STATIC_HASH_STATE_BLOCKS}
 CFLAGS		+= -DHAL_STATIC_HMAC_STATE_BLOCKS=${STATIC_HMAC_STATE_BLOCKS}
 CFLAGS		+= -DHAL_STATIC_PKEY_STATE_BLOCKS=${STATIC_PKEY_STATE_BLOCKS}
 CFLAGS		+= -DHAL_STATIC_KS_VOLATILE_SLOTS=${STATIC_KS_VOLATILE_SLOTS}
-CFLAGS		+= -I${CRYPTECH_ROOT}/sw/libhal
+CFLAGS		+= -I${LIBHAL_SRC}
 CFLAGS		+= -I${LIBTFM_BLD}
 
 # Enable software hash cores everywhere for now.  In theory, there might be situations
@@ -239,6 +241,7 @@ CFLAGS		+= -DHAL_ENABLE_SOFTWARE_HASH_CORES=1
 #export CFLAGS
 
 export RPC_MODE
+export LIBHAL_SRC LIBHAL_BLD LIBTFM_BLD
 
 all: ${LIB}
 	${MAKE} -C tests $@ CFLAGS='${CFLAGS}'
@@ -283,8 +286,8 @@ test: all
 
 clean:
 	rm -f *.o ${LIB}
-	${MAKE} -C tests $@ CFLAGS='${CFLAGS}'
-	${MAKE} -C utils $@ CFLAGS='${CFLAGS}'
+	${MAKE} -C tests $@
+	${MAKE} -C utils $@
 
 distclean: clean
 	rm -f TAGS
diff --git a/tests/Makefile b/tests/Makefile
index d186000..515c662 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, NORDUnet A/S
+# Copyright (c) 2015-2018, NORDUnet A/S
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -27,15 +27,9 @@
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-ifndef CRYPTECH_ROOT
-  CRYPTECH_ROOT := $(abspath ../../..)
-endif
-
-LIBTFM_SRC	?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
-LIBTFM_BLD	?= ${LIBTFM_SRC}
-
-LIBHAL_SRC	?= ${CRYPTECH_ROOT}/sw/libhal
+LIBHAL_SRC	?= ..
 LIBHAL_BLD	?= ${LIBHAL_SRC}
+LIBTFM_BLD	?= ../../thirdparty/libtfm
 
 LIBS		= ${LIBHAL_BLD}/libhal.a ${LIBTFM_BLD}/libtfm.a
 
@@ -63,8 +57,6 @@ else
 
 endif
 
-$(info Building libhal with configuration IO_BUS=${IO_BUS} RPC_MODE=${RPC_MODE} KS=${KS} RPC_TRANSPORT=${RPC_TRANSPORT} MODEXP_CORE=${MODEXP_CORE})
-
 all: ${BIN}
 
 test: all
@@ -76,7 +68,7 @@ clean distclean:
 ${BIN}: %: %.o ${LIBS}
 	${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
 
-%.o: %.c ${LBHAL_SRC}/*.h ${LIBTFM_BLD}/tfm.h
+%.o: %.c ${LIBHAL_SRC}/*.h ${LIBTFM_BLD}/tfm.h
 	${CC} ${CFLAGS} -c -o $@ $<
 
 test-rpc_hashsig.o: test-hashsig.h
diff --git a/utils/Makefile b/utils/Makefile
index ce36d4c..c9899f6 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2015-2016, NORDUnet A/S
+# Copyright (c) 2015-2018, NORDUnet A/S
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -27,19 +27,12 @@
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-ifndef CRYPTECH_ROOT
-  CRYPTECH_ROOT := $(abspath ../../..)
-endif
-
-LIBTFM_SRC	?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
-LIBTFM_BLD	?= ${LIBTFM_SRC}
-
-LIBHAL_SRC	?= ${CRYPTECH_ROOT}/sw/libhal
+LIBHAL_SRC	?= ..
 LIBHAL_BLD	?= ${LIBHAL_SRC}
 
-LIBS		= ${LIBHAL_BLD}/libhal.a ${LIBTFM_BLD}/libtfm.a
+LIBS		= ${LIBHAL_BLD}/libhal.a
 
-CFLAGS		?= -g3 -Wall -fPIC -std=c99 -I${LIBHAL_SRC} -I${LIBTFM_BLD}
+CFLAGS		?= -g3 -Wall -fPIC -std=c99 -I${LIBHAL_SRC}
 
 BIN		= eim_peek_poke cores
 



More information about the Commits mailing list