summaryrefslogtreecommitdiff
path: root/cros_ec/Makefile
blob: 39e06d26b410da57ac93b448b8b779f19d6212a3 (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
52
53
54
55
56
57
58
59
# 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$(LIBDIR)/include \
		-I$(TOP)

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

CORE_SRCS = \
	main.c

# find ./lib -iname '*.c' | sort

CORE_OBJS = $(CORE_SRCS:%.c=${BUILD_ROOT}/%.o)

LIB_SRCS = \
	./lib/ec_console.c \
	./lib/ec_host_command.c \
	./lib/ec_keyboard.c

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

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

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

ALL_SRCS = ${CORE_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) : $(CORE_OBJS) $(LIB_OBJS)
	rm -f $@
	ar qc $@ $^

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