blob: 3db4c2a0a2234ea140b38f909e4f35b49e9e3dca [file] [log] [blame]
Bill Richardson0b8f35c2010-05-26 09:18:38 -07001# 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
5LIBNAME = vboot_fw.a
6
7CC ?= gcc
8CFLAGS = -Wall -DNDEBUG -O3 -Werror
9
10FWTOP := $(shell pwd)
11LIBDIR = $(FWTOP)/lib
12STUBDIR = $(FWTOP)/stub
13TESTDIR = $(FWTOP)/linktest
14
15INC = \
16 -I$(FWTOP)/include \
17 -I$(LIBDIR)/include \
Randall Spangler3003c1d2010-05-27 09:20:11 -070018 -I$(LIBDIR)/cgptlib/include \
Bill Richardson0b8f35c2010-05-26 09:18:38 -070019 -I$(LIBDIR)/cryptolib/include
20
21
Bill Richardson96ee63b2010-06-03 12:47:38 -070022# find ./lib -iname '*.c' | sort
23LIB_SRCS = \
24 ./lib/cgptlib/cgptlib.c \
25 ./lib/cgptlib/cgptlib_internal.c \
26 ./lib/cgptlib/crc32.c \
27 ./lib/cryptolib/padding.c \
28 ./lib/cryptolib/rsa.c \
29 ./lib/cryptolib/rsa_utility.c \
30 ./lib/cryptolib/sha1.c \
31 ./lib/cryptolib/sha2.c \
32 ./lib/cryptolib/sha_utility.c \
33 ./lib/firmware_image_fw.c \
34 ./lib/kernel_image_fw.c \
35 ./lib/load_kernel_fw.c \
36 ./lib/rollback_index.c \
Randall Spanglere414b082010-06-04 14:21:59 -070037 ./lib/stateful_util.c
Bill Richardson0b8f35c2010-05-26 09:18:38 -070038
Bill Richardson96ee63b2010-06-03 12:47:38 -070039LIB_OBJS = $(LIB_SRCS:%.c=%.o)
40
41# find ./stub -iname '*.c' | sort
42STUB_SRCS = \
43 ./stub/boot_device_stub.c \
Randall Spanglere414b082010-06-04 14:21:59 -070044 ./stub/tlcl.c \
Bill Richardson96ee63b2010-06-03 12:47:38 -070045 ./stub/utility_stub.c
46
47STUB_OBJS = $(STUB_SRCS:%.c=%.o)
Bill Richardson0b8f35c2010-05-26 09:18:38 -070048
49
50test : $(LIBNAME)
51 $(CC) $(CFLAGS) $(INC) -o $(TESTDIR)/a.out $(TESTDIR)/main.c $(LIBNAME)
52
53$(LIBNAME) : $(LIB_OBJS) $(STUB_OBJS)
54 rm -f $@
55 ar qc $@ $^
56
57%o : %c
58 $(CC) $(CFLAGS) $(INC) -c -o $@ $<
59
60clean: FORCE
61 rm -f $(LIBNAME) $(LIB_OBJS) $(STUB_OBJS) $(TESTDIR)/a.out
62
63FORCE:
64
65
66.PHONY: FORCE