Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 1 | # Copyright 2013 The Chromium OS Authors. All rights reserved. |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Simon Glass | 6d696e5 | 2011-11-14 13:46:33 -0800 | [diff] [blame] | 5 | # This Makefile normally builds in a 'build' subdir, but use |
| 6 | # |
| 7 | # make BUILD=<dir> |
| 8 | # |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 9 | # to put the output somewhere else. |
| 10 | |
| 11 | ############################################################################## |
| 12 | # Make variables come in two flavors, immediate or deferred. |
| 13 | # |
| 14 | # Variable definitions are parsed like this: |
| 15 | # |
| 16 | # IMMEDIATE = DEFERRED |
| 17 | # or |
| 18 | # IMMEDIATE := IMMEDIATE |
| 19 | # |
| 20 | # Rules are parsed this way: |
| 21 | # |
| 22 | # IMMEDIATE : IMMEDIATE |
| 23 | # DEFERRED |
| 24 | # |
| 25 | # So you can assign variables in any order if they're only to be used in |
| 26 | # actions, but if you use a variable in either the target or prerequisite of a |
| 27 | # rule, the rule will be constructed using only the top-down, immediate value. |
| 28 | # |
| 29 | # So we'll try to define all the variables first. Then the rules. |
| 30 | # |
| 31 | |
| 32 | ############################################################################## |
| 33 | # Configuration variables come first. |
| 34 | # |
| 35 | # Our convention is that we only use := for variables that will never be |
| 36 | # changed or appended. They must be defined before being used anywhere. |
| 37 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 38 | # We should only run pwd once, not every time we refer to ${BUILD}. |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 39 | SRCDIR := $(shell pwd) |
Bill Richardson | 64ddad7 | 2014-08-29 23:49:23 -0700 | [diff] [blame] | 40 | export SRCDIR |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 41 | BUILD = $(SRCDIR)/build |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 42 | export BUILD |
Simon Glass | 6d696e5 | 2011-11-14 13:46:33 -0800 | [diff] [blame] | 43 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 44 | # Stuff for 'make install' |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 45 | INSTALL = install |
| 46 | DESTDIR = /usr/local/bin |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 47 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 48 | # Where exactly do the pieces go? |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 49 | # UB_DIR = utility binary directory |
| 50 | # VB_DIR = vboot binary directory for dev-mode-only scripts |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 51 | ifeq (${MINIMAL},) |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 52 | # Host install just puts everything where it's told |
| 53 | UB_DIR=${DESTDIR} |
| 54 | VB_DIR=${DESTDIR} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 55 | else |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 56 | # Target install puts things into subdirectories under DESTDIR |
| 57 | UB_DIR=${DESTDIR}/usr/bin |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 58 | VB_DIR=${DESTDIR}/usr/share/vboot/bin |
| 59 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 60 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 61 | # Where to install the (exportable) executables for testing? |
| 62 | TEST_INSTALL_DIR = ${BUILD}/install_for_test |
| 63 | |
| 64 | # Verbose? Use V=1 |
| 65 | ifeq (${V},) |
| 66 | Q := @ |
| 67 | endif |
| 68 | |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 69 | # Quiet? Use QUIET=1 |
| 70 | ifeq ($(QUIET),) |
| 71 | PRINTF := printf |
| 72 | else |
| 73 | PRINTF := : |
| 74 | endif |
| 75 | |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 76 | # Architecture detection |
| 77 | _machname := $(shell uname -m) |
| 78 | HOST_ARCH ?= ${_machname} |
| 79 | |
| 80 | # ARCH and/or FIRMWARE_ARCH are defined by the Chromium OS ebuild. |
| 81 | # Pick a sane target architecture if none is defined. |
| 82 | ifeq (${ARCH},) |
| 83 | ARCH := ${HOST_ARCH} |
| 84 | else ifeq (${ARCH},i386) |
| 85 | override ARCH := x86 |
| 86 | else ifeq (${ARCH},amd64) |
| 87 | override ARCH := x86_64 |
| 88 | endif |
| 89 | |
| 90 | # FIRMWARE_ARCH is only defined by the Chromium OS ebuild if compiling |
| 91 | # for a firmware target (such as u-boot or depthcharge). It must map |
| 92 | # to the same consistent set of architectures as the host. |
| 93 | ifeq (${FIRMWARE_ARCH},i386) |
| 94 | override FIRMWARE_ARCH := x86 |
| 95 | else ifeq (${FIRMWARE_ARCH},amd64) |
| 96 | override FIRMWARE_ARCH := x86_64 |
Stefan Reinauer | d96b25d | 2013-09-19 14:24:29 -0700 | [diff] [blame] | 97 | else ifeq (${FIRMWARE_ARCH},armv7) |
| 98 | override FIRMWARE_ARCH := arm |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 99 | endif |
| 100 | |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 101 | # Provide default CC and CFLAGS for firmware builds; if you have any -D flags, |
| 102 | # please add them after this point (e.g., -DVBOOT_DEBUG). |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 103 | # |
Che-Liang Chiou | 6b0003c | 2011-10-14 11:11:28 +0800 | [diff] [blame] | 104 | # TODO(crosbug.com/16808) We hard-code u-boot's compiler flags here just |
| 105 | # temporarily. As we are still investigating which flags are necessary for |
| 106 | # maintaining a compatible ABI, etc. between u-boot and vboot_reference. |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 107 | # |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 108 | # As a first step, this makes the setting of CC and CFLAGS here optional, to |
| 109 | # permit a calling script or Makefile to set these. |
Che-Liang Chiou | 74359b7 | 2011-06-21 15:25:51 -0700 | [diff] [blame] | 110 | # |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 111 | # Flag ordering: arch, then -f, then -m, then -W |
| 112 | DEBUG_FLAGS := $(if ${DEBUG},-g -O0,-Os) |
| 113 | COMMON_FLAGS := -nostdinc -pipe \ |
| 114 | -ffreestanding -fno-builtin -fno-stack-protector \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 115 | -Werror -Wall -Wstrict-prototypes ${DEBUG_FLAGS} |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 116 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 117 | # Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild. |
| 118 | ifeq (${FIRMWARE_ARCH}, arm) |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 119 | CC ?= armv7a-cros-linux-gnueabi-gcc |
| 120 | CFLAGS ?= -march=armv5 \ |
| 121 | -fno-common -ffixed-r8 \ |
Doug Anderson | d50b27d | 2012-05-11 12:08:02 -0700 | [diff] [blame] | 122 | -mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 123 | ${COMMON_FLAGS} |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 124 | else ifeq (${FIRMWARE_ARCH}, x86) |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 125 | CC ?= i686-pc-linux-gnu-gcc |
| 126 | # Drop -march=i386 to permit use of SSE instructions |
| 127 | CFLAGS ?= \ |
| 128 | -ffunction-sections -fvisibility=hidden -fno-strict-aliasing \ |
| 129 | -fomit-frame-pointer -fno-toplevel-reorder -fno-dwarf2-cfi-asm \ |
Gabe Black | 46e00e6 | 2013-12-18 18:23:24 -0800 | [diff] [blame] | 130 | -mpreferred-stack-boundary=2 \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 131 | ${COMMON_FLAGS} |
| 132 | else ifeq (${FIRMWARE_ARCH}, x86_64) |
| 133 | CFLAGS ?= ${COMMON_FLAGS} \ |
Simon Glass | 8e85e98 | 2011-11-22 13:54:50 -0800 | [diff] [blame] | 134 | -fvisibility=hidden -fno-strict-aliasing -fomit-frame-pointer |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 135 | else |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 136 | # FIRMWARE_ARCH not defined; assuming local compile. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 137 | CC ?= gcc |
Bill Richardson | d462101 | 2014-07-09 23:31:13 -0700 | [diff] [blame] | 138 | CFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror ${DEBUG_FLAGS} |
Che-Liang Chiou | 34be827 | 2011-01-27 16:44:36 +0800 | [diff] [blame] | 139 | endif |
| 140 | |
| 141 | ifneq (${DEBUG},) |
| 142 | CFLAGS += -DVBOOT_DEBUG |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 143 | endif |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 144 | |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 145 | ifeq (${DISABLE_NDEBUG},) |
| 146 | CFLAGS += -DNDEBUG |
| 147 | endif |
| 148 | |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 149 | ifneq (${FORCE_LOGGING_ON},) |
| 150 | CFLAGS += -DFORCE_LOGGING_ON=${FORCE_LOGGING_ON} |
| 151 | endif |
| 152 | |
Randall Spangler | 6014c04 | 2014-07-22 14:42:58 -0700 | [diff] [blame] | 153 | ifneq (${PD_SYNC},) |
| 154 | CFLAGS += -DPD_SYNC |
| 155 | endif |
| 156 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 157 | # Create / use dependency files |
| 158 | CFLAGS += -MMD -MF $@.d |
Simon Glass | b265c34 | 2011-11-16 15:09:51 -0800 | [diff] [blame] | 159 | |
Bertrand SIMONNET | f8f807a | 2014-06-30 09:41:13 -0700 | [diff] [blame] | 160 | ifeq (${FIRMWARE_ARCH},) |
| 161 | # Creates position independent code for non firmware target. |
| 162 | CFLAGS += -fPIE |
| 163 | endif |
| 164 | |
Bill Richardson | 0c3ba24 | 2013-03-29 11:09:30 -0700 | [diff] [blame] | 165 | # These are required to access large disks and files on 32-bit systems. |
| 166 | CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 |
| 167 | |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 168 | # Code coverage |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 169 | ifneq (${COV},) |
Bill Richardson | d2d08b2 | 2014-07-08 16:31:40 -0700 | [diff] [blame] | 170 | COV_FLAGS = -O0 --coverage -DCOVERAGE |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 171 | CFLAGS += ${COV_FLAGS} |
| 172 | LDFLAGS += ${COV_FLAGS} |
| 173 | COV_INFO = ${BUILD}/coverage.info |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 174 | endif |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 175 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 176 | # And a few more default utilities |
| 177 | LD = ${CC} |
| 178 | CXX ?= g++ # HEY: really? |
| 179 | PKG_CONFIG ?= pkg-config |
| 180 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 181 | # Determine QEMU architecture needed, if any |
| 182 | ifeq (${ARCH},${HOST_ARCH}) |
| 183 | # Same architecture; no need for QEMU |
| 184 | QEMU_ARCH := |
Randall Spangler | 61a2eb3 | 2013-01-23 10:20:16 -0800 | [diff] [blame] | 185 | else ifeq (${HOST_ARCH}-${ARCH},x86_64-x86) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 186 | # 64-bit host can run 32-bit targets directly |
| 187 | QEMU_ARCH := |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 188 | else |
| 189 | QEMU_ARCH := ${ARCH} |
| 190 | endif |
| 191 | |
| 192 | # The top of the chroot for qemu must be passed in via the SYSROOT environment |
| 193 | # variable. In the Chromium OS chroot, this is done automatically by the |
| 194 | # ebuild. |
| 195 | |
| 196 | ifeq (${QEMU_ARCH},) |
| 197 | # Path to build output for running tests is same as for building |
| 198 | BUILD_RUN = ${BUILD} |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 199 | SRC_RUN = ${SRCDIR} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 200 | else |
| 201 | $(info Using qemu for testing.) |
| 202 | # Path to build output for running tests is different in the chroot |
| 203 | BUILD_RUN = $(subst ${SYSROOT},,${BUILD}) |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 204 | SRC_RUN = $(subst ${SYSROOT},,${SRCDIR}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 205 | |
| 206 | QEMU_BIN = qemu-${QEMU_ARCH} |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 207 | QEMU_RUN = ${BUILD_RUN}/${QEMU_BIN} |
| 208 | export QEMU_RUN |
| 209 | |
| 210 | RUNTEST = tests/test_using_qemu.sh |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 211 | endif |
| 212 | |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 213 | export BUILD_RUN |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 214 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 215 | ############################################################################## |
| 216 | # Now we need to describe everything we might want or need to build |
| 217 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 218 | # Everything wants these headers. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 219 | INCLUDES += \ |
| 220 | -Ifirmware/include \ |
| 221 | -Ifirmware/lib/include \ |
| 222 | -Ifirmware/lib/cgptlib/include \ |
| 223 | -Ifirmware/lib/cryptolib/include \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 224 | -Ifirmware/lib/tpm_lite/include \ |
| 225 | -Ifirmware/2lib/include |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 226 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 227 | # If we're not building for a specific target, just stub out things like the |
| 228 | # TPM commands and various external functions that are provided by the BIOS. |
| 229 | ifeq (${FIRMWARE_ARCH},) |
Bill Richardson | 0e6ae29 | 2014-08-26 10:34:40 -0700 | [diff] [blame] | 230 | INCLUDES += -Ihost/include -Ihost/lib/include |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 231 | endif |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 232 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 233 | # Firmware library, used by the other firmware components (depthcharge, |
| 234 | # coreboot, etc.). It doesn't need exporting to some other place; they'll build |
| 235 | # this source tree locally and link to it directly. |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 236 | FWLIB = ${BUILD}/vboot_fw.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 237 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 238 | # Smaller firmware library. TODO: Do we still need to export this? |
| 239 | ifneq (${VBOOT2},) |
| 240 | FWLIB2 = ${BUILD}/vboot_fw2.a |
| 241 | endif |
| 242 | |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 243 | # Firmware library sources needed by VbInit() call |
| 244 | VBINIT_SRCS = \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 245 | firmware/lib/crc8.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 246 | firmware/lib/utility.c \ |
| 247 | firmware/lib/vboot_api_init.c \ |
| 248 | firmware/lib/vboot_common_init.c \ |
| 249 | firmware/lib/vboot_nvstorage.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 250 | firmware/lib/vboot_nvstorage_rollback.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 251 | firmware/lib/region-init.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 252 | |
| 253 | # Additional firmware library sources needed by VbSelectFirmware() call |
| 254 | VBSF_SRCS = \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 255 | firmware/lib/cryptolib/padding.c \ |
| 256 | firmware/lib/cryptolib/rsa.c \ |
| 257 | firmware/lib/cryptolib/rsa_utility.c \ |
| 258 | firmware/lib/cryptolib/sha1.c \ |
| 259 | firmware/lib/cryptolib/sha256.c \ |
| 260 | firmware/lib/cryptolib/sha512.c \ |
| 261 | firmware/lib/cryptolib/sha_utility.c \ |
| 262 | firmware/lib/stateful_util.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 263 | firmware/lib/vboot_api_firmware.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 264 | firmware/lib/vboot_common.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 265 | firmware/lib/vboot_firmware.c \ |
| 266 | firmware/lib/region-fw.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 267 | |
| 268 | # Additional firmware library sources needed by VbSelectAndLoadKernel() call |
| 269 | VBSLK_SRCS = \ |
| 270 | firmware/lib/cgptlib/cgptlib.c \ |
| 271 | firmware/lib/cgptlib/cgptlib_internal.c \ |
| 272 | firmware/lib/cgptlib/crc32.c \ |
Albert Chaulk | 5c9e453 | 2013-03-20 16:03:49 -0700 | [diff] [blame] | 273 | firmware/lib/cgptlib/mtdlib.c \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 274 | firmware/lib/utility_string.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 275 | firmware/lib/vboot_api_kernel.c \ |
| 276 | firmware/lib/vboot_audio.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 277 | firmware/lib/vboot_display.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 278 | firmware/lib/vboot_kernel.c \ |
| 279 | firmware/lib/region-kernel.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 280 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 281 | # Firmware library source needed for smaller library 2 |
| 282 | FWLIB2_SRCS = \ |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 283 | firmware/2lib/2api.c \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 284 | firmware/2lib/2common.c \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 285 | firmware/2lib/2crc8.c \ |
| 286 | firmware/2lib/2misc.c \ |
| 287 | firmware/2lib/2nvstorage.c \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 288 | firmware/2lib/2rsa.c \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 289 | firmware/2lib/2secdata.c \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 290 | firmware/2lib/2sha1.c \ |
| 291 | firmware/2lib/2sha256.c \ |
| 292 | firmware/2lib/2sha512.c \ |
| 293 | firmware/2lib/2sha_utility.c \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 294 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 295 | # Support real TPM unless BIOS sets MOCK_TPM |
| 296 | ifeq (${MOCK_TPM},) |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 297 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 298 | firmware/lib/rollback_index.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 299 | firmware/lib/tpm_lite/tlcl.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 300 | |
| 301 | VBSF_SRCS += \ |
| 302 | firmware/lib/tpm_bootmode.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 303 | else |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 304 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 305 | firmware/lib/mocked_rollback_index.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 306 | firmware/lib/tpm_lite/mocked_tlcl.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 307 | |
| 308 | VBSF_SRCS += \ |
| 309 | firmware/lib/mocked_tpm_bootmode.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 310 | endif |
| 311 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 312 | ifeq (${FIRMWARE_ARCH},) |
| 313 | # Include BIOS stubs in the firmware library when compiling for host |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 314 | # TODO: split out other stub funcs too |
| 315 | VBINIT_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 316 | firmware/stub/tpm_lite_stub.c \ |
| 317 | firmware/stub/utility_stub.c \ |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 318 | firmware/stub/vboot_api_stub_init.c \ |
| 319 | firmware/stub/vboot_api_stub_region.c |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 320 | |
| 321 | VBSF_SRCS += \ |
| 322 | firmware/stub/vboot_api_stub_sf.c |
| 323 | |
| 324 | VBSLK_SRCS += \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 325 | firmware/stub/vboot_api_stub.c \ |
| 326 | firmware/stub/vboot_api_stub_disk.c |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 327 | |
| 328 | FWLIB2_SRCS += \ |
| 329 | firmware/2lib/2stub.c |
| 330 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 331 | endif |
| 332 | |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 333 | VBSF_SRCS += ${VBINIT_SRCS} |
| 334 | FWLIB_SRCS += ${VBSF_SRCS} ${VBSLK_SRCS} |
| 335 | |
| 336 | VBINIT_OBJS = ${VBINIT_SRCS:%.c=${BUILD}/%.o} |
| 337 | VBSF_OBJS = ${VBSF_SRCS:%.c=${BUILD}/%.o} |
| 338 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 339 | FWLIB_OBJS = ${FWLIB_SRCS:%.c=${BUILD}/%.o} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 340 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 341 | ifneq (${VBOOT2},) |
| 342 | FWLIB2_OBJS = ${FWLIB2_SRCS:%.c=${BUILD}/%.o} |
| 343 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 344 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 345 | ALL_OBJS += ${FWLIB_OBJS} ${FWLIB2_OBJS} ${VBINIT_OBJS} ${VBSF_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 346 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 347 | # Intermediate library for the vboot_reference utilities to link against. |
| 348 | UTILLIB = ${BUILD}/libvboot_util.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 349 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 350 | UTILLIB_SRCS = \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 351 | cgpt/cgpt_create.c \ |
| 352 | cgpt/cgpt_add.c \ |
| 353 | cgpt/cgpt_boot.c \ |
| 354 | cgpt/cgpt_show.c \ |
| 355 | cgpt/cgpt_repair.c \ |
| 356 | cgpt/cgpt_prioritize.c \ |
| 357 | cgpt/cgpt_common.c \ |
Bill Richardson | 18e0370 | 2014-06-23 17:48:33 -0700 | [diff] [blame] | 358 | cgpt/flash_ts.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 359 | cgpt/flash_ts_drv.c \ |
Albert Chaulk | b334e65 | 2013-03-28 15:25:33 -0700 | [diff] [blame] | 360 | firmware/lib/cgptlib/mtdlib.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 361 | futility/dump_kernel_config_lib.c \ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 362 | host/arch/${ARCH}/lib/crossystem_arch.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 363 | host/lib/crossystem.c \ |
| 364 | host/lib/file_keys.c \ |
| 365 | host/lib/fmap.c \ |
| 366 | host/lib/host_common.c \ |
| 367 | host/lib/host_key.c \ |
| 368 | host/lib/host_keyblock.c \ |
| 369 | host/lib/host_misc.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 370 | host/lib/util_misc.c \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 371 | host/lib/host_signature.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 372 | host/lib/signature_digest.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 373 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 374 | UTILLIB_OBJS = ${UTILLIB_SRCS:%.c=${BUILD}/%.o} |
| 375 | ALL_OBJS += ${UTILLIB_OBJS} |
| 376 | |
| 377 | # Externally exported library for some target userspace apps to link with |
| 378 | # (cryptohome, updater, etc.) |
| 379 | HOSTLIB = ${BUILD}/libvboot_host.a |
| 380 | |
| 381 | HOSTLIB_SRCS = \ |
| 382 | cgpt/cgpt_add.c \ |
| 383 | cgpt/cgpt_boot.c \ |
| 384 | cgpt/cgpt_common.c \ |
| 385 | cgpt/cgpt_create.c \ |
| 386 | cgpt/cgpt_prioritize.c \ |
Bill Richardson | 18e0370 | 2014-06-23 17:48:33 -0700 | [diff] [blame] | 387 | cgpt/flash_ts.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 388 | cgpt/flash_ts_drv.c \ |
| 389 | firmware/lib/cgptlib/cgptlib_internal.c \ |
| 390 | firmware/lib/cgptlib/crc32.c \ |
| 391 | firmware/lib/cgptlib/mtdlib.c \ |
| 392 | firmware/lib/crc8.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 393 | firmware/lib/tpm_lite/tlcl.c \ |
| 394 | firmware/lib/utility_string.c \ |
| 395 | firmware/lib/vboot_nvstorage.c \ |
| 396 | firmware/stub/tpm_lite_stub.c \ |
| 397 | firmware/stub/utility_stub.c \ |
| 398 | firmware/stub/vboot_api_stub_init.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 399 | futility/dump_kernel_config_lib.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 400 | host/arch/${ARCH}/lib/crossystem_arch.c \ |
| 401 | host/lib/crossystem.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 402 | host/lib/host_misc.c |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 403 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 404 | HOSTLIB_OBJS = ${HOSTLIB_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 405 | ALL_OBJS += ${HOSTLIB_OBJS} |
| 406 | |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 407 | # Sigh. For historical reasons, the autoupdate installer must sometimes be a |
| 408 | # 32-bit executable, even when everything else is 64-bit. But it only needs a |
| 409 | # few functions, so let's just build those. |
| 410 | TINYHOSTLIB = ${BUILD}/libtinyvboot_host.a |
| 411 | |
| 412 | TINYHOSTLIB_SRCS = \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 413 | cgpt/cgpt_add.c \ |
| 414 | cgpt/cgpt_boot.c \ |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 415 | cgpt/cgpt_common.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 416 | cgpt/cgpt_create.c \ |
| 417 | cgpt/cgpt_prioritize.c \ |
Bill Richardson | 18e0370 | 2014-06-23 17:48:33 -0700 | [diff] [blame] | 418 | cgpt/flash_ts.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 419 | cgpt/flash_ts_drv.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 420 | firmware/lib/cgptlib/cgptlib_internal.c \ |
| 421 | firmware/lib/cgptlib/crc32.c \ |
Albert Chaulk | b334e65 | 2013-03-28 15:25:33 -0700 | [diff] [blame] | 422 | firmware/lib/cgptlib/mtdlib.c \ |
Bill Richardson | 5fed2a6 | 2013-03-04 15:11:38 -0800 | [diff] [blame] | 423 | firmware/lib/utility_string.c \ |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 424 | firmware/stub/utility_stub.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 425 | futility/dump_kernel_config_lib.c |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 426 | |
| 427 | TINYHOSTLIB_OBJS = ${TINYHOSTLIB_SRCS:%.c=${BUILD}/%.o} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 428 | |
| 429 | # ---------------------------------------------------------------------------- |
| 430 | # Now for the userspace binaries |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 431 | |
| 432 | CGPT = ${BUILD}/cgpt/cgpt |
| 433 | |
| 434 | CGPT_SRCS = \ |
| 435 | cgpt/cgpt.c \ |
| 436 | cgpt/cgpt_add.c \ |
| 437 | cgpt/cgpt_boot.c \ |
| 438 | cgpt/cgpt_common.c \ |
| 439 | cgpt/cgpt_create.c \ |
| 440 | cgpt/cgpt_find.c \ |
| 441 | cgpt/cgpt_legacy.c \ |
| 442 | cgpt/cgpt_prioritize.c \ |
| 443 | cgpt/cgpt_repair.c \ |
| 444 | cgpt/cgpt_show.c \ |
| 445 | cgpt/cmd_add.c \ |
| 446 | cgpt/cmd_boot.c \ |
| 447 | cgpt/cmd_create.c \ |
| 448 | cgpt/cmd_find.c \ |
| 449 | cgpt/cmd_legacy.c \ |
| 450 | cgpt/cmd_prioritize.c \ |
| 451 | cgpt/cmd_repair.c \ |
Albert Chaulk | 534723a | 2013-03-20 14:46:50 -0700 | [diff] [blame] | 452 | cgpt/cmd_show.c \ |
Bill Richardson | 18e0370 | 2014-06-23 17:48:33 -0700 | [diff] [blame] | 453 | cgpt/flash_ts.c \ |
| 454 | cgpt/flash_ts_drv.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 455 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 456 | CGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 457 | ALL_OBJS += ${CGPT_OBJS} |
| 458 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 459 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 460 | # Scripts to install directly (not compiled) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 461 | UTIL_SCRIPTS = \ |
| 462 | utility/dev_debug_vboot \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 463 | utility/enable_dev_usb_boot \ |
| 464 | utility/vbutil_what_keys |
| 465 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 466 | ifeq (${MINIMAL},) |
| 467 | UTIL_SCRIPTS += \ |
| 468 | utility/dev_make_keypair |
| 469 | endif |
| 470 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 471 | # These utilities should be linked statically. |
| 472 | UTIL_NAMES_STATIC = \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 473 | utility/crossystem |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 474 | |
| 475 | UTIL_NAMES = ${UTIL_NAMES_STATIC} \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 476 | utility/tpm_init_temp_fix \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 477 | utility/tpmc |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 478 | |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 479 | # TODO: Do we still need eficompress and efidecompress for anything? |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 480 | ifeq (${MINIMAL},) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 481 | UTIL_NAMES += \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 482 | utility/bmpblk_font \ |
| 483 | utility/bmpblk_utility \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 484 | utility/dumpRSAPublicKey \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 485 | utility/eficompress \ |
| 486 | utility/efidecompress \ |
| 487 | utility/load_kernel_test \ |
| 488 | utility/pad_digest_utility \ |
| 489 | utility/signature_digest_utility \ |
| 490 | utility/verify_data |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 491 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 492 | endif |
| 493 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 494 | UTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC}) |
| 495 | UTIL_BINS = $(addprefix ${BUILD}/,${UTIL_NAMES}) |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 496 | ALL_OBJS += $(addsuffix .o,${UTIL_BINS} ${UTIL_BINS_STATIC}) |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 497 | |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 498 | |
| 499 | # Scripts for signing stuff. |
| 500 | SIGNING_SCRIPTS = \ |
| 501 | utility/tpm-nvsize \ |
| 502 | utility/chromeos-tpm-recovery |
| 503 | |
| 504 | # These go in a different place. |
| 505 | SIGNING_SCRIPTS_DEV = \ |
| 506 | scripts/image_signing/resign_firmwarefd.sh \ |
| 507 | scripts/image_signing/make_dev_firmware.sh \ |
| 508 | scripts/image_signing/make_dev_ssd.sh \ |
| 509 | scripts/image_signing/set_gbb_flags.sh |
| 510 | |
| 511 | # Installed, but not made executable. |
| 512 | SIGNING_COMMON = scripts/image_signing/common_minimal.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 513 | |
Bill Richardson | 826db09 | 2013-01-14 12:37:15 -0800 | [diff] [blame] | 514 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 515 | # The unified firmware utility will eventually replace all the others |
| 516 | FUTIL_BIN = ${BUILD}/futility/futility |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 517 | # But we still need both static (tiny) and dynamic (with openssl) versions. |
| 518 | FUTIL_STATIC_BIN = ${FUTIL_BIN}_s |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 519 | |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 520 | # These are the executables that are now built in to futility. We'll create |
| 521 | # symlinks for these so the old names will still work. |
| 522 | # TODO: Do we still need dev_sign_file for anything? |
Bill Richardson | a1d9fe6 | 2014-09-05 12:52:27 -0700 | [diff] [blame^] | 523 | FUTIL_SYMLINKS = \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 524 | dev_sign_file \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 525 | dump_fmap \ |
| 526 | dump_kernel_config \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 527 | gbb_utility \ |
Bill Richardson | e155044 | 2014-07-17 11:32:17 -0700 | [diff] [blame] | 528 | vbutil_firmware \ |
| 529 | vbutil_kernel \ |
| 530 | vbutil_key \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 531 | vbutil_keyblock |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 532 | |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 533 | FUTIL_STATIC_SRCS = \ |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 534 | futility/futility.c \ |
Bill Richardson | 20807b6 | 2013-04-09 10:15:26 -0700 | [diff] [blame] | 535 | futility/cmd_dump_fmap.c \ |
Bill Richardson | cf6e78d | 2014-08-27 15:50:25 -0700 | [diff] [blame] | 536 | futility/cmd_gbb_utility.c \ |
| 537 | futility/misc.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 538 | |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 539 | FUTIL_SRCS = \ |
| 540 | $(FUTIL_STATIC_SRCS) \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 541 | futility/cmd_dev_sign_file.c \ |
| 542 | futility/cmd_dump_kernel_config.c \ |
Bill Richardson | 2e25e81 | 2014-09-03 11:34:27 -0700 | [diff] [blame] | 543 | futility/cmd_load_fmap.c \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 544 | futility/cmd_vbutil_firmware.c \ |
| 545 | futility/cmd_vbutil_kernel.c \ |
Bill Richardson | b84b81d | 2014-07-14 14:48:31 -0700 | [diff] [blame] | 546 | futility/cmd_vbutil_key.c \ |
Randall Spangler | b8ff397 | 2014-08-27 13:34:35 -0700 | [diff] [blame] | 547 | futility/cmd_vbutil_keyblock.c \ |
Bill Richardson | cf6e78d | 2014-08-27 15:50:25 -0700 | [diff] [blame] | 548 | futility/cmd_verify_kernel.c \ |
| 549 | futility/cmd_show.c \ |
Bill Richardson | 15dc6fc | 2014-09-02 14:45:44 -0700 | [diff] [blame] | 550 | futility/cmd_sign.c \ |
Bill Richardson | cf6e78d | 2014-08-27 15:50:25 -0700 | [diff] [blame] | 551 | futility/traversal.c |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 552 | |
Randall Spangler | 028f468 | 2014-08-19 14:42:08 -0700 | [diff] [blame] | 553 | ifneq (${VBOOT2},) |
| 554 | FUTIL_SRCS += \ |
| 555 | futility/cmd_vb2_verify_fw.c |
| 556 | endif |
| 557 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 558 | # List of commands built in futility and futility_s. |
| 559 | FUTIL_STATIC_CMD_LIST = ${BUILD}/gen/futility_static_cmds.c |
| 560 | FUTIL_CMD_LIST = ${BUILD}/gen/futility_cmds.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 561 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 562 | FUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} \ |
| 563 | ${FUTIL_STATIC_CMD_LIST:%.c=%.o} |
| 564 | FUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} ${FUTIL_CMD_LIST:%.c=%.o} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 565 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 566 | ALL_OBJS += ${FUTIL_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 567 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 568 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 569 | # Library of handy test functions. |
| 570 | TESTLIB = ${BUILD}/tests/test.a |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 571 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 572 | TESTLIB_SRCS = \ |
| 573 | tests/test_common.c \ |
| 574 | tests/timer_utils.c \ |
| 575 | tests/crc32_test.c |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 576 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 577 | TESTLIB_OBJS = ${TESTLIB_SRCS:%.c=${BUILD}/%.o} |
| 578 | ALL_OBJS += ${TESTLIB_OBJS} |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 579 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 580 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 581 | # And some compiled tests. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 582 | TEST_NAMES = \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 583 | tests/cgptlib_test \ |
| 584 | tests/rollback_index2_tests \ |
| 585 | tests/rollback_index3_tests \ |
| 586 | tests/rsa_padding_test \ |
| 587 | tests/rsa_utility_tests \ |
| 588 | tests/rsa_verify_benchmark \ |
| 589 | tests/sha_benchmark \ |
| 590 | tests/sha_tests \ |
| 591 | tests/stateful_util_tests \ |
| 592 | tests/tlcl_tests \ |
| 593 | tests/tpm_bootmode_tests \ |
| 594 | tests/utility_string_tests \ |
| 595 | tests/utility_tests \ |
| 596 | tests/vboot_api_init_tests \ |
| 597 | tests/vboot_api_devmode_tests \ |
| 598 | tests/vboot_api_firmware_tests \ |
| 599 | tests/vboot_api_kernel_tests \ |
| 600 | tests/vboot_api_kernel2_tests \ |
| 601 | tests/vboot_api_kernel3_tests \ |
| 602 | tests/vboot_api_kernel4_tests \ |
| 603 | tests/vboot_audio_tests \ |
| 604 | tests/vboot_common_tests \ |
| 605 | tests/vboot_common2_tests \ |
| 606 | tests/vboot_common3_tests \ |
| 607 | tests/vboot_display_tests \ |
| 608 | tests/vboot_firmware_tests \ |
| 609 | tests/vboot_kernel_tests \ |
| 610 | tests/vboot_nvstorage_test \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 611 | tests/futility/binary_editor \ |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 612 | tests/futility/test_not_really |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 613 | |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 614 | ifdef REGION_READ |
| 615 | TEST_NAMES += tests/vboot_region_tests |
| 616 | endif |
| 617 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 618 | ifneq (${VBOOT2},) |
| 619 | TEST_NAMES += \ |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 620 | tests/vb2_api_tests \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 621 | tests/vb2_common_tests \ |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 622 | tests/vb2_common2_tests \ |
| 623 | tests/vb2_common3_tests \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 624 | tests/vb2_misc_tests \ |
Randall Spangler | 1803068 | 2014-06-11 16:01:08 -0700 | [diff] [blame] | 625 | tests/vb2_misc2_tests \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 626 | tests/vb2_nvstorage_tests \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 627 | tests/vb2_rsa_padding_tests \ |
| 628 | tests/vb2_rsa_utility_tests \ |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 629 | tests/vb2_secdata_tests \ |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 630 | tests/vb2_sha_tests \ |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 631 | |
| 632 | endif |
| 633 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 634 | # And a few more... |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 635 | TLCL_TEST_NAMES = \ |
| 636 | tests/tpm_lite/tpmtest_earlyextend \ |
| 637 | tests/tpm_lite/tpmtest_earlynvram \ |
| 638 | tests/tpm_lite/tpmtest_earlynvram2 \ |
| 639 | tests/tpm_lite/tpmtest_enable \ |
| 640 | tests/tpm_lite/tpmtest_fastenable \ |
| 641 | tests/tpm_lite/tpmtest_globallock \ |
| 642 | tests/tpm_lite/tpmtest_redefine_unowned \ |
| 643 | tests/tpm_lite/tpmtest_spaceperm \ |
| 644 | tests/tpm_lite/tpmtest_testsetup \ |
| 645 | tests/tpm_lite/tpmtest_timing \ |
| 646 | tests/tpm_lite/tpmtest_writelimit |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 647 | |
| 648 | TEST_NAMES += ${TLCL_TEST_NAMES} |
| 649 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 650 | # Finally |
| 651 | TEST_BINS = $(addprefix ${BUILD}/,${TEST_NAMES}) |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 652 | ALL_OBJS += $(addsuffix .o,${TEST_BINS}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 653 | |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 654 | # Directory containing test keys |
| 655 | TEST_KEYS = ${SRC_RUN}/tests/testkeys |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 656 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 657 | |
| 658 | ############################################################################## |
| 659 | # Finally, some targets. High-level ones first. |
| 660 | |
| 661 | # Create output directories if necessary. Do this via explicit shell commands |
| 662 | # so it happens before trying to generate/include dependencies. |
| 663 | SUBDIRS := firmware host cgpt utility futility tests tests/tpm_lite |
| 664 | _dir_create := $(foreach d, \ |
| 665 | $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; | sort -u), \ |
| 666 | $(shell [ -d ${BUILD}/${d} ] || mkdir -p ${BUILD}/${d})) |
| 667 | |
| 668 | |
| 669 | # Default target. |
| 670 | .PHONY: all |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 671 | all: fwlib $(if ${VBOOT2},fwlib2) $(if ${FIRMWARE_ARCH},,host_stuff) \ |
| 672 | $(if ${COV},coverage) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 673 | |
| 674 | # Host targets |
| 675 | .PHONY: host_stuff |
Bill Richardson | bc2d2b2 | 2014-07-09 21:11:12 -0700 | [diff] [blame] | 676 | host_stuff: utillib hostlib cgpt utils futil tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 677 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 678 | .PHONY: clean |
| 679 | clean: |
| 680 | ${Q}/bin/rm -rf ${BUILD} |
| 681 | |
| 682 | .PHONY: install |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 683 | install: cgpt_install utils_install signing_install futil_install |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 684 | |
Bill Richardson | 3e3790d | 2014-07-14 15:05:54 -0700 | [diff] [blame] | 685 | .PHONY: install_for_test |
| 686 | install_for_test: override DESTDIR = ${TEST_INSTALL_DIR} |
| 687 | install_for_test: install |
| 688 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 689 | # Don't delete intermediate object files |
| 690 | .SECONDARY: |
| 691 | |
Bill Richardson | 0e6ae29 | 2014-08-26 10:34:40 -0700 | [diff] [blame] | 692 | .PHONY: tags TAGS |
| 693 | tags TAGS: ${CGPT_SRCS} ${FUTIL_SRCS} ${UTILLIB_SRCS} ${FWLIB_SRCS} \ |
| 694 | $(if ${VBOOT2},${FWLIB2_SRCS}) \ |
| 695 | $(wildcard $(patsubst -I%,%/*.h,${INCLUDES})) |
| 696 | ${Q}\rm -f cscope.* TAGS |
| 697 | ${Q}echo $^ | tr ' ' '\012' > cscope.files |
| 698 | ${Q}$(if $(shell which etags 2>/dev/null),etags $^,echo "no etags") |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 699 | |
| 700 | # ---------------------------------------------------------------------------- |
| 701 | # Firmware library |
| 702 | |
| 703 | # TPM-specific flags. These depend on the particular TPM we're targeting for. |
| 704 | # They are needed here only for compiling parts of the firmware code into |
| 705 | # user-level tests. |
| 706 | |
| 707 | # TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until |
| 708 | # the self test has completed. |
| 709 | |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 710 | ${FWLIB_OBJS}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 711 | |
| 712 | # TPM_MANUAL_SELFTEST is defined if the self test must be started manually |
| 713 | # (with a call to TPM_ContinueSelfTest) instead of starting automatically at |
| 714 | # power on. |
| 715 | # |
| 716 | # We sincerely hope that TPM_BLOCKING_CONTINUESELFTEST and TPM_MANUAL_SELFTEST |
| 717 | # are not both defined at the same time. (See comment in code.) |
| 718 | |
| 719 | # CFLAGS += -DTPM_MANUAL_SELFTEST |
| 720 | |
| 721 | ifeq (${FIRMWARE_ARCH},i386) |
| 722 | # Unrolling loops in cryptolib makes it faster |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 723 | ${FWLIB_OBJS}: CFLAGS += -DUNROLL_LOOPS |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 724 | ${FWLIB2_OBJS}: CFLAGS += -DUNROLL_LOOPS |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 725 | |
| 726 | # Workaround for coreboot on x86, which will power off asynchronously |
| 727 | # without giving us a chance to react. This is not an example of the Right |
| 728 | # Way to do things. See chrome-os-partner:7689, and the commit message |
| 729 | # that made this change. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 730 | ${FWLIB_OBJS}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 731 | |
| 732 | # On x86 we don't actually read the GBB data into RAM until it is needed. |
| 733 | # Therefore it makes sense to cache it rather than reading it each time. |
| 734 | # Enable this feature. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 735 | ${FWLIB_OBJS}: CFLAGS += -DCOPY_BMP_DATA |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 736 | endif |
| 737 | |
Simon Glass | 527ba81 | 2013-07-25 08:48:47 -0600 | [diff] [blame] | 738 | ifdef REGION_READ |
| 739 | ${FWLIB_OBJS}: CFLAGS += -DREGION_READ |
| 740 | endif |
| 741 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 742 | ifeq (${FIRMWARE_ARCH},) |
| 743 | # Disable rollback TPM when compiling locally, since otherwise |
| 744 | # load_kernel_test attempts to talk to the TPM. |
Randall Spangler | 45cc0f2 | 2013-01-25 09:34:26 -0800 | [diff] [blame] | 745 | ${FWLIB_OBJS}: CFLAGS += -DDISABLE_ROLLBACK_TPM |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 746 | endif |
| 747 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 748 | # Linktest ensures firmware lib doesn't rely on outside libraries |
| 749 | ${BUILD}/firmware/linktest/main_vbinit: ${VBINIT_OBJS} |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 750 | ${BUILD}/firmware/linktest/main_vbinit: OBJS = ${VBINIT_OBJS} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 751 | ALL_OBJS += ${BUILD}/firmware/linktest/main_vbinit.o |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 752 | ${BUILD}/firmware/linktest/main_vbsf: ${VBSF_OBJS} |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 753 | ${BUILD}/firmware/linktest/main_vbsf: OBJS = ${VBSF_OBJS} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 754 | ALL_OBJS += ${BUILD}/firmware/linktest/main_vbsf.o |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 755 | ${BUILD}/firmware/linktest/main: ${FWLIB} |
| 756 | ${BUILD}/firmware/linktest/main: LIBS = ${FWLIB} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 757 | ALL_OBJS += ${BUILD}/firmware/linktest/main.o |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 758 | |
Bill Richardson | d2d08b2 | 2014-07-08 16:31:40 -0700 | [diff] [blame] | 759 | .PHONY: fwlinktest |
| 760 | fwlinktest: \ |
Randall Spangler | 9394326 | 2013-02-26 11:03:57 -0800 | [diff] [blame] | 761 | ${BUILD}/firmware/linktest/main_vbinit \ |
| 762 | ${BUILD}/firmware/linktest/main_vbsf \ |
| 763 | ${BUILD}/firmware/linktest/main |
| 764 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 765 | .PHONY: fwlib |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 766 | fwlib: $(if ${FIRMWARE_ARCH},${FWLIB},fwlinktest) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 767 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 768 | .PHONY: fwlib2 |
| 769 | fwlib2: ${FWLIB2} |
| 770 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 771 | ${FWLIB}: ${FWLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 772 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 773 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 774 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 775 | ${Q}ar qc $@ $^ |
| 776 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 777 | ${FWLIB2}: ${FWLIB2_OBJS} |
| 778 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
| 779 | ${Q}rm -f $@ |
| 780 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
| 781 | ${Q}ar qc $@ $^ |
| 782 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 783 | # ---------------------------------------------------------------------------- |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 784 | # Host library(s) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 785 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 786 | # Link tests for local utilities |
| 787 | ${BUILD}/host/linktest/main: ${UTILLIB} |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 788 | ${BUILD}/host/linktest/main: LIBS = ${UTILLIB} |
| 789 | ALL_OBJS += ${BUILD}/host/linktest/main.o |
| 790 | |
| 791 | .PHONY: utillib |
| 792 | utillib: ${UTILLIB} \ |
| 793 | ${BUILD}/host/linktest/main |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 794 | |
| 795 | # TODO: better way to make .a than duplicating this recipe each time? |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 796 | ${UTILLIB}: ${UTILLIB_OBJS} ${FWLIB_OBJS} $(if ${VBOOT2},${FWLIB2_OBJS}) |
| 797 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
| 798 | ${Q}rm -f $@ |
| 799 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
| 800 | ${Q}ar qc $@ $^ |
| 801 | |
| 802 | |
| 803 | # Link tests for external repos |
| 804 | ${BUILD}/host/linktest/extern: ${HOSTLIB} |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 805 | ${BUILD}/host/linktest/extern: LIBS = ${HOSTLIB} |
| 806 | ${BUILD}/host/linktest/extern: LDLIBS += -static |
| 807 | ALL_OBJS += ${BUILD}/host/linktest/extern.o |
| 808 | |
| 809 | .PHONY: hostlib |
| 810 | hostlib: ${HOSTLIB} \ |
| 811 | ${BUILD}/host/linktest/extern |
| 812 | |
| 813 | # TODO: better way to make .a than duplicating this recipe each time? |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 814 | ${HOSTLIB}: ${HOSTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 815 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 816 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 817 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 818 | ${Q}ar qc $@ $^ |
| 819 | |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 820 | |
| 821 | # Ugh. This is a very cut-down version of HOSTLIB just for the installer. |
| 822 | .PHONY: tinyhostlib |
| 823 | tinyhostlib: ${TINYHOSTLIB} |
| 824 | ${Q}cp -f ${TINYHOSTLIB} ${HOSTLIB} |
| 825 | |
| 826 | ${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 827 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 828 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 829 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 81a0b3d | 2013-02-28 13:53:09 -0800 | [diff] [blame] | 830 | ${Q}ar qc $@ $^ |
| 831 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 832 | # ---------------------------------------------------------------------------- |
| 833 | # CGPT library and utility |
| 834 | |
| 835 | .PHONY: cgpt |
| 836 | cgpt: ${CGPT} |
| 837 | |
| 838 | ${CGPT}: LDFLAGS += -static |
| 839 | ${CGPT}: LDLIBS += -luuid |
| 840 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 841 | ${CGPT}: ${CGPT_OBJS} ${UTILLIB} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 842 | @$(PRINTF) " LDcgpt $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 843 | ${Q}${LD} -o ${CGPT} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 844 | |
| 845 | .PHONY: cgpt_install |
| 846 | cgpt_install: ${CGPT} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 847 | @$(PRINTF) " INSTALL CGPT\n" |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 848 | ${Q}mkdir -p ${UB_DIR} |
| 849 | ${Q}${INSTALL} -t ${UB_DIR} $^ |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 850 | |
| 851 | # ---------------------------------------------------------------------------- |
| 852 | # Utilities |
| 853 | |
| 854 | # These have their own headers too. |
Bill Richardson | 0f6679e | 2014-07-10 15:49:52 -0700 | [diff] [blame] | 855 | ${BUILD}/utility/%: INCLUDES += -Iutility/include |
| 856 | |
| 857 | ${UTIL_BINS} ${UTIL_BINS_STATIC}: ${UTILLIB} |
| 858 | ${UTIL_BINS} ${UTIL_BINS_STATIC}: LIBS = ${UTILLIB} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 859 | |
| 860 | # Utilities for auto-update toolkits must be statically linked. |
| 861 | ${UTIL_BINS_STATIC}: LDFLAGS += -static |
| 862 | |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 863 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 864 | .PHONY: utils |
Bill Richardson | c7c6e5d | 2013-02-28 10:10:29 -0800 | [diff] [blame] | 865 | utils: ${UTIL_BINS} ${UTIL_SCRIPTS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 866 | ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility |
| 867 | ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) |
| 868 | |
| 869 | .PHONY: utils_install |
Bill Richardson | c7c6e5d | 2013-02-28 10:10:29 -0800 | [diff] [blame] | 870 | utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 871 | @$(PRINTF) " INSTALL UTILS\n" |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 872 | ${Q}mkdir -p ${UB_DIR} |
| 873 | ${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 874 | |
| 875 | # And some signing stuff for the target |
| 876 | .PHONY: signing_install |
| 877 | signing_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 878 | @$(PRINTF) " INSTALL SIGNING\n" |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 879 | ${Q}mkdir -p ${UB_DIR} ${VB_DIR} |
Bill Richardson | c9bf348 | 2013-02-13 14:38:29 -0800 | [diff] [blame] | 880 | ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS} |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 881 | ${Q}${INSTALL} -t ${VB_DIR} ${SIGNING_SCRIPTS_DEV} |
| 882 | ${Q}${INSTALL} -t ${VB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 883 | |
| 884 | # ---------------------------------------------------------------------------- |
| 885 | # new Firmware Utility |
| 886 | |
| 887 | .PHONY: futil |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 888 | futil: ${FUTIL_STATIC_BIN} ${FUTIL_BIN} |
| 889 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 890 | ${FUTIL_STATIC_BIN}: ${FUTIL_STATIC_OBJS} ${UTILLIB} |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 891 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
| 892 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} -static $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 893 | |
Bill Richardson | b84b81d | 2014-07-14 14:48:31 -0700 | [diff] [blame] | 894 | ${FUTIL_BIN}: LDLIBS += ${CRYPTO_LIBS} |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 895 | ${FUTIL_BIN}: ${FUTIL_OBJS} ${UTILLIB} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 896 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 897 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 898 | |
| 899 | .PHONY: futil_install |
| 900 | futil_install: ${FUTIL_BIN} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 901 | @$(PRINTF) " INSTALL futility\n" |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 902 | ${Q}mkdir -p ${UB_DIR} |
| 903 | ${Q}${INSTALL} -t ${UB_DIR} ${FUTIL_BIN} ${FUTIL_STATIC_BIN} |
Bill Richardson | a1d9fe6 | 2014-09-05 12:52:27 -0700 | [diff] [blame^] | 904 | ${Q}for prog in ${FUTIL_SYMLINKS}; do \ |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 905 | ln -sf futility "${UB_DIR}/$$prog"; done |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 906 | |
| 907 | # ---------------------------------------------------------------------------- |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 908 | # Utility to generate TLCL structure definition header file. |
| 909 | |
| 910 | ${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct |
| 911 | |
| 912 | STRUCTURES_TMP=${BUILD}/tlcl_structures.tmp |
| 913 | STRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h |
| 914 | |
| 915 | .PHONY: update_tlcl_structures |
| 916 | update_tlcl_structures: ${BUILD}/utility/tlcl_generator |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 917 | @$(PRINTF) " Rebuilding TLCL structures\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 918 | ${Q}${BUILD}/utility/tlcl_generator > ${STRUCTURES_TMP} |
| 919 | ${Q}cmp -s ${STRUCTURES_TMP} ${STRUCTURES_SRC} || \ |
| 920 | ( echo "%% Updating structures.h %%" && \ |
| 921 | cp ${STRUCTURES_TMP} ${STRUCTURES_SRC} ) |
| 922 | |
| 923 | # ---------------------------------------------------------------------------- |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 924 | # Tests |
| 925 | |
| 926 | .PHONY: tests |
| 927 | tests: ${TEST_BINS} |
| 928 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 929 | ${TEST_BINS}: ${UTILLIB} ${TESTLIB} |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 930 | ${TEST_BINS}: INCLUDES += -Itests |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 931 | ${TEST_BINS}: LIBS = ${UTILLIB} ${TESTLIB} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 932 | |
| 933 | ${TESTLIB}: ${TESTLIB_OBJS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 934 | @$(PRINTF) " RM $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 935 | ${Q}rm -f $@ |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 936 | @$(PRINTF) " AR $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 937 | ${Q}ar qc $@ $^ |
| 938 | |
| 939 | |
| 940 | # ---------------------------------------------------------------------------- |
| 941 | # Generic build rules. LIBS and OBJS can be overridden to tweak the generic |
| 942 | # rules for specific targets. |
| 943 | |
| 944 | ${BUILD}/%: ${BUILD}/%.o ${OBJS} ${LIBS} |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 945 | @$(PRINTF) " LD $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | 6db8c75 | 2013-04-05 13:30:43 -0700 | [diff] [blame] | 946 | ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $< ${OBJS} ${LIBS} ${LDLIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 947 | |
| 948 | ${BUILD}/%.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 949 | @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 950 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 951 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 952 | ${BUILD}/%.o: ${BUILD}/%.c |
| 953 | @$(PRINTF) " CC $(subst ${BUILD}/,,$@)\n" |
| 954 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 955 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 956 | # Rules to recompile a single source file for library and test |
| 957 | # TODO: is there a tidier way to do this? |
| 958 | ${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY |
| 959 | ${BUILD}/%_for_lib.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 960 | @$(PRINTF) " CC-for-lib $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 961 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 962 | |
| 963 | ${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST |
| 964 | ${BUILD}/%_for_test.o: %.c |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 965 | @$(PRINTF) " CC-for-test $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 966 | ${Q}${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 967 | |
| 968 | # TODO: C++ files don't belong in vboot reference at all. Convert to C. |
| 969 | ${BUILD}/%.o: %.cc |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 970 | @$(PRINTF) " CXX $(subst ${BUILD}/,,$@)\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 971 | ${Q}${CXX} ${CFLAGS} ${INCLUDES} -c -o $@ $< |
| 972 | |
| 973 | # ---------------------------------------------------------------------------- |
| 974 | # Here are the special tweaks to the generic rules. |
| 975 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 976 | # Some utilities need external crypto functions |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 977 | CRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto) |
| 978 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 979 | ${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} |
| 980 | ${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} |
| 981 | ${BUILD}/utility/signature_digest_utility: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 982 | |
| 983 | ${BUILD}/host/linktest/main: LDLIBS += ${CRYPTO_LIBS} |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 984 | ${BUILD}/tests/vb2_common2_tests: LDLIBS += ${CRYPTO_LIBS} |
| 985 | ${BUILD}/tests/vb2_common3_tests: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 986 | ${BUILD}/tests/vboot_common2_tests: LDLIBS += ${CRYPTO_LIBS} |
| 987 | ${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 988 | |
Bill Richardson | 18e0370 | 2014-06-23 17:48:33 -0700 | [diff] [blame] | 989 | ${BUILD}/tests/cgptlib_test: OBJS += \ |
| 990 | ${BUILD}/firmware/lib/cgptlib/mtdlib_unused.o |
| 991 | ${BUILD}/tests/cgptlib_test: ${BUILD}/firmware/lib/cgptlib/mtdlib_unused.o |
| 992 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 993 | ${BUILD}/utility/bmpblk_utility: LD = ${CXX} |
| 994 | ${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml |
| 995 | |
| 996 | BMPBLK_UTILITY_DEPS = \ |
| 997 | ${BUILD}/utility/bmpblk_util.o \ |
| 998 | ${BUILD}/utility/image_types.o \ |
| 999 | ${BUILD}/utility/eficompress_for_lib.o \ |
| 1000 | ${BUILD}/utility/efidecompress_for_lib.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1001 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1002 | ${BUILD}/utility/bmpblk_utility: OBJS = ${BMPBLK_UTILITY_DEPS} |
| 1003 | ${BUILD}/utility/bmpblk_utility: ${BMPBLK_UTILITY_DEPS} |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1004 | ALL_OBJS += ${BMPBLK_UTILITY_DEPS} |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1005 | |
| 1006 | ${BUILD}/utility/bmpblk_font: OBJS += ${BUILD}/utility/image_types.o |
| 1007 | ${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1008 | ALL_OBJS += ${BUILD}/utility/image_types.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1009 | |
| 1010 | # Allow multiple definitions, so tests can mock functions from other libraries |
| 1011 | ${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1012 | ${BUILD}/tests/%: LDLIBS += -lrt -luuid |
| 1013 | ${BUILD}/tests/%: LIBS += ${TESTLIB} |
| 1014 | |
| 1015 | ${BUILD}/tests/rollback_index2_tests: OBJS += \ |
| 1016 | ${BUILD}/firmware/lib/rollback_index_for_test.o |
| 1017 | ${BUILD}/tests/rollback_index2_tests: \ |
| 1018 | ${BUILD}/firmware/lib/rollback_index_for_test.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1019 | ALL_OBJS += ${BUILD}/firmware/lib/rollback_index_for_test.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1020 | |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 1021 | ${BUILD}/tests/tlcl_tests: OBJS += \ |
| 1022 | ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
| 1023 | ${BUILD}/tests/tlcl_tests: \ |
| 1024 | ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1025 | ALL_OBJS += ${BUILD}/firmware/lib/tpm_lite/tlcl_for_test.o |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 1026 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1027 | ${BUILD}/tests/vboot_audio_tests: OBJS += \ |
| 1028 | ${BUILD}/firmware/lib/vboot_audio_for_test.o |
| 1029 | ${BUILD}/tests/vboot_audio_tests: \ |
| 1030 | ${BUILD}/firmware/lib/vboot_audio_for_test.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1031 | ALL_OBJS += ${BUILD}/firmware/lib/vboot_audio_for_test.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1032 | |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 1033 | TLCL_TEST_BINS = $(addprefix ${BUILD}/,${TLCL_TEST_NAMES}) |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1034 | ${TLCL_TEST_BINS}: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o |
| 1035 | ${TLCL_TEST_BINS}: ${BUILD}/tests/tpm_lite/tlcl_tests.o |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1036 | ALL_OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1037 | |
Alex Deymo | e08ee28 | 2014-08-29 01:07:48 -0700 | [diff] [blame] | 1038 | # ---------------------------------------------------------------------------- |
| 1039 | # Here are the special rules that don't fit in the generic rules. |
| 1040 | |
| 1041 | # Generates the list of commands defined in futility by running grep in the |
| 1042 | # source files looking for the DECLARE_FUTIL_COMMAND() macro usage. |
| 1043 | ${FUTIL_STATIC_CMD_LIST}: ${FUTIL_STATIC_SRCS} |
| 1044 | ${FUTIL_CMD_LIST}: ${FUTIL_SRCS} |
| 1045 | ${FUTIL_CMD_LIST} ${FUTIL_STATIC_CMD_LIST}: |
| 1046 | @$(PRINTF) " GEN $(subst ${BUILD}/,,$@)\n" |
| 1047 | ${Q}rm -f $@ $@_t $@_commands |
| 1048 | ${Q}mkdir -p ${BUILD}/gen |
| 1049 | ${Q}grep -hoRE '^DECLARE_FUTIL_COMMAND\([^,]+' $^ -R \ |
| 1050 | | sed 's/DECLARE_FUTIL_COMMAND(\(.*\)/_CMD(\1)/' \ |
| 1051 | | sort >>$@_commands |
| 1052 | ${Q}echo '#define _CMD(NAME) extern const struct' \ |
| 1053 | 'futil_cmd_t __cmd_##NAME;' >> $@_t |
| 1054 | ${Q}cat $@_commands >> $@_t |
| 1055 | ${Q}echo '#undef _CMD' >> $@_t |
| 1056 | ${Q}echo '#define _CMD(NAME) &__cmd_##NAME,' >> $@_t |
| 1057 | ${Q}echo 'const struct futil_cmd_t *const futil_cmds[] = {' >> $@_t |
| 1058 | ${Q}cat $@_commands >> $@_t |
| 1059 | ${Q}echo '0}; /* null-terminated */' >> $@_t |
| 1060 | ${Q}echo '#undef _CMD' >> $@_t |
| 1061 | ${Q}mv $@_t $@ |
| 1062 | ${Q}rm -f $@_commands |
| 1063 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1064 | ############################################################################## |
| 1065 | # Targets that exist just to run tests |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1066 | |
| 1067 | # Frequently-run tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1068 | .PHONY: test_targets |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1069 | test_targets:: runcgpttests runmisctests $(if ${VBOOT2},run2tests) |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1070 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1071 | ifeq (${MINIMAL},) |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1072 | # Bitmap utility isn't compiled for minimal variant |
Bill Richardson | feb2518 | 2013-03-07 12:54:29 -0800 | [diff] [blame] | 1073 | test_targets:: runbmptests runfutiltests |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1074 | # Scripts don't work under qemu testing |
| 1075 | # TODO: convert scripts to makefile so they can be called directly |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1076 | test_targets:: runtestscripts |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1077 | endif |
| 1078 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1079 | .PHONY: test_setup |
Bill Richardson | 3e3790d | 2014-07-14 15:05:54 -0700 | [diff] [blame] | 1080 | test_setup:: cgpt utils futil tests install_for_test |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1081 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1082 | # Qemu setup for cross-compiled tests. Need to copy qemu binary into the |
| 1083 | # sysroot. |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1084 | ifneq (${QEMU_ARCH},) |
| 1085 | test_setup:: qemu_install |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1086 | |
| 1087 | .PHONY: qemu_install |
| 1088 | qemu_install: |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1089 | ifeq (${SYSROOT},) |
| 1090 | $(error SYSROOT must be set to the top of the target-specific root \ |
| 1091 | when cross-compiling for qemu-based tests to run properly.) |
| 1092 | endif |
Simon Glass | 661ae9e | 2013-03-26 11:39:21 -0700 | [diff] [blame] | 1093 | @$(PRINTF) " Copying qemu binary.\n" |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1094 | ${Q}cp -fu /usr/bin/${QEMU_BIN} ${BUILD}/${QEMU_BIN} |
| 1095 | ${Q}chmod a+rx ${BUILD}/${QEMU_BIN} |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1096 | endif |
| 1097 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1098 | .PHONY: runtests |
Bill Richardson | a130e0b | 2013-04-04 18:16:39 -0700 | [diff] [blame] | 1099 | runtests: test_setup test_targets |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1100 | |
| 1101 | # Generate test keys |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1102 | .PHONY: genkeys |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1103 | genkeys: utils |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1104 | tests/gen_test_keys.sh |
| 1105 | |
| 1106 | # Generate test cases for fuzzing |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1107 | .PHONY: genfuzztestcases |
Randall Spangler | a808dc9 | 2013-01-14 12:59:05 -0800 | [diff] [blame] | 1108 | genfuzztestcases: utils |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1109 | tests/gen_fuzz_test_cases.sh |
| 1110 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1111 | .PHONY: runbmptests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1112 | runbmptests: test_setup |
| 1113 | cd tests/bitmaps && BMPBLK=${BUILD_RUN}/utility/bmpblk_utility \ |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1114 | ./TestBmpBlock.py -v |
| 1115 | |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1116 | .PHONY: runcgpttests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1117 | runcgpttests: test_setup |
| 1118 | ${RUNTEST} ${BUILD_RUN}/tests/cgptlib_test |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1119 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1120 | .PHONY: runtestscripts |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1121 | runtestscripts: test_setup genfuzztestcases |
Randall Spangler | b8ff397 | 2014-08-27 13:34:35 -0700 | [diff] [blame] | 1122 | tests/load_kernel_tests.sh |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1123 | tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt |
Albert Chaulk | 42c08cb | 2013-04-02 14:38:07 -0700 | [diff] [blame] | 1124 | tests/run_cgpt_tests.sh ${BUILD_RUN}/cgpt/cgpt -N=512,32,1,3 |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1125 | tests/run_preamble_tests.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1126 | tests/run_rsa_tests.sh |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1127 | tests/run_vbutil_kernel_arg_tests.sh |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1128 | tests/run_vbutil_tests.sh |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1129 | ifneq (${VBOOT2},) |
| 1130 | tests/vb2_rsa_tests.sh |
Randall Spangler | 539cbc2 | 2014-06-18 14:15:04 -0700 | [diff] [blame] | 1131 | tests/vb2_firmware_tests.sh |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1132 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1133 | |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1134 | .PHONY: runmisctests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1135 | runmisctests: test_setup |
| 1136 | ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests |
Randall Spangler | a3eac79 | 2013-01-23 13:04:05 -0800 | [diff] [blame] | 1137 | ${RUNTEST} ${BUILD_RUN}/tests/rollback_index3_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1138 | ${RUNTEST} ${BUILD_RUN}/tests/rsa_utility_tests |
| 1139 | ${RUNTEST} ${BUILD_RUN}/tests/sha_tests |
| 1140 | ${RUNTEST} ${BUILD_RUN}/tests/stateful_util_tests |
Randall Spangler | c3d488d | 2013-01-28 16:23:48 -0800 | [diff] [blame] | 1141 | ${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1142 | ${RUNTEST} ${BUILD_RUN}/tests/tpm_bootmode_tests |
| 1143 | ${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests |
| 1144 | ${RUNTEST} ${BUILD_RUN}/tests/utility_tests |
| 1145 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1146 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_firmware_tests |
Randall Spangler | 0714d9d | 2013-02-05 10:23:38 -0800 | [diff] [blame] | 1147 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_init_tests |
| 1148 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel_tests |
Randall Spangler | 7f43669 | 2013-02-05 12:42:36 -0800 | [diff] [blame] | 1149 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel2_tests |
| 1150 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel3_tests |
| 1151 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_api_kernel4_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1152 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_audio_tests |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 1153 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common_tests |
| 1154 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} |
| 1155 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} |
Randall Spangler | 786a5dc | 2013-01-24 14:19:56 -0800 | [diff] [blame] | 1156 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_display_tests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1157 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_firmware_tests |
Randall Spangler | 49cb0d3 | 2013-01-29 14:28:16 -0800 | [diff] [blame] | 1158 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_kernel_tests |
Randall Spangler | 6dbf9d9 | 2013-01-23 12:25:10 -0800 | [diff] [blame] | 1159 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1160 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1161 | .PHONY: run2tests |
| 1162 | run2tests: test_setup |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 1163 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_api_tests |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1164 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common_tests |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 1165 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common2_tests ${TEST_KEYS} |
| 1166 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common3_tests ${TEST_KEYS} |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 1167 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_misc_tests |
Randall Spangler | 1803068 | 2014-06-11 16:01:08 -0700 | [diff] [blame] | 1168 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_misc2_tests |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 1169 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_nvstorage_tests |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1170 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_rsa_utility_tests |
Randall Spangler | 3333e57 | 2014-05-14 11:37:52 -0700 | [diff] [blame] | 1171 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_secdata_tests |
Randall Spangler | e166d04 | 2014-05-13 09:24:52 -0700 | [diff] [blame] | 1172 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_sha_tests |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1173 | |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1174 | .PHONY: runfutiltests |
Bill Richardson | 3e3790d | 2014-07-14 15:05:54 -0700 | [diff] [blame] | 1175 | runfutiltests: test_setup |
| 1176 | tests/futility/run_test_scripts.sh ${TEST_INSTALL_DIR} |
Bill Richardson | 339f7e0 | 2013-04-05 09:49:24 -0700 | [diff] [blame] | 1177 | ${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really |
Randall Spangler | 844bce5 | 2013-01-15 16:16:43 -0800 | [diff] [blame] | 1178 | |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1179 | # Run long tests, including all permutations of encryption keys (instead of |
Randall Spangler | 786a5dc | 2013-01-24 14:19:56 -0800 | [diff] [blame] | 1180 | # just the ones we use) and tests of currently-unused code. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1181 | # Not run by automated build. |
Bill Richardson | acb2ee9 | 2013-01-11 22:53:00 -0800 | [diff] [blame] | 1182 | .PHONY: runlongtests |
Bill Richardson | eecc18f | 2013-01-17 15:28:17 -0800 | [diff] [blame] | 1183 | runlongtests: test_setup genkeys genfuzztestcases |
Randall Spangler | e061a25 | 2013-01-22 15:34:07 -0800 | [diff] [blame] | 1184 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common2_tests ${TEST_KEYS} --all |
| 1185 | ${RUNTEST} ${BUILD_RUN}/tests/vboot_common3_tests ${TEST_KEYS} --all |
Randall Spangler | 7141d73 | 2014-05-15 15:34:54 -0700 | [diff] [blame] | 1186 | ifneq (${VBOOT2},) |
| 1187 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common2_tests ${TEST_KEYS} --all |
| 1188 | ${RUNTEST} ${BUILD_RUN}/tests/vb2_common3_tests ${TEST_KEYS} --all |
| 1189 | endif |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1190 | tests/run_preamble_tests.sh --all |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1191 | tests/run_vbutil_tests.sh --all |
| 1192 | |
Bill Richardson | 78d59bf | 2014-08-27 16:17:04 -0700 | [diff] [blame] | 1193 | # TODO: There were a number of ancient tests that hadn't been run in years. |
| 1194 | # They were removed with https://chromium-review.googlesource.com/#/c/214610/ |
| 1195 | # Some day it might be nice to see what they were supposed to do. |
Randall Spangler | 5d9bbf2 | 2013-01-08 10:44:23 -0800 | [diff] [blame] | 1196 | |
Bill Richardson | 7829902 | 2014-06-20 14:33:00 -0700 | [diff] [blame] | 1197 | .PHONY: runalltests |
| 1198 | runalltests: runtests runfutiltests runlongtests |
| 1199 | |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 1200 | # Code coverage |
| 1201 | .PHONY: coverage_init |
| 1202 | coverage_init: test_setup |
| 1203 | rm -f ${COV_INFO}* |
| 1204 | lcov -c -i -d . -b . -o ${COV_INFO}.initial |
| 1205 | |
| 1206 | .PHONY: coverage_html |
| 1207 | coverage_html: |
| 1208 | lcov -c -d . -b . -o ${COV_INFO}.tests |
| 1209 | lcov -a ${COV_INFO}.initial -a ${COV_INFO}.tests -o ${COV_INFO}.total |
| 1210 | lcov -r ${COV_INFO}.total '/usr/*' '*/linktest/*' -o ${COV_INFO}.local |
| 1211 | genhtml ${COV_INFO}.local -o ${BUILD}/coverage |
Bill Richardson | d2d08b2 | 2014-07-08 16:31:40 -0700 | [diff] [blame] | 1212 | # Generate addtional coverage stats just for firmware subdir, because the stats |
| 1213 | # for the whole project don't include subdirectory summaries. This will print |
| 1214 | # the summary for just the firmware sources. |
Randall Spangler | 49cb0d3 | 2013-01-29 14:28:16 -0800 | [diff] [blame] | 1215 | lcov -r ${COV_INFO}.local '*/stub/*' -o ${COV_INFO}.nostub |
| 1216 | lcov -e ${COV_INFO}.nostub '${SRCDIR}/firmware/*' \ |
Randall Spangler | 59d7508 | 2013-01-23 09:29:54 -0800 | [diff] [blame] | 1217 | -o ${COV_INFO}.firmware |
| 1218 | |
| 1219 | .PHONY: coverage |
| 1220 | ifeq (${COV},) |
| 1221 | coverage: |
| 1222 | $(error Build coverage like this: make clean && COV=1 make) |
| 1223 | else |
| 1224 | coverage: coverage_init runtests coverage_html |
| 1225 | endif |
Bill Richardson | 1912bba | 2013-04-04 21:08:50 -0700 | [diff] [blame] | 1226 | |
| 1227 | # Include generated dependencies |
| 1228 | ALL_DEPS += ${ALL_OBJS:%.o=%.o.d} |
| 1229 | -include ${ALL_DEPS} |