summaryrefslogtreecommitdiff
path: root/cros_ec/Makefile
blob: 8653fa5fb89515a8faf04ebed27deaa56cddb05b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

CROS_EC_TOP := $(shell pwd)
LIBDIR = $(CROS_EC_TOP)/lib
STUBDIR = $(CROS_EC_TOP)/chip_stub
TESTDIR = $(CROS_EC_TOP)/test
BUILD_ROOT := ${BUILD}/$(shell basename ${CROS_EC_TOP})
LIBS = $(CROS_EC_LIB)  # Firmware library must be self-contained

INCLUDES = \
	-I$(CROS_EC_TOP)/include \
	-I$(LIBDIR)/include

ifeq ($(FIRMWARE_ARCH),)
INCLUDES += -I$(STUBDIR)/include
else
INCLUDES += -I$(FWDIR)/arch/$(FIRMWARE_ARCH)/include
endif

# find ./lib -iname '*.c' | sort
LIB_SRCS = \
	./lib/ec_console.c \
	./lib/ec_host_command.c

LIB_OBJS = $(LIB_SRCS:%.c=${BUILD_ROOT}/%.o)

STUB_SRCS = \
	./chip_stub/ec_os.c \
	./chip_stub/ec_uart.c

STUB_OBJS = $(STUB_SRCS:%.c=${BUILD_ROOT}/%.o)

ALL_SRCS = ${LIB_SRCS} ${STUB_SRCS}

ifeq ($(FIRMWARE_ARCH),)
all : $(CROS_EC_LIB) $(CHIP_STUB_LIB)
else
all : $(CROS_EC_LIB)
endif

include ../common.mk

$(CROS_EC_LIB) : $(LIB_OBJS)
	rm -f $@
	ar qc $@ $^

$(CHIP_STUB_LIB) : $(STUB_OBJS)
	rm -f $@
	ar qc $@ $^