[Cryptech-Commits] [sw/libhal] branch master updated: Update libhal makefiles to use new LIBxxx_SRC / LIBxxx_BLD scheme so libhal can find tfm.h again.

git at cryptech.is git at cryptech.is
Sun Jun 26 14:32:28 UTC 2016


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

sra at hactrn.net pushed a commit to branch master
in repository sw/libhal.

The following commit(s) were added to refs/heads/master by this push:
       new  64e5fe8   Update libhal makefiles to use new LIBxxx_SRC / LIBxxx_BLD scheme so libhal can find tfm.h again.
       new  709a71c   Merge branch 'master' of https://git.cryptech.is/sw/libhal.git.
64e5fe8 is described below

commit 64e5fe8edec2c4ba461e712d6fbd05d47d5a9192
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sun Jun 26 10:26:52 2016 -0400

    Update libhal makefiles to use new LIBxxx_SRC / LIBxxx_BLD scheme so libhal can find tfm.h again.
---
 Makefile       | 14 +++++++++-----
 tests/Makefile | 21 +++++++++++++++------
 utils/Makefile | 24 +++++++++++++++++-------
 3 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index 3e4964d..13b43d5 100644
--- a/Makefile
+++ b/Makefile
@@ -183,18 +183,22 @@ ifndef CRYPTECH_ROOT
   CRYPTECH_ROOT := $(abspath ../..)
 endif
 
-TFMDIR		?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
-CFLAGS		+= -g3 -Wall -std=c99 -Wno-strict-aliasing -I${TFMDIR}
-LDFLAGS		+= -g3 -L${TFMDIR} -ltfm
+LIBTFM_SRC	?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
+LIBTFM_BLD	?= ${LIBTFM_SRC}
 
+# tfm.h is a generated file, because our Makefile customizes a few
+# settings from the upstream libtfm distribution.  Because of this, we
+# need to search the libtfm build directory, not the libtfm source
+# directory.
+
+CFLAGS		+= -g3 -Wall -std=c99 -Wno-strict-aliasing
 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		+= -I${CRYPTECH_ROOT}/sw/libhal
+CFLAGS		+= -I${LIBTFM_BLD}
 
 export CFLAGS
-export LDFLAGS
 
 all: ${LIB}
 	cd tests; ${MAKE} $@
diff --git a/tests/Makefile b/tests/Makefile
index 50d0ad5..229ffcf 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -27,8 +27,19 @@
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-INC	?= ../hal.h
-LIB	?= ../libhal.a
+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_BLD	?= ${LIBHAL_SRC}
+
+LIBS		= ${LIBHAL_BLD}/libhal.a ${LIBTFM_BLD}/libtfm.a
+
+CFLAGS		?= -g3 -Wall -fPIC -std=c99 -I${LIBHAL_SRC} -I${LIBTFM_BLD}
 
 # Which tests to build depends on how the library was compiled.
 
@@ -52,8 +63,6 @@ else
 
 endif
 
-CFLAGS ?= -g3 -Wall -fPIC -std=c99 -I..
-
 all: ${BIN}
 
 test: all
@@ -62,8 +71,8 @@ test: all
 clean distclean:
 	rm -f *.o ${ALL_TESTS}
 
-${BIN}: %: %.o ${LIB}
+${BIN}: %: %.o ${LIBS}
 	${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
 
-%.o: %.c ${INC}
+%.o: %.c ${LBHAL_SRC}/*.h ${LIBTFM_BLD}/tfm.h
 	${CC} ${CFLAGS} -c -o $@ $<
diff --git a/utils/Makefile b/utils/Makefile
index 5e64449..ce36d4c 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -27,19 +27,29 @@
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-INC	= ../hal.h
-LIB	= ../libhal.a
-BIN	= eim_peek_poke cores
+ifndef CRYPTECH_ROOT
+  CRYPTECH_ROOT := $(abspath ../../..)
+endif
 
-CFLAGS	?= -g3 -Wall -fPIC -std=c99 -I..
+LIBTFM_SRC	?= ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
+LIBTFM_BLD	?= ${LIBTFM_SRC}
 
-all: $(if $(wildcard ../hal_io_eim.o),eim_peek_poke) $(if $(wildcard ../core.o),cores)
+LIBHAL_SRC	?= ${CRYPTECH_ROOT}/sw/libhal
+LIBHAL_BLD	?= ${LIBHAL_SRC}
+
+LIBS		= ${LIBHAL_BLD}/libhal.a ${LIBTFM_BLD}/libtfm.a
+
+CFLAGS		?= -g3 -Wall -fPIC -std=c99 -I${LIBHAL_SRC} -I${LIBTFM_BLD}
+
+BIN		= eim_peek_poke cores
+
+all: $(if $(wildcard ${LIBHAL_BLD}/hal_io_eim.o),eim_peek_poke) $(if $(wildcard ${LIBHAL_BLD}/core.o),cores)
 
 clean:
 	rm -f *.o ${BIN}
 
-${BIN}: %: %.o ${LIB}
+${BIN}: %: %.o ${LIBS}
 	${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
 
-%.o: %.c ${INC}
+%.o: %.c ${LIBHAL_SRC}/*.h
 	${CC} ${CFLAGS} -c -o $@ $<

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list