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