forked from legatoproject/legato-af
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.hostTools
85 lines (71 loc) · 2.43 KB
/
Makefile.hostTools
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
74
75
76
77
78
79
80
81
82
83
84
85
# --------------------------------------------------------------------------------------------------
# Makefile used to build the Legato framework development host tools.
#
# Tools build output is placed under $(LEGATO_ROOT)/build/tools
#
# The tools get installed in $(LEGATO_ROOT)/bin
#
# This Makefile is intended to run as part of a larger build system.
#
# Copyright (C) Sierra Wireless Inc.
# --------------------------------------------------------------------------------------------------
export LEGATO_ROOT ?= $(CURDIR)
BUILD_DIR := $(LEGATO_ROOT)/build/tools
NINJA_SCRIPT := $(BUILD_DIR)/build.ninja
NINJA_FLAGS =
# Add the framework's bin directory to the PATH environment variable.
export PATH := $(PATH):$(LEGATO_ROOT)/bin
# Do not use clang by default.
USE_CLANG ?= 0
# Do not be verbose by default.
VERBOSE ?= 0
ifeq ($(VERBOSE),1)
NINJA_FLAGS += -v
endif
export HOST_ARCH := $(shell uname -m)
TOOLS_ARCH ?= $(HOST_ARCH)
# NOTE: Ninja is used to build the mk tools.
.PHONY: tools
tools: ninja $(NINJA_SCRIPT) symlinks mkPatch
ninja $(NINJA_FLAGS) -f $(NINJA_SCRIPT)
.PHONY: tool-messages
tool-messages: ninja $(NINJA_SCRIPT)
ninja $(NINJA_FLAGS) -f $(NINJA_SCRIPT) messages
# Generate the ninja build script.
$(NINJA_SCRIPT): framework/tools/mkTools/ninja-generator $(BUILD_DIR)
export TOOLS_ARCH=$(TOOLS_ARCH) && \
framework/tools/mkTools/ninja-generator
# ninja is called ninja-build on some distros (e.g., Fedora). Make sure ninja appears in the
# path as "ninja" by adding a symlink to the framework's bin directory if necessary.
.PHONY: ninja
ninja: bin
@echo -n "Using ninja installed at: " ;\
if ! which ninja ;\
then \
if which ninja-build ;\
then \
ln -s `which ninja-build` $(LEGATO_ROOT)/bin/ninja ;\
else \
echo "***ERROR: Ninja build tool not found." 1>&2 ;\
exit 1;\
fi;\
fi
SCRIPTS := $(wildcard framework/tools/scripts/*)
# Create a bunch of symlinks from the bin directory to the tools.
.PHONY: symlinks
symlinks: bin
ln -sf ../build/tools/mk bin/mk
ln -sf mk bin/mkcomp
ln -sf mk bin/mkexe
ln -sf mk bin/mkapp
ln -sf mk bin/mksys
ln -sf $(foreach script,$(SCRIPTS),../$(script)) bin/
ln -sf $(LEGATO_ROOT)/framework/tools/ifgen/ifgen bin/
ln -sf $(LEGATO_ROOT)/3rdParty/ima-support-tools/ima-sign.sh bin/
ln -sf $(LEGATO_ROOT)/3rdParty/ima-support-tools/ima-gen-keys.sh bin/
# Rule for creating directories.
$(BUILD_DIR) bin:
mkdir -p $@
.PHONY: mkPatch
mkPatch:
$(MAKE) -C framework/tools/mkPatch mkPatch