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