[Cryptech-Commits] [sw/stm32] 02/05: Fix frelling sw/stm32/Makefile to rebuild libraries properly.

git at cryptech.is git at cryptech.is
Fri Sep 16 19:52:54 UTC 2016

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

sra at hactrn.net pushed a commit to branch ksng
in repository sw/stm32.

commit d1462f0017726bda2e227438d2c9348a4676b907
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Fri Sep 9 15:54:02 2016 -0400

    Fix frelling sw/stm32/Makefile to rebuild libraries properly.
 Makefile | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 99c8e65..577ce53 100644
--- a/Makefile
+++ b/Makefile
@@ -110,37 +110,37 @@ export CFLAGS
 all: board-test cli-test libhal-test hsm bootloader
+$(MBED_DIR)/libstmf4.a: .FORCE
 	$(MAKE) -C $(MBED_DIR)
-board-test: $(BOARD_OBJS) $(LIBS)
+board-test: $(BOARD_OBJS) $(LIBS) .FORCE
 	$(MAKE) -C projects/board-test
-cli-test: $(BOARD_OBJS) $(LIBS) $(LIBCLI_BLD)/libcli.a $(LIBHAL_BLD)/libhal.a $(RTOS_DIR)/librtos.a
+cli-test: $(BOARD_OBJS) $(LIBS) $(LIBCLI_BLD)/libcli.a $(LIBHAL_BLD)/libhal.a $(RTOS_DIR)/librtos.a  .FORCE
 	$(MAKE) -C projects/cli-test
+$(RTOS_DIR)/librtos.a: .FORCE
 	$(MAKE) -C $(RTOS_DIR)
-rtos-test: $(RTOS_OBJS) $(LIBS) $(RTOS_DIR)/librtos.a
+rtos-test: $(RTOS_OBJS) $(LIBS) $(RTOS_DIR)/librtos.a .FORCE
 	$(MAKE) -C projects/rtos-test
+$(LIBTFM_BLD)/libtfm.a: .FORCE
-$(LIBHAL_BLD)/libhal.a: $(LIBTFM_BLD)/libtfm.a
+$(LIBHAL_BLD)/libhal.a: $(LIBTFM_BLD)/libtfm.a .FORCE
 	$(MAKE) -C $(LIBHAL_BLD) IO_BUS=fmc RPC_MODE=server RPC_TRANSPORT=serial KS=flash libhal.a
+$(LIBCLI_BLD)/libcli.a: .FORCE
-libhal-test: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a
+libhal-test: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a .FORCE
 	$(MAKE) -C projects/libhal-test
-hsm: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a $(RTOS_DIR)/librtos.a $(LIBCLI_BLD)/libcli.a
+hsm: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a $(RTOS_DIR)/librtos.a $(LIBCLI_BLD)/libcli.a .FORCE
 	$(MAKE) -C projects/hsm
-bootloader: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a
+bootloader: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a .FORCE
 	$(MAKE) -C projects/bootloader
 # don't automatically delete objects, to avoid a lot of unnecessary rebuilding
@@ -148,6 +148,15 @@ bootloader: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a
 .PHONY: board-test rtos-test libhal-test cli-test hsm bootloader
+# We don't (and shouldn't) know enough about libraries and projects to
+# know whether they need rebuilding or not, so we let their Makefiles
+# decide that.  Which means we always need to run all the sub-makes.
+# We could do this with .PHONY (which is supposedly more "efficient")
+# but using a .FORCE target is simpler once one takes inter-library
+# dependency specifications into account.
+.FORCE:				# (sic)
 	rm -f $(BOARD_OBJS)
 	$(MAKE) -C projects/board-test clean

More information about the Commits mailing list