blob: ac21ba8e935c87c87c35a929bcfee22fab3a396a (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# Copyright 2015 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.
CC ?= gcc
PKG_CONFIG ?= pkg-config
PROGRAMS := gsctool
LIBS :=
LFLAGS :=
CFLAGS := -std=gnu99 \
-g \
-Wall \
-Werror \
-Wpointer-arith \
-Wcast-align \
-Wcast-qual \
-Wundef \
-Wsign-compare \
-Wredundant-decls \
-Wmissing-declarations
ifneq ($(DEBUG),)
CFLAGS += -O0
else
CFLAGS += -O3
endif
#
# Add libusb-1.0 required flags
#
LIBS += $(shell $(PKG_CONFIG) --libs libusb-1.0)
CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0)
CFLAGS += -I../../include -I../../util -I../../fuzz -I../../test
VPATH = ../../util
BOARD := cr50
LIBS_g = $(shell $(PKG_CONFIG) --libs libcrypto)
CFLAGS_g = $(shell $(PKG_CONFIG) --cflags libcrypto)
CFLAGS_g += -I../../board/cr50 -I ../../chip/g
LIBS_common = -lfmap
all: $(PROGRAMS)
GSCTOOL_SOURCES := gsctool.c desc_parser.c usb_if.c verify_ro.c
GSCTOOL_OBJS := $(patsubst %.c,%.o,$(GSCTOOL_SOURCES))
DEPS := $(patsubst %.c,%.d,$(GSCTOOL_SOURCES))
# chip/g updater
gsctool: $(GSCTOOL_OBJS) Makefile
$(CC) $(GSCTOOL_OBJS) $(LFLAGS) $(LIBS) $(LIBS_g) -o $@
%.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_g) -c -MMD -MF $(basename $@).d -o $@ $<
gsctool.o: generated_version.h
.PHONY: clean
generated_version.h: $(GSCTOOL_SOURCES)
# Make sure ${BOARD} not set to anything when invoking getversion.sh,
# as even when building with Cr50 enabled, other directories do not
# matter for gsctool.
@(cd ../../; BOARD= util/getversion.sh) > $@
clean:
rm -rf $(PROGRAMS) *~ *.o *.d dp generated_version.h
parser_debug: desc_parser.c
gcc -g -O0 -DTEST_PARSER desc_parser.c -o dp
-include $(DEPS)
|