[Cryptech-Commits] [sw/stm32] 02/02: Finish unwinding subrepository hairball: VPATH setup.
git at cryptech.is
git at cryptech.is
Sat Jun 25 16:51:07 UTC 2016
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch de-dread
in repository sw/stm32.
commit aa90cb43b370ee219e1e14ad774b662a53178727
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sat Jun 25 00:22:11 2016 -0400
Finish unwinding subrepository hairball: VPATH setup.
---
.gitignore | 6 ++--
.gitmodules | 0
Makefile | 5 ++--
libraries/libcli/Makefile | 26 +++++++++++++++++
libraries/libhal/GNUmakefile | 14 ++++++++++
libraries/libhal/tests/GNUmakefile | 10 +++++++
libraries/libhal/utils/GNUmakefile | 10 +++++++
libraries/libtfm/GNUmakefile | 46 +++++++++++++++++++++++++++++++
libraries/libtfm/tomsfastmath/GNUmakefile | 8 ++++++
projects/hsm/Makefile | 6 +++-
10 files changed, 126 insertions(+), 5 deletions(-)
diff --git a/.gitignore b/.gitignore
index b8b0ae3..874b3a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,11 @@
*.a
-*.o
-*.mo
*.bin
*.elf
*.hex
*.lst
*.map
+*.mo
+*.o
*~
+libraries/libcli/libcli.h
+libraries/libtfm/tfm.h
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index e69de29..0000000
diff --git a/Makefile b/Makefile
index 1e2984a..1cbb3ac 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# absolute path, because we're going to be passing things to sub-makes
-export TOPLEVEL = $(shell pwd)
+export TOPLEVEL = $(abspath .)
# define board: dev-bridge or alpha
BOARD = TARGET_CRYPTECH_ALPHA
@@ -39,7 +39,7 @@ export MBED_DIR = $(LIBS_DIR)/mbed
export CMSIS_DIR = $(MBED_DIR)/targets/cmsis/TARGET_STM/TARGET_STM32F4
export BOARD_DIR = $(CMSIS_DIR)/$(BOARD)
export RTOS_DIR = $(MBED_DIR)/rtos
-export LIBTFM_DIR = $(LIBS_DIR)/thirdparty/libtfm
+export LIBTFM_DIR = $(LIBS_DIR)/libtfm
export LIBHAL_DIR = $(LIBS_DIR)/libhal
export LIBCLI_DIR = $(LIBS_DIR)/libcli
@@ -158,3 +158,4 @@ distclean: clean
$(MAKE) -C $(RTOS_DIR) clean
$(MAKE) -C $(LIBHAL_DIR) clean
$(MAKE) -C $(LIBTFM_DIR) clean
+ $(MAKE) -C $(LIBCLI_DIR) clean
diff --git a/libraries/libcli/Makefile b/libraries/libcli/Makefile
new file mode 100644
index 0000000..509f493
--- /dev/null
+++ b/libraries/libcli/Makefile
@@ -0,0 +1,26 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../..)
+endif
+
+REPO := ${CRYPTECH_ROOT}/user/ft/libcli
+
+vpath %.c ${REPO}
+vpath %.h ${REPO}
+
+include ${REPO}/Makefile
+
+# Kludge alert:
+#
+# We really should teach Makefiles that need libcli.h to look in the
+# right place, but we don't want to wire the current location of
+# libcli into too many Makefiles, since we intend to move it soon.
+#
+# So, for the moment, we just copy libcli.h. Clean this up after the
+# the repository moves (and maybe do something about the general
+# assumption that header files and libraries always live in the same
+# directory, that's wrong in a VPATH-based world).
+
+all: $(abspath .)/libcli.h
+
+$(abspath .)/libcli.h: ${REPO}/libcli.h
+ cp -p $< $@
diff --git a/libraries/libhal/GNUmakefile b/libraries/libhal/GNUmakefile
new file mode 100644
index 0000000..03b1636
--- /dev/null
+++ b/libraries/libhal/GNUmakefile
@@ -0,0 +1,14 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../..)
+endif
+
+REPO := ${CRYPTECH_ROOT}/sw/libhal
+
+TFMDIR := $(abspath ../libtfm)
+
+CFLAGS += -I${REPO}
+
+vpath %.c ${REPO}
+vpath %.h ${REPO}:${LIBTFM_DIR}
+
+include ${CRYPTECH_ROOT}/sw/libhal/GNUmakefile
diff --git a/libraries/libhal/tests/GNUmakefile b/libraries/libhal/tests/GNUmakefile
new file mode 100644
index 0000000..1d7449a
--- /dev/null
+++ b/libraries/libhal/tests/GNUmakefile
@@ -0,0 +1,10 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../../..)
+endif
+
+TFMDIR := $(abspath ../../libtfm)
+
+vpath %.c ${CRYPTECH_ROOT}/sw/libhal/tests
+vpath %.h ${CRYPTECH_ROOT}/sw/libhal/tests:${LIBTFM_DIR}
+
+include ${CRYPTECH_ROOT}/sw/libhal/tests/GNUmakefile
diff --git a/libraries/libhal/utils/GNUmakefile b/libraries/libhal/utils/GNUmakefile
new file mode 100644
index 0000000..9d38efd
--- /dev/null
+++ b/libraries/libhal/utils/GNUmakefile
@@ -0,0 +1,10 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../../..)
+endif
+
+TFMDIR := $(abspath ../../libtfm)
+
+vpath %.c ${CRYPTECH_ROOT}/sw/libhal/utils
+vpath %.h ${CRYPTECH_ROOT}/sw/libhal/utils:${LIBTFM_DIR}
+
+include ${CRYPTECH_ROOT}/sw/libhal/utils/GNUmakefile
diff --git a/libraries/libtfm/GNUmakefile b/libraries/libtfm/GNUmakefile
new file mode 100644
index 0000000..ca86f80
--- /dev/null
+++ b/libraries/libtfm/GNUmakefile
@@ -0,0 +1,46 @@
+
+# This duplicates more of sw/thirdparty/libtfm/GNUmakefile than I
+# would like, but it does the job. Prettier makefiles can wait for another day.
+
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../..)
+endif
+
+REPO := ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
+
+# vpath %.c ${REPO}
+# vpath %.h ${REPO}
+
+BITS := 8192
+
+HDR := ${REPO}/tomsfastmath/src/headers/tfm.h
+LIB := tomsfastmath/libtfm.a
+
+#CFLAGS += -DTFM_X86
+#CFLAGS += -DTFM_NO_ASM
+
+CFLAGS += -fPIC -Wall -W -Wshadow -I${REPO}/tomsfastmath/src/headers -g3 -DFP_MAX_SIZE="(${BITS}*2+(8*DIGIT_BIT))"
+
+TARGETS := $(notdir ${HDR} ${LIB})
+
+all: ${TARGETS}
+
+clean:
+ rm -rf ${TARGETS} $(notdir ${HDR}.tmp) ${LIB} tomsfastmath/src
+
+distclean: clean
+ rm -f TAGS
+
+$(notdir ${HDR}): ${HDR}
+ echo >$@.tmp '/* Configure size of largest bignum we want to handle -- see notes in tfm.pdf */'
+ echo >>$@.tmp '#define FP_MAX_SIZE (${BITS}*2+(8*DIGIT_BIT))'
+ echo >>$@.tmp ''
+ cat >>$@.tmp $^
+ mv -f $@.tmp $@
+
+$(notdir ${LIB}): ${LIB}
+ ln -f $^ $@
+
+${LIB}: ${HDR}
+ (cd ${REPO} && find tomsfastmath/src -type d) | xargs mkdir -p
+ cd tomsfastmath; ${MAKE} CFLAGS='${CFLAGS}'
diff --git a/libraries/libtfm/tomsfastmath/GNUmakefile b/libraries/libtfm/tomsfastmath/GNUmakefile
new file mode 100644
index 0000000..7141763
--- /dev/null
+++ b/libraries/libtfm/tomsfastmath/GNUmakefile
@@ -0,0 +1,8 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../../..)
+endif
+
+vpath %.c ${CRYPTECH_ROOT}/sw/thirdparty/libtfm/tomsfastmath
+vpath %.h ${CRYPTECH_ROOT}/sw/thirdparty/libtfm/tomsfastmath
+
+include ${CRYPTECH_ROOT}/sw/thirdparty/libtfm/tomsfastmath/makefile
diff --git a/projects/hsm/Makefile b/projects/hsm/Makefile
index a5bd30a..b1718b3 100644
--- a/projects/hsm/Makefile
+++ b/projects/hsm/Makefile
@@ -26,7 +26,11 @@ BOARD_OBJS = \
$(BOARD_DIR)/stm32f4xx_hal_msp.o \
$(BOARD_DIR)/stm32f4xx_it_rtos.o
-CFLAGS += -I$(LIBHAL_DIR)
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../..)
+endif
+
+CFLAGS += -I$(CRYPTECH_ROOT)/sw/libhal
CFLAGS += -I$(LIBCLI_DIR)
CFLAGS += -I$(RTOS_DIR)/rtos -I$(RTOS_DIR)/rtx/TARGET_CORTEX_M
More information about the Commits
mailing list