From 43511ee91bbfc41dbe8e05aa3ff5d5de51adeb25 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 30 Oct 2014 16:27:33 -0400 Subject: Initial working version of cryptech_novena_i2c_{coretest,simple} HALs in simplified version of Cryptlib build wrapper environment. --- GNUmakefile | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 GNUmakefile (limited to 'GNUmakefile') diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..aed7b4a --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,83 @@ +# Cryptech project makefile for Cryptlib. This is a work in progress. + +# The one thing that must be configured here is which Hardware +# Adaption Layer ("HAL") to build into Cryptlib. Due to the need to +# support different Cryptech configurations on different boards, it's +# not really possible to provide a single HAL which supports all +# Cryptech configurations in a sane way, so you have to pick one. +# This makefile provides a default, but you can override it by +# providing a value for the CRYPTECH_HAL makefile variable on the +# command line, or by setting the CRYPTECH_HAL environment variable +# (explicit argument overrides environment variable, see GNU make +# documentation for details). + +ifndef CRYPTECH_HAL + CRYPTECH_HAL := src/cryptech_novena_i2c_simple.c +endif + +# Notes on the option settings we use when building cryptlib: +# +# - Python extension modules need to be position-independent code. We +# could handle this by building cryptlib as a shared library, but +# for the moment it's simpler to force even the static library to +# use position independent code. Works with gcc and clang, anyway, +# which are the only compilers we care about at the moment. +# +# - Point of the exercise is a hardware device, and we want the full +# set of SHA-2 digests. +# +# - See config.h for other options we might want to add here. In +# particular, USE_ECDH, USE_ECDSA, and USE_GCM all touch on subjects +# that came up during the early Cryptech design discussions. + +################################################################ + +# From here down is not intended to be user-servicable. Tinker to +# your heart's content, but don't complain if it breaks. + +LIB = build/libcl.a + +PYTHONPATH = $(firstword $(wildcard build/bindings/build/lib.*)) + +all: build/makefile.ready + cd build; ${MAKE} + @${MAKE} python-bindings + +clean: + rm -rf build + +build/makefile.ready: GNUmakefile dist/cl342.zip + rm -rf build + mkdir build + cd build; unzip -a ../dist/cl342.zip + sed build/makefile.cryptech \ + -e 's=device/hw_dummy=../$(basename ${CRYPTECH_HAL})=g' \ + -e 's=hw_dummy=$(notdir $(basename ${CRYPTECH_HAL}))=g' \ + -e '/^CFLAGS/s=$$= -fPIC -DUSE_SHA2_EXT -DUSE_HARDWARE -DUSE_DEVICES=' + mv build/makefile.cryptech build/makefile + touch $@ + +ifeq (,${PYTHONPATH}) + + python-bindings: + cd build/bindings; python setup.py build + +else + + python-bindings: ${PYTHONPATH}/cryptlib_py.so + + ${PYTHONPATH}/cryptlib_py.so: ${LIB} + cd build/bindings; python setup.py build --force + +endif + +test: all + @${MAKE} run-tests + +run-tests: + for script in tests/*.py; do echo Running $$script; PYTHONPATH=${PYTHONPATH} python $$script; done + +tags: TAGS + +TAGS: build/makefile.ready + find src build -type f -name '*.[ch]' | etags - -- cgit v1.2.3