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