Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [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 | |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 5 | TOP ?= ../ |
Gaurav Shah | 431b988 | 2010-02-12 15:54:37 -0800 | [diff] [blame] | 6 | CC ?= gcc |
Gaurav Shah | 23a2f3a | 2010-02-26 15:09:43 -0800 | [diff] [blame] | 7 | CXX ?= g++ |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 8 | INCLUDES += -I./include \ |
Gaurav Shah | f666780 | 2010-05-28 11:47:33 -0700 | [diff] [blame] | 9 | -I$(FWDIR)/lib/include \ |
Randall Spangler | 3003c1d | 2010-05-27 09:20:11 -0700 | [diff] [blame] | 10 | -I$(FWDIR)/lib/cgptlib/include \ |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 11 | -I$(FWDIR)/lib/cryptolib/include \ |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 12 | -I../misclibs/include \ |
| 13 | -I../vfirmware/include\ |
Hung-Te Lin | 262668f | 2010-05-28 10:32:02 -0700 | [diff] [blame] | 14 | -I../vboot_firmware/include\ |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 15 | -I../vkernel/include |
| 16 | CFLAGS ?= -Wall -DNDEBUG -O3 -Werror $(INCLUDES) |
| 17 | LIBS = $(TOP)/misclibs/file_keys.o \ |
| 18 | $(TOP)/misclibs/signature_digest.o \ |
| 19 | $(TOP)/vfirmware/firmware_image.o \ |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 20 | $(TOP)/vkernel/kernel_image.o |
Louis Yung-Chieh Lo | b31ddce | 2010-05-21 16:35:44 +0800 | [diff] [blame] | 21 | SUBDIRS = cgpt |
Gaurav Shah | 431b988 | 2010-02-12 15:54:37 -0800 | [diff] [blame] | 22 | |
Bill Richardson | 5374a06 | 2010-06-02 08:23:30 -0700 | [diff] [blame] | 23 | DESTDIR ?= /opt/bin |
| 24 | |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 25 | TARGET_BINS = dumpRSAPublicKey \ |
Gaurav Shah | ed9c96a | 2010-03-30 18:56:07 -0700 | [diff] [blame] | 26 | firmware_utility \ |
Hung-Te Lin | 262668f | 2010-05-28 10:32:02 -0700 | [diff] [blame] | 27 | gbb_utility \ |
Gaurav Shah | ed9c96a | 2010-03-30 18:56:07 -0700 | [diff] [blame] | 28 | kernel_utility \ |
| 29 | signature_digest_utility \ |
| 30 | verify_data |
Randall Spangler | b8976b6 | 2010-06-02 16:38:33 -0700 | [diff] [blame] | 31 | # Note: load_kernel_test is not part of TARGET_BINS, since it's a |
| 32 | # temporary test. |
Gaurav Shah | ed9c96a | 2010-03-30 18:56:07 -0700 | [diff] [blame] | 33 | |
Louis Yung-Chieh Lo | b31ddce | 2010-05-21 16:35:44 +0800 | [diff] [blame] | 34 | all: $(TARGET_BINS) subdirs |
| 35 | |
| 36 | .PHONY: subdirs |
| 37 | subdirs: |
| 38 | set -e; \ |
| 39 | for i in $(SUBDIRS); do \ |
Bill Richardson | 5374a06 | 2010-06-02 08:23:30 -0700 | [diff] [blame] | 40 | $(MAKE) -C $$i $(MAKECMDGOALS); \ |
Louis Yung-Chieh Lo | b31ddce | 2010-05-21 16:35:44 +0800 | [diff] [blame] | 41 | done |
Gaurav Shah | ed9c96a | 2010-03-30 18:56:07 -0700 | [diff] [blame] | 42 | |
Gaurav Shah | 7ca31f3 | 2010-02-16 19:04:11 -0800 | [diff] [blame] | 43 | dumpRSAPublicKey: dumpRSAPublicKey.c |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 44 | $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ -lcrypto |
Gaurav Shah | cb3d22e | 2010-03-04 10:22:36 -0800 | [diff] [blame] | 45 | |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 46 | firmware_utility: firmware_utility.cc $(LIBS) $(FWLIB) |
Gaurav Shah | f5564fa | 2010-03-02 15:40:01 -0800 | [diff] [blame] | 47 | $(CXX) $(CFLAGS) $(INCLUDES) -ggdb -D__STDC_LIMIT_MACROS $< \ |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 48 | -o $@ $(LIBS) $(FWLIB) -lcrypto |
Gaurav Shah | 1f81a6f | 2010-02-06 14:34:31 -0800 | [diff] [blame] | 49 | |
Hung-Te Lin | 262668f | 2010-05-28 10:32:02 -0700 | [diff] [blame] | 50 | gbb_utility: gbb_utility.cc |
| 51 | $(CXX) -DWITH_UTIL_MAIN $(CFLAGS) $(INCLUDES) $< -o $@ |
| 52 | |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 53 | kernel_utility: kernel_utility.cc $(LIBS) $(FWLIB) |
Gaurav Shah | 80d129b | 2010-03-03 17:58:43 -0800 | [diff] [blame] | 54 | $(CXX) $(CFLAGS) $(INCLUDES) -ggdb -D__STDC_LIMIT_MACROS $< \ |
Bill Richardson | 371df8b | 2010-05-27 14:19:47 -0700 | [diff] [blame] | 55 | -o $@ $(LIBS) $(FWLIB) -lcrypto |
Gaurav Shah | 80d129b | 2010-03-03 17:58:43 -0800 | [diff] [blame] | 56 | |
Randall Spangler | 3dcf9dc | 2010-06-02 12:46:17 -0700 | [diff] [blame] | 57 | load_kernel_test: load_kernel_test.c $(LIBS) $(FWLIB) |
| 58 | $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) $(FWLIB) -lcrypto |
| 59 | |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 60 | signature_digest_utility: signature_digest_utility.c $(LIBS) $(FWLIB) |
| 61 | $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) $(FWLIB) -lcrypto |
Gaurav Shah | 431b988 | 2010-02-12 15:54:37 -0800 | [diff] [blame] | 62 | |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 63 | verify_data: verify_data.c $(LIBS) $(FWLIB) |
| 64 | $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) $(FWLIB) -lcrypto |
Gaurav Shah | 431b988 | 2010-02-12 15:54:37 -0800 | [diff] [blame] | 65 | |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 66 | clean: |
Louis Yung-Chieh Lo | b31ddce | 2010-05-21 16:35:44 +0800 | [diff] [blame] | 67 | set -e; \ |
| 68 | for i in $(SUBDIRS); do \ |
| 69 | $(MAKE) -C $$i clean; \ |
| 70 | done |
Gaurav Shah | fc70d72 | 2010-03-31 13:26:55 -0700 | [diff] [blame] | 71 | rm -f $(TARGET_BINS) |
Bill Richardson | 371df8b | 2010-05-27 14:19:47 -0700 | [diff] [blame] | 72 | |
Bill Richardson | 5374a06 | 2010-06-02 08:23:30 -0700 | [diff] [blame] | 73 | install: $(TARGET_BINS) subdirs |
Bill Richardson | 371df8b | 2010-05-27 14:19:47 -0700 | [diff] [blame] | 74 | mkdir -p $(DESTDIR) |
Bill Richardson | 5374a06 | 2010-06-02 08:23:30 -0700 | [diff] [blame] | 75 | cp -f $(TARGET_BINS) $(DESTDIR) |
| 76 | chmod a+rx $(patsubst %,$(DESTDIR)/%,$(TARGET_BINS)) |