forked from efidroid/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.mk
85 lines (76 loc) · 2.47 KB
/
main.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
77
78
79
80
81
82
83
84
85
#
# Copyright (C) 2016 The EFIDroid Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Only use EFIDROID_BUILD_SHELL to wrap around bash.
# DO NOT use other shells such as zsh.
ifdef EFIDROID_BUILD_SHELL
SHELL := $(EFIDROID_BUILD_SHELL)
else
# Use bash, not whatever shell somebody has installed as /bin/sh
SHELL := /bin/bash
endif
export EFIDROID_MAKE := $(MAKE)
export EFIDROID_SHELL := $(SHELL)
# enable GCC colors by default (if supported)
export GCC_COLORS ?= 1
# add build/tools to path to force python2
export PATH := $(PWD)/build/tools:$(PATH)
.PHONY: $(MAKECMDGOALS) all
$(MAKECMDGOALS) all: makeforward makeforward_pipes
@python ./build/core/configure.py
@echo -n "" > out/buildtime_variables.sh
@echo -n "" > out/buildtime_variables.py
@ # log start time
@start_time=$$(date +"%s"); \
\
# run build \
if [ "$(DEVICEID)" == "" ];then \
$(MAKE) -f out/build_host.mk $(MAKECMDGOALS); \
else \
$(MAKE) -f out/build_$(subst /,-,$(DEVICEID)).mk $(MAKECMDGOALS); \
fi; \
\
# compute and show build time \
ret=$$?; \
end_time=$$(date +"%s"); \
tdiff=$$(($$end_time-$$start_time)); \
hours=$$(($$tdiff / 3600 )); \
mins=$$((($$tdiff % 3600) / 60)); \
secs=$$(($$tdiff % 60)); \
echo; \
if [ $$ret -eq 0 ] ; then \
echo -n -e "#### make completed successfully "; \
else \
echo -n -e "#### make failed to build some targets "; \
fi; \
if [ $$hours -gt 0 ] ; then \
printf "(%02g:%02g:%02g (hh:mm:ss))" $$hours $$mins $$secs; \
elif [ $$mins -gt 0 ] ; then \
printf "(%02g:%02g (mm:ss))" $$mins $$secs; \
elif [ $$secs -gt 0 ] ; then \
printf "(%s seconds)" $$secs; \
fi; \
echo -e " ####"; \
echo; \
exit $$ret;
# MAKEFORWARD
out/host/makeforward: build/tools/makeforward.c
@mkdir -p out/host
@gcc -Wall -Wextra -Wshadow -Werror $< -o $@
makeforward: out/host/makeforward
# MAKEFORWARD_PIPES
out/host/makeforward_pipes: build/tools/makeforward_pipes.c
@mkdir -p out/host
@gcc -Wall -Wextra -Wshadow -Werror $< -o $@
makeforward_pipes: out/host/makeforward_pipes