blob: e11daf18f10962e67f01f7a2259bf144d5ea011b (
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# opkhelper
# lib/buildsystem/kbuild
# Build system plugin for kbuild.
#
# Copyright (C) 2012 Patrick "P. J." McDermott
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
[ "x${_OH_BUILDSYSTEM_KBUILD_SM+set}" = 'xset' ] && return 0
_OH_BUILDSYSTEM_KBUILD_SM=1
_oh_kbuild_can_configure()
{
[ -d "${_OH_BUILDSYSTEM_SOURCE_DIR}/scripts/kconfig" -a \
-r "${_OH_BUILDSYSTEM_SOURCE_DIR}/Makefile" ]
}
_oh_kbuild_configure()
{
return 0
}
_oh_kbuild_can_build()
{
_oh_kbuild_can_configure
}
_oh_kbuild_build()
{
_oh_kbuild_update_target '' "${@}"
}
_oh_kbuild_can_clean()
{
_oh_kbuild_can_configure
}
_oh_kbuild_clean()
{
_oh_kbuild_update_target 'clean' "${@}"
}
_oh_kbuild_can_test()
{
return 1
}
_oh_kbuild_can_install()
{
_oh_kbuild_can_configure
}
_oh_kbuild_install()
{
# BusyBox uses CONFIG_PREFIX. Linux is, of course, different.
_oh_kbuild_update_target 'install' \
"CONFIG_PREFIX=${_OH_BUILDSYSTEM_DESTDIR}" "${@}"
}
_oh_kbuild_update_target()
{
local target=
local arch=
local rc=
target="${1}"
shift
if ! arch="$(oh_buildsystem_arch "${OPK_HOST_ARCH}" 'kbuild')"
then
return 1
fi
mkdir -p "${_OH_BUILDSYSTEM_BUILD_DIR}"
cd "${_OH_BUILDSYSTEM_BUILD_DIR}"
if [ "x${_OH_BUILDSYSTEM_BUILD_TARGET+set}" = 'xset' ]; then
make ARCH="${arch}" CROSS_COMPILE="${OPK_TOOL_PREFIX}" \
"${@}" "${_OH_BUILDSYSTEM_BUILD_TARGET}"
rc=${?}
elif [ "x${target+set}" = 'xset' ]; then
make ARCH="${arch}" CROSS_COMPILE="${OPK_TOOL_PREFIX}" \
"${@}" "${target}"
rc=${?}
else
make ARCH="${arch}" CROSS_COMPILE="${OPK_TOOL_PREFIX}" \
"${@}"
rc=${?}
fi
cd "${_OH_BUILDSYSTEM_WORK_AREA}"
return ${rc}
}
_oh_kbuild_testarch()
{
local arch=
local rc=
arch="${1}"
mkdir -p "${_OH_BUILDSYSTEM_BUILD_DIR}"
cd "${_OH_BUILDSYSTEM_BUILD_DIR}"
make -n ARCH="${arch}" help >/dev/null 2>&1
rc=${?}
cd "${_OH_BUILDSYSTEM_WORK_AREA}"
return ${rc}
}
|