diff options
author | Craig Hesling <hesling@chromium.org> | 2020-12-15 19:07:50 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-24 06:24:51 +0000 |
commit | 93b67dcad05356b132a63be4a9831932486594db (patch) | |
tree | 5fbf7b64b1944799e8d75b4a83f6f1e89c376b06 /third_party | |
parent | 461f56040ea8fa2d2d3f2f7a5842601c296b5d4f (diff) | |
download | chrome-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>
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/rules.mk | 47 |
1 files changed, 47 insertions, 0 deletions
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 |