OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 LIBNAME = vboot_fw.a | |
6 | |
7 CC ?= gcc | |
8 CFLAGS = -Wall -DNDEBUG -O3 -Werror | |
9 | |
10 FWTOP := $(shell pwd) | 5 FWTOP := $(shell pwd) |
11 LIBDIR = $(FWTOP)/lib | 6 LIBDIR = $(FWTOP)/lib |
12 STUBDIR = $(FWTOP)/stub | 7 STUBDIR = $(FWTOP)/stub |
13 TESTDIR = $(FWTOP)/linktest | 8 TESTDIR = $(FWTOP)/linktest |
| 9 BUILD_ROOT := ${BUILD}/$(shell basename ${FWTOP}) |
14 | 10 |
15 INC = \ | 11 INCLUDES = \ |
16 -I$(FWTOP)/include \ | 12 -I$(FWTOP)/include \ |
17 -I$(LIBDIR)/include \ | 13 -I$(LIBDIR)/include \ |
18 -I$(LIBDIR)/cgptlib/include \ | 14 -I$(LIBDIR)/cgptlib/include \ |
19 -I$(LIBDIR)/cryptolib/include | 15 -I$(LIBDIR)/cryptolib/include |
20 | 16 |
21 | 17 |
22 # find ./lib -iname '*.c' | sort | 18 # find ./lib -iname '*.c' | sort |
23 LIB_SRCS = \ | 19 LIB_SRCS = \ |
24 ./lib/cgptlib/cgptlib.c \ | 20 ./lib/cgptlib/cgptlib.c \ |
25 ./lib/cgptlib/cgptlib_internal.c \ | 21 ./lib/cgptlib/cgptlib_internal.c \ |
26 ./lib/cgptlib/crc32.c \ | 22 ./lib/cgptlib/crc32.c \ |
27 ./lib/cryptolib/padding.c \ | 23 ./lib/cryptolib/padding.c \ |
28 ./lib/cryptolib/rsa.c \ | 24 ./lib/cryptolib/rsa.c \ |
29 ./lib/cryptolib/rsa_utility.c \ | 25 ./lib/cryptolib/rsa_utility.c \ |
30 ./lib/cryptolib/sha1.c \ | 26 ./lib/cryptolib/sha1.c \ |
31 ./lib/cryptolib/sha2.c \ | 27 ./lib/cryptolib/sha2.c \ |
32 ./lib/cryptolib/sha_utility.c \ | 28 ./lib/cryptolib/sha_utility.c \ |
33 ./lib/firmware_image_fw.c \ | 29 ./lib/firmware_image_fw.c \ |
34 ./lib/kernel_image_fw.c \ | 30 ./lib/kernel_image_fw.c \ |
35 ./lib/load_firmware_fw.c \ | 31 ./lib/load_firmware_fw.c \ |
36 ./lib/load_kernel_fw.c \ | 32 ./lib/load_kernel_fw.c \ |
37 ./lib/rollback_index.c \ | 33 ./lib/rollback_index.c \ |
38 ./lib/stateful_util.c \ | 34 ./lib/stateful_util.c \ |
39 ./lib/vboot_common.c \ | 35 ./lib/vboot_common.c \ |
40 ./lib/vboot_firmware.c \ | 36 ./lib/vboot_firmware.c \ |
41 ./lib/vboot_kernel.c | 37 ./lib/vboot_kernel.c |
42 | 38 |
43 LIB_OBJS = $(LIB_SRCS:%.c=%.o) | |
44 | |
45 # find ./stub -iname '*.c' | sort | |
46 STUB_SRCS = \ | 39 STUB_SRCS = \ |
47 ./stub/boot_device_stub.c \ | 40 ./stub/boot_device_stub.c \ |
48 ./stub/load_firmware_stub.c \ | 41 ./stub/load_firmware_stub.c \ |
49 ./stub/tlcl.c \ | 42 ./stub/tlcl.c \ |
50 ./stub/utility_stub.c | 43 ./stub/utility_stub.c |
51 | 44 |
52 STUB_OBJS = $(STUB_SRCS:%.c=%.o) | 45 ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS} |
53 | 46 |
| 47 test : $(FWLIB) |
| 48 $(CC) $(CFLAGS) $(INCLUDES) -o $(BUILD_ROOT)/a.out \ |
| 49 $(TESTDIR)/main.c $(FWLIB) |
54 | 50 |
55 test : $(LIBNAME) | 51 include ../common.mk |
56 » $(CC) $(CFLAGS) $(INC) -o $(TESTDIR)/a.out $(TESTDIR)/main.c $(LIBNAME) | |
57 | 52 |
58 $(LIBNAME) : $(LIB_OBJS) $(STUB_OBJS) | 53 $(FWLIB) : $(ALL_OBJS) |
59 rm -f $@ | 54 rm -f $@ |
60 ar qc $@ $^ | 55 ar qc $@ $^ |
61 | |
62 %o : %c | |
63 $(CC) $(CFLAGS) $(INC) -c -o $@ $< | |
64 | |
65 clean: FORCE | |
66 rm -f $(LIBNAME) $(LIB_OBJS) $(STUB_OBJS) $(TESTDIR)/a.out | |
67 | |
68 FORCE: | |
69 | |
70 | |
71 .PHONY: FORCE | |
OLD | NEW |