Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 5 | FWTOP := $(shell pwd) |
| 6 | LIBDIR = $(FWTOP)/lib |
| 7 | STUBDIR = $(FWTOP)/stub |
| 8 | TESTDIR = $(FWTOP)/linktest |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 9 | BUILD_ROOT := ${BUILD}/$(shell basename ${FWTOP}) |
Randall Spangler | 39f6611 | 2010-07-14 09:10:23 -0700 | [diff] [blame] | 10 | LIBS = $(FWLIB) # Firmware library must be self-contained |
| 11 | |
| 12 | # Disable rollback TPM when compiling locally, since otherwise |
| 13 | # load_kernel_test attempts to talk to the TPM. |
| 14 | CFLAGS += -DDISABLE_ROLLBACK_TPM |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 15 | |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 16 | INCLUDES = \ |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 17 | -I$(FWTOP)/include \ |
| 18 | -I$(LIBDIR)/include \ |
Randall Spangler | 3003c1d | 2010-05-27 09:20:11 -0700 | [diff] [blame] | 19 | -I$(LIBDIR)/cgptlib/include \ |
Randall Spangler | d0dae7a | 2010-06-21 18:25:31 -0700 | [diff] [blame] | 20 | -I$(LIBDIR)/cryptolib/include \ |
Randall Spangler | 39f6611 | 2010-07-14 09:10:23 -0700 | [diff] [blame] | 21 | -I$(LIBDIR)/tpm_lite/include \ |
Randall Spangler | d0dae7a | 2010-06-21 18:25:31 -0700 | [diff] [blame] | 22 | -I$(STUBDIR)/include |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 23 | |
Bill Richardson | 96ee63b | 2010-06-03 12:47:38 -0700 | [diff] [blame] | 24 | # find ./lib -iname '*.c' | sort |
| 25 | LIB_SRCS = \ |
| 26 | ./lib/cgptlib/cgptlib.c \ |
| 27 | ./lib/cgptlib/cgptlib_internal.c \ |
| 28 | ./lib/cgptlib/crc32.c \ |
| 29 | ./lib/cryptolib/padding.c \ |
| 30 | ./lib/cryptolib/rsa.c \ |
| 31 | ./lib/cryptolib/rsa_utility.c \ |
| 32 | ./lib/cryptolib/sha1.c \ |
| 33 | ./lib/cryptolib/sha2.c \ |
| 34 | ./lib/cryptolib/sha_utility.c \ |
Bill Richardson | 96ee63b | 2010-06-03 12:47:38 -0700 | [diff] [blame] | 35 | ./lib/rollback_index.c \ |
Randall Spangler | d183644 | 2010-06-10 09:59:04 -0700 | [diff] [blame] | 36 | ./lib/stateful_util.c \ |
Randall Spangler | 39f6611 | 2010-07-14 09:10:23 -0700 | [diff] [blame] | 37 | ./lib/tpm_lite/tlcl.c \ |
Gaurav Shah | 37dff84 | 2010-08-20 14:30:03 -0700 | [diff] [blame] | 38 | ./lib/utility.c \ |
Randall Spangler | d183644 | 2010-06-10 09:59:04 -0700 | [diff] [blame] | 39 | ./lib/vboot_common.c \ |
| 40 | ./lib/vboot_firmware.c \ |
| 41 | ./lib/vboot_kernel.c |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 42 | |
Bill Richardson | 96ee63b | 2010-06-03 12:47:38 -0700 | [diff] [blame] | 43 | STUB_SRCS = \ |
| 44 | ./stub/boot_device_stub.c \ |
Randall Spangler | 57c08f6 | 2010-06-08 12:53:11 -0700 | [diff] [blame] | 45 | ./stub/load_firmware_stub.c \ |
Randall Spangler | 39f6611 | 2010-07-14 09:10:23 -0700 | [diff] [blame] | 46 | ./stub/tpm_lite_stub.c \ |
Bill Richardson | 96ee63b | 2010-06-03 12:47:38 -0700 | [diff] [blame] | 47 | ./stub/utility_stub.c |
| 48 | |
Luigi Semenzato | f6ddd64 | 2010-06-24 08:11:24 -0700 | [diff] [blame] | 49 | ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} version.c |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 50 | |
Luigi Semenzato | f6ddd64 | 2010-06-24 08:11:24 -0700 | [diff] [blame] | 51 | test : $(FWLIB) update-version |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 52 | $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \ |
Randall Spangler | 39f6611 | 2010-07-14 09:10:23 -0700 | [diff] [blame] | 53 | $(TESTDIR)/main.c $(LIBS) |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 54 | |
Luigi Semenzato | f6ddd64 | 2010-06-24 08:11:24 -0700 | [diff] [blame] | 55 | # This is executed at every make, to see if anything has changed |
| 56 | update-version : |
| 57 | find \( -name '*.[ch]' -o -name 'Makefile*' \) -a \! -name version.c \ |
vbendeb | e548e85 | 2010-06-24 17:24:01 -0700 | [diff] [blame] | 58 | | sort | xargs cat | md5sum | cut -c 25-32 > \ |
| 59 | ${BUILD_ROOT}/x.tmp && \ |
| 60 | echo "char* VbootVersion = \"VBOOv=$$(cat ${BUILD_ROOT}/x.tmp)\";" > \ |
Luigi Semenzato | 416f681 | 2010-07-08 12:12:12 -0700 | [diff] [blame] | 61 | ${BUILD_ROOT}/version.tmp && \ |
| 62 | (cmp -s ${BUILD_ROOT}/version.tmp version.c || \ |
vbendeb | e548e85 | 2010-06-24 17:24:01 -0700 | [diff] [blame] | 63 | ( echo "** Updating version.c **" && \ |
Luigi Semenzato | 416f681 | 2010-07-08 12:12:12 -0700 | [diff] [blame] | 64 | cp ${BUILD_ROOT}/version.tmp version.c)) |
Luigi Semenzato | f6ddd64 | 2010-06-24 08:11:24 -0700 | [diff] [blame] | 65 | |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 66 | include ../common.mk |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 67 | |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 68 | $(FWLIB) : $(ALL_OBJS) |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 69 | rm -f $@ |
| 70 | ar qc $@ $^ |