-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathutils.mk
76 lines (66 loc) · 2.13 KB
/
utils.mk
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
# --------------------------------------------------------------------------------------------------
# Shared Makefile features for building the Legato framework and tools.
#
# Copyright (C) Sierra Wireless Inc.
# --------------------------------------------------------------------------------------------------
# Verbosity
L := @printf " %-9s %s\n"
ifeq ($(shell whoami),jenkins)
# Make it always verbose if building under Jenkins
V := 1
endif
ifeq ($(LEGATO_TARGET_ARCH),armv7hf)
MKSYS_FLAGS += --cflags="-mfpu=neon -mfloat-abi=hard" --ldflags="-mfpu=neon -mfloat-abi=hard"
MKEXE_FLAGS += --cflags="-mfpu=neon -mfloat-abi=hard" --ldflags="-mfpu=neon -mfloat-abi=hard"
MKAPP_FLAGS += --cflags="-mfpu=neon -mfloat-abi=hard" --ldflags="-mfpu=neon -mfloat-abi=hard"
endif
ifeq ($(or $(V),$(VERBOSE)),1)
Q :=
V := 1
VERBOSE := 1
MKSYS_FLAGS += -v
MKEXE_FLAGS += -v
MKAPP_FLAGS += -v
NINJA_FLAGS += -v
else
Q := @
V := 0
VERBOSE := 0
endif
export V
export VERBOSE
# Helper to suppress output in non-verbose mode
VOUTPUT := $(if $(filter 1,$(V)),,> /dev/null)
ifeq ($(LE_CONFIG_USE_CCACHE),y)
ifeq ($(LEGATO_JOBS),)
# If ccache is enabled, we can raise the number of concurrent
# jobs as it likely to get objects from cache, therefore not
# consuming much CPU.
LEGATO_JOBS := $(shell echo $$((4 * $$(nproc))))
endif # end LEGATO_JOBS
endif # end LE_CONFIG_USE_CCACHE
# Set flags for the number of concurrent jobs
ifneq ($(LEGATO_JOBS),)
ifeq ($(V),1)
$(info Job Count: $(LEGATO_JOBS))
endif
MKSYS_FLAGS += -j $(LEGATO_JOBS)
MKEXE_FLAGS += -j $(LEGATO_JOBS)
MKAPP_FLAGS += -j $(LEGATO_JOBS)
NINJA_FLAGS += -j $(LEGATO_JOBS)
export LEGATO_JOBS
endif
# Convert KConfig y/m/n to boolean 1/0
define k2b
$(if $(filter y,$(1)),1,$(if $(filter m,$(1)),1,0))
endef
# Convert boolean 0/1 to KConfig y/n
define b2k
$(if $(filter 1,$(1)),y,n)
endef
# Convert boolean 1/0 to KConfig y/n (invert the value during conversion)
define !b2k
$(if $(filter 1,$(1)),n,y)
endef
# Get host GCC version
GCC_VERSION := $(shell gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')