aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-06-25 15:13:43 -0400
committerPaul Selkirk <paul@psgd.org>2016-06-25 15:13:51 -0400
commite3db117ae05a248773abe4b7ec2ef95ed7203b8e (patch)
treef093767315ebc72264cbc858a40c5b616bef139e
parentaa90cb43b370ee219e1e14ad774b662a53178727 (diff)
Split LIB*_DIR into _SRC and _BLD.
Also rename all instances of GNUmakefile to Makefile.
-rw-r--r--.gitignore1
-rw-r--r--Makefile41
-rw-r--r--libraries/libcli/Makefile16
-rw-r--r--libraries/libhal/GNUmakefile14
-rw-r--r--libraries/libhal/Makefile10
-rw-r--r--libraries/libhal/tests/GNUmakefile10
-rw-r--r--libraries/libhal/tests/Makefile10
-rw-r--r--libraries/libhal/utils/GNUmakefile10
-rw-r--r--libraries/libhal/utils/Makefile10
-rw-r--r--libraries/libtfm/Makefile (renamed from libraries/libtfm/GNUmakefile)2
-rw-r--r--libraries/libtfm/tomsfastmath/Makefile (renamed from libraries/libtfm/tomsfastmath/GNUmakefile)0
-rw-r--r--projects/cli-test/Makefile6
-rw-r--r--projects/hsm/Makefile8
-rw-r--r--projects/libhal-test/Makefile6
14 files changed, 63 insertions, 81 deletions
diff --git a/.gitignore b/.gitignore
index 874b3a0..25ec77d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,5 +7,4 @@
*.mo
*.o
*~
-libraries/libcli/libcli.h
libraries/libtfm/tfm.h
diff --git a/Makefile b/Makefile
index 1cbb3ac..af50d13 100644
--- a/Makefile
+++ b/Makefile
@@ -29,19 +29,25 @@
# absolute path, because we're going to be passing things to sub-makes
export TOPLEVEL = $(abspath .)
+export CRYPTECH_ROOT = $(abspath ../..)
# define board: dev-bridge or alpha
BOARD = TARGET_CRYPTECH_ALPHA
-# Location of the Libraries folder from the STM32F4 Standard Peripheral Library
export LIBS_DIR = $(TOPLEVEL)/libraries
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)/libtfm
-export LIBHAL_DIR = $(LIBS_DIR)/libhal
-export LIBCLI_DIR = $(LIBS_DIR)/libcli
+
+export LIBHAL_SRC = $(CRYPTECH_ROOT)/sw/libhal
+export LIBHAL_BLD = $(LIBS_DIR)/libhal
+
+export LIBCLI_SRC = $(CRYPTECH_ROOT)/user/ft/libcli
+export LIBCLI_BLD = $(LIBS_DIR)/libcli
+
+export LIBTFM_SRC = $(CRYPTECH_ROOT)/sw/thirdparty/libtfm
+export LIBTFM_BLD = $(LIBS_DIR)/libtfm
export LIBS = $(MBED_DIR)/libstmf4.a
@@ -104,16 +110,13 @@ export CFLAGS
all: board-test cli-test libhal-test hsm bootloader
-init:
- git submodule update --init --recursive --remote
-
$(MBED_DIR)/libstmf4.a:
$(MAKE) -C $(MBED_DIR)
board-test: $(BOARD_OBJS) $(LIBS)
$(MAKE) -C projects/board-test
-cli-test: $(BOARD_OBJS) $(LIBS) $(LIBCLI_DIR)/libcli.a
+cli-test: $(BOARD_OBJS) $(LIBS) $(LIBCLI_BLD)/libcli.a $(LIBHAL_BLD)/libhal.a $(RTOS_DIR)/librtos.a
$(MAKE) -C projects/cli-test
$(RTOS_DIR)/librtos.a:
@@ -122,19 +125,19 @@ $(RTOS_DIR)/librtos.a:
rtos-test: $(RTOS_OBJS) $(LIBS) $(RTOS_DIR)/librtos.a
$(MAKE) -C projects/rtos-test
-$(LIBTFM_DIR)/libtfm.a:
- $(MAKE) -C $(LIBTFM_DIR) PREFIX=$(PREFIX)
+$(LIBTFM_BLD)/libtfm.a:
+ $(MAKE) -C $(LIBTFM_BLD) PREFIX=$(PREFIX)
-$(LIBHAL_DIR)/libhal.a: $(LIBTFM_DIR)/libtfm.a
- $(MAKE) -C $(LIBHAL_DIR) IO_BUS=fmc RPC_MODE=server RPC_TRANSPORT=serial KS=flash libhal.a
+$(LIBHAL_BLD)/libhal.a: $(LIBTFM_BLD)/libtfm.a
+ $(MAKE) -C $(LIBHAL_BLD) IO_BUS=fmc RPC_MODE=server RPC_TRANSPORT=serial KS=flash libhal.a
-$(LIBCLI_DIR)/libcli.a:
- $(MAKE) -C $(LIBCLI_DIR)
+$(LIBCLI_BLD)/libcli.a:
+ $(MAKE) -C $(LIBCLI_BLD)
-libhal-test: $(BOARD_OBJS) $(LIBS) $(LIBHAL_DIR)/libhal.a
+libhal-test: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a
$(MAKE) -C projects/libhal-test
-hsm: $(BOARD_OBJS) $(LIBS) $(LIBHAL_DIR)/libhal.a $(RTOS_DIR)/librtos.a $(LIBCLI_DIR)/libcli.a
+hsm: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a $(RTOS_DIR)/librtos.a $(LIBCLI_BLD)/libcli.a
$(MAKE) -C projects/hsm
bootloader: $(BOARD_OBJS) $(LIBS)
@@ -156,6 +159,6 @@ clean:
distclean: clean
$(MAKE) -C $(MBED_DIR) clean
$(MAKE) -C $(RTOS_DIR) clean
- $(MAKE) -C $(LIBHAL_DIR) clean
- $(MAKE) -C $(LIBTFM_DIR) clean
- $(MAKE) -C $(LIBCLI_DIR) clean
+ $(MAKE) -C $(LIBHAL_BLD) clean
+ $(MAKE) -C $(LIBTFM_BLD) clean
+ $(MAKE) -C $(LIBCLI_BLD) clean
diff --git a/libraries/libcli/Makefile b/libraries/libcli/Makefile
index 509f493..bbd686d 100644
--- a/libraries/libcli/Makefile
+++ b/libraries/libcli/Makefile
@@ -8,19 +8,3 @@ 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
deleted file mode 100644
index 03b1636..0000000
--- a/libraries/libhal/GNUmakefile
+++ /dev/null
@@ -1,14 +0,0 @@
-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/Makefile b/libraries/libhal/Makefile
new file mode 100644
index 0000000..fbc3473
--- /dev/null
+++ b/libraries/libhal/Makefile
@@ -0,0 +1,10 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../..)
+endif
+
+REPO := ${CRYPTECH_ROOT}/sw/libhal
+
+vpath %.c ${REPO}
+vpath %.h ${REPO}
+
+include ${REPO}/Makefile
diff --git a/libraries/libhal/tests/GNUmakefile b/libraries/libhal/tests/GNUmakefile
deleted file mode 100644
index 1d7449a..0000000
--- a/libraries/libhal/tests/GNUmakefile
+++ /dev/null
@@ -1,10 +0,0 @@
-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/tests/Makefile b/libraries/libhal/tests/Makefile
new file mode 100644
index 0000000..7553427
--- /dev/null
+++ b/libraries/libhal/tests/Makefile
@@ -0,0 +1,10 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../../..)
+endif
+
+REPO := ${CRYPTECH_ROOT}/sw/libhal
+
+vpath %.c ${REPO}/tests
+vpath %.h ${REPO}/tests
+
+include ${REPO}/tests/Makefile
diff --git a/libraries/libhal/utils/GNUmakefile b/libraries/libhal/utils/GNUmakefile
deleted file mode 100644
index 9d38efd..0000000
--- a/libraries/libhal/utils/GNUmakefile
+++ /dev/null
@@ -1,10 +0,0 @@
-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/libhal/utils/Makefile b/libraries/libhal/utils/Makefile
new file mode 100644
index 0000000..43fbe0d
--- /dev/null
+++ b/libraries/libhal/utils/Makefile
@@ -0,0 +1,10 @@
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../../../..)
+endif
+
+REPO := ${CRYPTECH_ROOT}/sw/libhal
+
+vpath %.c ${REPO}/utils
+vpath %.h ${REPO}/utils
+
+include ${REPO}/utils/Makefile
diff --git a/libraries/libtfm/GNUmakefile b/libraries/libtfm/Makefile
index ca86f80..4dfcb45 100644
--- a/libraries/libtfm/GNUmakefile
+++ b/libraries/libtfm/Makefile
@@ -1,5 +1,5 @@
-# This duplicates more of sw/thirdparty/libtfm/GNUmakefile than I
+# This duplicates more of sw/thirdparty/libtfm/Makefile than I
# would like, but it does the job. Prettier makefiles can wait for another day.
ifndef CRYPTECH_ROOT
diff --git a/libraries/libtfm/tomsfastmath/GNUmakefile b/libraries/libtfm/tomsfastmath/Makefile
index 7141763..7141763 100644
--- a/libraries/libtfm/tomsfastmath/GNUmakefile
+++ b/libraries/libtfm/tomsfastmath/Makefile
diff --git a/projects/cli-test/Makefile b/projects/cli-test/Makefile
index e043566..ba80c88 100644
--- a/projects/cli-test/Makefile
+++ b/projects/cli-test/Makefile
@@ -1,6 +1,6 @@
TEST = cli-test
-OBJS = crc32.o test_sdram.o mgmt-cli.o mgmt-dfu.c mgmt-fpga.c mgmt-misc.c mgmt-show.c mgmt-test.c
+OBJS = crc32.o test_sdram.o mgmt-cli.o mgmt-dfu.c mgmt-fpga.c mgmt-misc.c mgmt-show.c mgmt-test.c mgmt-keystore.o
BOARD_OBJS = \
$(TOPLEVEL)/stm-init.o \
@@ -18,10 +18,10 @@ BOARD_OBJS = \
$(BOARD_DIR)/stm32f4xx_hal_msp.o \
$(BOARD_DIR)/stm32f4xx_it_rtos.o
-CFLAGS += -I$(LIBCLI_DIR)
+CFLAGS += -I$(LIBCLI_SRC) -I$(LIBHAL_SRC)
CFLAGS += -I$(RTOS_DIR)/rtos -I$(RTOS_DIR)/rtx/TARGET_CORTEX_M
-LIBS += $(LIBCLI_DIR)/libcli.a $(RTOS_DIR)/librtos.a
+LIBS += $(LIBCLI_BLD)/libcli.a $(LIBHAL_BLD)/libhal.a $(RTOS_DIR)/librtos.a
all: $(TEST:=.elf)
diff --git a/projects/hsm/Makefile b/projects/hsm/Makefile
index b1718b3..06cfcc2 100644
--- a/projects/hsm/Makefile
+++ b/projects/hsm/Makefile
@@ -30,13 +30,13 @@ ifndef CRYPTECH_ROOT
CRYPTECH_ROOT := $(abspath ../../../..)
endif
-CFLAGS += -I$(CRYPTECH_ROOT)/sw/libhal
-CFLAGS += -I$(LIBCLI_DIR)
+CFLAGS += -I$(LIBHAL_SRC)
+CFLAGS += -I$(LIBCLI_SRC)
CFLAGS += -I$(RTOS_DIR)/rtos -I$(RTOS_DIR)/rtx/TARGET_CORTEX_M
-LIBS += $(LIBHAL_DIR)/libhal.a $(LIBTFM_DIR)/libtfm.a
+LIBS += $(LIBHAL_BLD)/libhal.a $(LIBTFM_BLD)/libtfm.a
+LIBS += $(LIBCLI_BLD)/libcli.a
LIBS += $(RTOS_DIR)/librtos.a
-LIBS += $(LIBCLI_DIR)/libcli.a
all: $(PROJ:=.elf)
diff --git a/projects/libhal-test/Makefile b/projects/libhal-test/Makefile
index f58f480..7aa8d3e 100644
--- a/projects/libhal-test/Makefile
+++ b/projects/libhal-test/Makefile
@@ -1,12 +1,12 @@
TEST = cores test-bus test-trng test-hash test-aes-key-wrap test-pbkdf2 test-ecdsa test-rsa test-mkmif
-CFLAGS += -I $(LIBHAL_DIR)
+CFLAGS += -I $(LIBHAL_SRC)
LIBC_OBJS = printf.o gettimeofday.o
-LIBS += $(LIBHAL_DIR)/libhal.a $(LIBTFM_DIR)/libtfm.a
+LIBS += $(LIBHAL_BLD)/libhal.a $(LIBTFM_BLD)/libtfm.a
all: $(TEST:=.elf)
-vpath %.c $(LIBHAL_DIR)/tests $(LIBHAL_DIR)/utils
+vpath %.c $(LIBHAL_SRC)/tests $(LIBHAL_SRC)/utils
# .mo extension for files with main() that need to be wrapped as __main()
%.mo: %.c