blob: b7e9ded38f7f7a61c0f5e04d76e65f388b39b610 [file] [log] [blame]
Gaurav Shah322536d2010-01-28 15:01:23 -08001# 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
Gaurav Shahfc70d722010-03-31 13:26:55 -07005TOP ?= ../
Gaurav Shah431b9882010-02-12 15:54:37 -08006CC ?= gcc
Gaurav Shah23a2f3a2010-02-26 15:09:43 -08007CXX ?= g++
Gaurav Shahfc70d722010-03-31 13:26:55 -07008INCLUDES += -I./include \
Gaurav Shahf6667802010-05-28 11:47:33 -07009 -I$(FWDIR)/lib/include \
Randall Spangler3003c1d2010-05-27 09:20:11 -070010 -I$(FWDIR)/lib/cgptlib/include \
Bill Richardson0b8f35c2010-05-26 09:18:38 -070011 -I$(FWDIR)/lib/cryptolib/include \
Gaurav Shahfc70d722010-03-31 13:26:55 -070012 -I../misclibs/include \
13 -I../vfirmware/include\
Hung-Te Lin262668f2010-05-28 10:32:02 -070014 -I../vboot_firmware/include\
Gaurav Shahfc70d722010-03-31 13:26:55 -070015 -I../vkernel/include
16CFLAGS ?= -Wall -DNDEBUG -O3 -Werror $(INCLUDES)
17LIBS = $(TOP)/misclibs/file_keys.o \
18 $(TOP)/misclibs/signature_digest.o \
19 $(TOP)/vfirmware/firmware_image.o \
Bill Richardson0b8f35c2010-05-26 09:18:38 -070020 $(TOP)/vkernel/kernel_image.o
Louis Yung-Chieh Lob31ddce2010-05-21 16:35:44 +080021SUBDIRS = cgpt
Gaurav Shah431b9882010-02-12 15:54:37 -080022
Bill Richardson5374a062010-06-02 08:23:30 -070023DESTDIR ?= /opt/bin
24
Gaurav Shahfc70d722010-03-31 13:26:55 -070025TARGET_BINS = dumpRSAPublicKey \
Gaurav Shahed9c96a2010-03-30 18:56:07 -070026 firmware_utility \
Hung-Te Lin262668f2010-05-28 10:32:02 -070027 gbb_utility \
Gaurav Shahed9c96a2010-03-30 18:56:07 -070028 kernel_utility \
29 signature_digest_utility \
30 verify_data
Randall Spanglerb8976b62010-06-02 16:38:33 -070031# Note: load_kernel_test is not part of TARGET_BINS, since it's a
32# temporary test.
Gaurav Shahed9c96a2010-03-30 18:56:07 -070033
Louis Yung-Chieh Lob31ddce2010-05-21 16:35:44 +080034all: $(TARGET_BINS) subdirs
35
36.PHONY: subdirs
37subdirs:
38 set -e; \
39 for i in $(SUBDIRS); do \
Bill Richardson5374a062010-06-02 08:23:30 -070040 $(MAKE) -C $$i $(MAKECMDGOALS); \
Louis Yung-Chieh Lob31ddce2010-05-21 16:35:44 +080041 done
Gaurav Shahed9c96a2010-03-30 18:56:07 -070042
Gaurav Shah7ca31f32010-02-16 19:04:11 -080043dumpRSAPublicKey: dumpRSAPublicKey.c
Gaurav Shahfc70d722010-03-31 13:26:55 -070044 $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ -lcrypto
Gaurav Shahcb3d22e2010-03-04 10:22:36 -080045
Bill Richardson0b8f35c2010-05-26 09:18:38 -070046firmware_utility: firmware_utility.cc $(LIBS) $(FWLIB)
Gaurav Shahf5564fa2010-03-02 15:40:01 -080047 $(CXX) $(CFLAGS) $(INCLUDES) -ggdb -D__STDC_LIMIT_MACROS $< \
Bill Richardson0b8f35c2010-05-26 09:18:38 -070048 -o $@ $(LIBS) $(FWLIB) -lcrypto
Gaurav Shah1f81a6f2010-02-06 14:34:31 -080049
Hung-Te Lin262668f2010-05-28 10:32:02 -070050gbb_utility: gbb_utility.cc
51 $(CXX) -DWITH_UTIL_MAIN $(CFLAGS) $(INCLUDES) $< -o $@
52
Bill Richardson0b8f35c2010-05-26 09:18:38 -070053kernel_utility: kernel_utility.cc $(LIBS) $(FWLIB)
Gaurav Shah80d129b2010-03-03 17:58:43 -080054 $(CXX) $(CFLAGS) $(INCLUDES) -ggdb -D__STDC_LIMIT_MACROS $< \
Bill Richardson371df8b2010-05-27 14:19:47 -070055 -o $@ $(LIBS) $(FWLIB) -lcrypto
Gaurav Shah80d129b2010-03-03 17:58:43 -080056
Randall Spangler3dcf9dc2010-06-02 12:46:17 -070057load_kernel_test: load_kernel_test.c $(LIBS) $(FWLIB)
58 $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) $(FWLIB) -lcrypto
59
Bill Richardson0b8f35c2010-05-26 09:18:38 -070060signature_digest_utility: signature_digest_utility.c $(LIBS) $(FWLIB)
61 $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) $(FWLIB) -lcrypto
Gaurav Shah431b9882010-02-12 15:54:37 -080062
Bill Richardson0b8f35c2010-05-26 09:18:38 -070063verify_data: verify_data.c $(LIBS) $(FWLIB)
64 $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) $(FWLIB) -lcrypto
Gaurav Shah431b9882010-02-12 15:54:37 -080065
Gaurav Shah322536d2010-01-28 15:01:23 -080066clean:
Louis Yung-Chieh Lob31ddce2010-05-21 16:35:44 +080067 set -e; \
68 for i in $(SUBDIRS); do \
69 $(MAKE) -C $$i clean; \
70 done
Gaurav Shahfc70d722010-03-31 13:26:55 -070071 rm -f $(TARGET_BINS)
Bill Richardson371df8b2010-05-27 14:19:47 -070072
Bill Richardson5374a062010-06-02 08:23:30 -070073install: $(TARGET_BINS) subdirs
Bill Richardson371df8b2010-05-27 14:19:47 -070074 mkdir -p $(DESTDIR)
Bill Richardson5374a062010-06-02 08:23:30 -070075 cp -f $(TARGET_BINS) $(DESTDIR)
76 chmod a+rx $(patsubst %,$(DESTDIR)/%,$(TARGET_BINS))