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 | |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 5 | export FIRMWARE_ARCH |
| 6 | |
Gaurav Shah | 27bfc8b | 2010-02-17 14:19:24 -0800 | [diff] [blame] | 7 | export CC ?= gcc |
Bill Richardson | f1372d9 | 2010-06-11 09:15:55 -0700 | [diff] [blame] | 8 | export CXX ?= g++ |
Che-Liang Chiou | 440ad51 | 2011-01-27 10:23:51 +0800 | [diff] [blame] | 9 | ifeq ($(FIRMWARE_ARCH),) |
Chris Sosa | 9f1973e | 2011-01-26 18:54:57 -0800 | [diff] [blame^] | 10 | export CFLAGS = -Wall -Werror -DCHROMEOS_ENVIRONMENT |
Che-Liang Chiou | 440ad51 | 2011-01-27 10:23:51 +0800 | [diff] [blame] | 11 | else |
Chris Sosa | 9f1973e | 2011-01-26 18:54:57 -0800 | [diff] [blame^] | 12 | export CFLAGS = -Wall -Werror |
Che-Liang Chiou | 440ad51 | 2011-01-27 10:23:51 +0800 | [diff] [blame] | 13 | endif |
| 14 | |
Chris Sosa | 9f1973e | 2011-01-26 18:54:57 -0800 | [diff] [blame^] | 15 | ifeq (${DEBUG},) |
| 16 | CFLAGS += -O3 |
| 17 | else |
| 18 | CFLAGS += -O0 -g -DVBOOT_DEBUG |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 19 | endif |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 20 | |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 21 | ifeq (${DISABLE_NDEBUG},) |
| 22 | CFLAGS += -DNDEBUG |
| 23 | endif |
| 24 | |
Gaurav Shah | 7ca31f3 | 2010-02-16 19:04:11 -0800 | [diff] [blame] | 25 | export TOP = $(shell pwd) |
Randall Spangler | 620c38c | 2010-06-17 14:45:22 -0700 | [diff] [blame] | 26 | export FWDIR=$(TOP)/firmware |
Randall Spangler | d183644 | 2010-06-10 09:59:04 -0700 | [diff] [blame] | 27 | export HOSTDIR=$(TOP)/host |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 28 | ifeq ($(FIRMWARE_ARCH),) |
Randall Spangler | d0dae7a | 2010-06-21 18:25:31 -0700 | [diff] [blame] | 29 | export INCLUDES = -I$(FWDIR)/include -I$(FWDIR)/stub/include |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 30 | else |
| 31 | export INCLUDES = -I$(FWDIR)/include -I$(FWDIR)/arch/$(FIRMWARE_ARCH)/include |
| 32 | endif |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 33 | |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 34 | export BUILD = ${TOP}/build |
| 35 | export FWLIB = ${BUILD}/vboot_fw.a |
Che-Liang Chiou | 8967860 | 2010-11-09 08:33:36 +0800 | [diff] [blame] | 36 | export HOSTLIB = ${BUILD}/vboot_host.a |
Bill Richardson | 0b8f35c | 2010-05-26 09:18:38 -0700 | [diff] [blame] | 37 | |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 38 | ifeq ($(FIRMWARE_ARCH),) |
Randall Spangler | 39f6611 | 2010-07-14 09:10:23 -0700 | [diff] [blame] | 39 | SUBDIRS = firmware host utility cgpt tests tests/tpm_lite |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 40 | else |
| 41 | SUBDIRS = firmware |
| 42 | endif |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 43 | |
| 44 | all: |
Louis Yung-Chieh Lo | b31ddce | 2010-05-21 16:35:44 +0800 | [diff] [blame] | 45 | set -e; \ |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 46 | for d in $(shell find ${SUBDIRS} -name '*.c' -exec dirname {} \; |\ |
| 47 | sort -u); do \ |
| 48 | newdir=${BUILD}/$$d; \ |
| 49 | if [ ! -d $$newdir ]; then \ |
| 50 | mkdir -p $$newdir; \ |
| 51 | fi; \ |
Luigi Semenzato | 5896b96 | 2010-08-25 07:16:03 -0700 | [diff] [blame] | 52 | done; \ |
Che-Liang Chiou | 0a0e8d0 | 2010-11-30 09:30:45 +0800 | [diff] [blame] | 53 | [ -z "$(FIRMWARE_ARCH)" ] && make -C utility update_tlcl_structures; \ |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 54 | for i in $(SUBDIRS); do \ |
Louis Yung-Chieh Lo | b31ddce | 2010-05-21 16:35:44 +0800 | [diff] [blame] | 55 | make -C $$i; \ |
Gaurav Shah | 322536d | 2010-01-28 15:01:23 -0800 | [diff] [blame] | 56 | done |
| 57 | |
| 58 | clean: |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 59 | /bin/rm -rf ${BUILD} |
Bill Richardson | 371df8b | 2010-05-27 14:19:47 -0700 | [diff] [blame] | 60 | |
| 61 | install: |
| 62 | $(MAKE) -C utility install |
Bill Richardson | f1372d9 | 2010-06-11 09:15:55 -0700 | [diff] [blame] | 63 | $(MAKE) -C cgpt install |
Gaurav Shah | e642198 | 2010-06-03 07:49:32 -0700 | [diff] [blame] | 64 | |
| 65 | runtests: |
| 66 | $(MAKE) -C tests runtests |
Luigi Semenzato | 18b814d | 2010-07-08 17:17:02 -0700 | [diff] [blame] | 67 | |
| 68 | rbtest: |
| 69 | $(MAKE) -C tests rbtest |