summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2020-12-15 19:07:50 -0800
committerCommit Bot <commit-bot@chromium.org>2020-12-24 06:24:51 +0000
commit93b67dcad05356b132a63be4a9831932486594db (patch)
tree5fbf7b64b1944799e8d75b4a83f6f1e89c376b06
parent461f56040ea8fa2d2d3f2f7a5842601c296b5d4f (diff)
downloadchrome-ec-93b67dcad05356b132a63be4a9831932486594db.tar.gz
make: Move libcryptoc rules to third_party/rules.mk
This moves the libcryptoc hooks from common/build.mk to third_party/rules.mk. Recall that Makefile.rules actually contains all of the "rules"/recipes for making objects. It alone contains all of the build output beautification commands and control. Makefile.rules is included as the last step in the master Makefile. This brings no firmware change, as verified with compare_build.sh. BRANCH=none BUG=none TEST=./util/compare_build.sh -b fp TEST=./util/compare_build.sh -b fp -p # This fails due to the differing position of # -lcryptoc, -lfpsensor, -lfpalgorithm, and/or -lfpbep. Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I8d8493536a0e56ac6a5a1a32827b99ae97723727 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092163 Reviewed-by: Yicheng Li <yichengli@chromium.org>
-rw-r--r--Makefile.rules8
-rw-r--r--common/build.mk29
-rw-r--r--third_party/rules.mk47
3 files changed, 50 insertions, 34 deletions
diff --git a/Makefile.rules b/Makefile.rules
index f2a82a8bf1..e5cdb0f773 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -145,11 +145,6 @@ cmd_emmc_bootblock = $(out)/util/gen_emmc_transfer_data \
cmd_ipi_table = $(out)/util/gen_ipi_table $@
cmd_cp_script = cp "$<" "$@" && chmod +x "$@"
-cmd_libcryptoc_make = $(MAKE) -C $(CRYPTOCLIB) \
- obj=$(realpath $(out))/cryptoc \
- SUPPORT_UNALIGNED=1
-cmd_libcryptoc = $(cmd_libcryptoc_make) -q || $(cmd_libcryptoc_make)
-
# commands for RSA signature: rwsig does not need to sign the whole image
# (it signs the RW part separately). usbpd1 type needs to sign the final image.
ifeq ($(CONFIG_RWSIG_TYPE_RWSIG),)
@@ -876,6 +871,9 @@ build_cros_ec_commands: $(out_cros_ec_commands)
$(out_cros_ec_commands): include/ec_commands.h util/make_linux_ec_commands_h.sh
util/make_linux_ec_commands_h.sh $< $@
+# Pull in special rules/targets for third_party software
+-include third_party/rules.mk
+
.SECONDARY:
-include $(deps)
diff --git a/common/build.mk b/common/build.mk
index cb6ac4832a..9b20fc1369 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -296,35 +296,6 @@ $(out)/rma_key_from_blob.h: board/$(BOARD)/$(BLOB_FILE) util/bin2h.sh
endif
-# Build and link against libcryptoc.
-ifeq ($(CONFIG_LIBCRYPTOC),y)
-CRYPTOCLIB := $(realpath ../../third_party/cryptoc)
-ifneq ($(BOARD),host)
-CPPFLAGS += -I$(abspath ./builtin)
-endif
-CPPFLAGS += -I$(CRYPTOCLIB)/include
-CRYPTOC_LDFLAGS := -L$(out)/cryptoc -lcryptoc
-
-# Force the external build each time, so it can look for changed sources.
-.PHONY: $(out)/cryptoc/libcryptoc.a
-$(out)/cryptoc/libcryptoc.a:
- +$(call quiet,libcryptoc,MAKE )
-
-# Link RO and RW against cryptoc.
-$(out)/RO/ec.RO.elf $(out)/RO/ec.RO_B.elf: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
-$(out)/RO/ec.RO.elf $(out)/RO/ec.RO_B.elf: $(out)/cryptoc/libcryptoc.a
-$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
-$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: $(out)/cryptoc/libcryptoc.a
-# Host test executables (including fuzz tests).
-$(out)/$(PROJECT).exe: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
-$(out)/$(PROJECT).exe: $(out)/cryptoc/libcryptoc.a
-# On-device tests.
-test-targets=$(foreach test,$(test-list-y),\
- $(out)/RW/$(test).RW.elf $(out)/RO/$(test).RO.elf)
-$(test-targets): LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
-$(test-targets): $(out)/cryptoc/libcryptoc.a
-endif
-
include $(_common_dir)fpsensor/build.mk
include $(_common_dir)usbc/build.mk
diff --git a/third_party/rules.mk b/third_party/rules.mk
new file mode 100644
index 0000000000..b208a3739e
--- /dev/null
+++ b/third_party/rules.mk
@@ -0,0 +1,47 @@
+# -*- makefile -*-
+# vim: set filetype=make :
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Embedded Controller firmware build system - third_party rules/targets
+#
+
+# Build and link against libcryptoc.
+ifeq ($(CONFIG_LIBCRYPTOC),y)
+
+CRYPTOCLIB ?= $(realpath ../../third_party/cryptoc)
+
+# SUPPORT_UNALIGNED indicates to libcryptoc that provided data buffers
+# may be unaligned and please handle them safely.
+cmd_libcryptoc_make = $(MAKE) -C $(CRYPTOCLIB) \
+ obj=$(realpath $(out))/cryptoc \
+ SUPPORT_UNALIGNED=1
+cmd_libcryptoc = $(cmd_libcryptoc_make) -q || $(cmd_libcryptoc_make)
+
+ifneq ($(BOARD),host)
+CPPFLAGS += -I$(abspath ./builtin)
+endif
+CPPFLAGS += -I$(CRYPTOCLIB)/include
+CRYPTOC_LDFLAGS := -L$(out)/cryptoc -lcryptoc
+
+# Force the external build each time, so it can look for changed sources.
+.PHONY: $(out)/cryptoc/libcryptoc.a
+$(out)/cryptoc/libcryptoc.a:
+ +$(call quiet,libcryptoc,MAKE )
+
+# Link RO and RW against cryptoc.
+$(out)/RO/ec.RO.elf $(out)/RO/ec.RO_B.elf: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
+$(out)/RO/ec.RO.elf $(out)/RO/ec.RO_B.elf: $(out)/cryptoc/libcryptoc.a
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: $(out)/cryptoc/libcryptoc.a
+# Host test executables (including fuzz tests).
+$(out)/$(PROJECT).exe: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
+$(out)/$(PROJECT).exe: $(out)/cryptoc/libcryptoc.a
+# On-device tests.
+test-targets=$(foreach test,$(test-list-y),\
+ $(out)/RW/$(test).RW.elf $(out)/RO/$(test).RO.elf)
+$(test-targets): LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS)
+$(test-targets): $(out)/cryptoc/libcryptoc.a
+
+endif # CONFIG_LIBCRYPTOC