diff options
author | Rob Austein <sra@hactrn.net> | 2016-06-24 17:07:08 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-06-24 17:07:08 -0400 |
commit | dcc90e02ed381767a028638af9ead9b1e3477d34 (patch) | |
tree | a466d4a652008ced23a68d3cba4336ddd0f711d1 | |
parent | 2e95d8a357ea0cce0ef11da8520863b2d4e99936 (diff) |
Support VPATH builds.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | GNUmakefile | 17 | ||||
-rw-r--r-- | configure.ac | 65 | ||||
-rw-r--r-- | daemon.c | 5 | ||||
-rw-r--r-- | tests/GNUmakefile | 6 | ||||
-rw-r--r-- | utils/GNUmakefile | 2 |
6 files changed, 22 insertions, 76 deletions
@@ -2,9 +2,6 @@ *~ Makefile TAGS -autom4te.cache -config.log -config.status cryptech_rpcd tests/test-aes-key-wrap tests/test-bus diff --git a/GNUmakefile b/GNUmakefile index c8160a9..3e4964d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -179,7 +179,11 @@ else ifeq "${RPC_MODE}" "client-mixed" KS = volatile endif -TFMDIR := $(abspath ../thirdparty/libtfm) +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 @@ -187,9 +191,14 @@ 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 + +export CFLAGS +export LDFLAGS + all: ${LIB} - cd tests; ${MAKE} CFLAGS='${CFLAGS} -I..' LDFLAGS='${LDFLAGS}' $@ - cd utils; ${MAKE} CFLAGS='${CFLAGS} -I..' LDFLAGS='${LDFLAGS}' $@ + cd tests; ${MAKE} $@ + cd utils; ${MAKE} $@ client: ${MAKE} RPC_MODE=client-simple @@ -225,7 +234,7 @@ test: all cd tests; ${MAKE} -k $@ clean: - rm -f *.o ${LIB} + rm -f *.o ${LIB} cryptech_rpcd cd tests; ${MAKE} $@ cd utils; ${MAKE} $@ diff --git a/configure.ac b/configure.ac deleted file mode 100644 index e216cf5..0000000 --- a/configure.ac +++ /dev/null @@ -1,65 +0,0 @@ -# -*- Autoconf -*- - -# Copyright (c) 2015, NORDUnet A/S -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# - Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# - Neither the name of the NORDUnet nor the names of its contributors may -# be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Bare-minimum autoconf, with as little of the usual voodoo as -# possible. This probably ought to be replaced by a ten-line Python -# script, some day when we have time to shave that yak. -# -# We deliberately avoid constructs like AC_PROG_CC because they're -# almost certain to guess wrong about the settings we want. -# -# If you don't understand why there are so many square brackets, put -# the keyboard down and back away slowly before somebody gets hurt. - -AC_INIT([libcryptech], [0.1]) - -AC_ARG_VAR([FPGA_BUS], [Bus architecture to use (currently must be "EIM" or "I2C")]) -AC_ARG_VAR([CC], [C compiler command]) -AC_ARG_VAR([CFLAGS], [C compiler flags]) -AC_ARG_VAR([LDFLAGS], [Linker flags]) -AC_ARG_VAR([TFMDIR], [Directory containing libtfm.a and tfm.h]) - -AS_CASE($FPGA_BUS, [""],[FPGA_BUS=EIM], [EIM|I2C],[], - [AC_MSG_ERROR([Invalid setting of FPGA_BUS, must be "EIM" or "I2C"])]) - -AS_CASE($CC, [""],[CC='cc'], []) -AS_CASE($CFLAGS, [""],[CFLAGS='-g3 -Wall -fPIC -std=c99 -I${TFMDIR}'], []) -AS_CASE($LDFLAGS, [""],[LDFLAGS='-g3 -L${TFMDIR} -ltfm'], []) -AS_CASE($TFMDIR, [""],[TFMDIR='${abs_top_builddir}/../libtfm'], []) - -AC_MSG_NOTICE([FPGA bus: $FPGA_BUS]) -AC_MSG_NOTICE([C compiler: $CC]) -AC_MSG_NOTICE([C compiler flags: $CFLAGS]) -AC_MSG_NOTICE([Linker flags: $LDFLAGS]) -AC_MSG_NOTICE([libtfm directory: $TFMDIR]) - -AC_CONFIG_FILES([Makefile tests/Makefile]) -AC_OUTPUT @@ -112,10 +112,15 @@ static rpc_buffer_t ibuf, obuf; #ifndef DEVICE #define DEVICE "/dev/ttyUSB0" #endif + #ifndef SPEED #define SPEED B921600 #endif +#ifndef B921600 +#define B921600 921600 +#endif + #ifndef SOCKET_NAME #define SOCKET_NAME "/tmp/cryptechd.socket" #endif diff --git a/tests/GNUmakefile b/tests/GNUmakefile index f4299a0..50d0ad5 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -27,8 +27,8 @@ # 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 +INC ?= ../hal.h +LIB ?= ../libhal.a # Which tests to build depends on how the library was compiled. @@ -52,7 +52,7 @@ else endif -CFLAGS = -g3 -Wall -fPIC -std=c99 -I.. +CFLAGS ?= -g3 -Wall -fPIC -std=c99 -I.. all: ${BIN} diff --git a/utils/GNUmakefile b/utils/GNUmakefile index c1d838e..5e64449 100644 --- a/utils/GNUmakefile +++ b/utils/GNUmakefile @@ -31,7 +31,7 @@ INC = ../hal.h LIB = ../libhal.a BIN = eim_peek_poke cores -CFLAGS = -g3 -Wall -fPIC -std=c99 -I.. +CFLAGS ?= -g3 -Wall -fPIC -std=c99 -I.. all: $(if $(wildcard ../hal_io_eim.o),eim_peek_poke) $(if $(wildcard ../core.o),cores) |