-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen-compat-autoconf.sh
executable file
·64 lines (57 loc) · 1.99 KB
/
gen-compat-autoconf.sh
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
#! /bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
#
# Marek Lindner, Simon Wunderlich
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# 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/>.
set -e
TARGET=${1:="compat-autoconf.h"}
TMP="${TARGET}.tmp"
echo > "${TMP}"
gen_config() {
KEY="${1}"
VALUE="${2}"
echo "#undef ${KEY}"
echo "#undef __enabled_${KEY}"
echo "#undef __enabled_${KEY}_MODULE"
case "${VALUE}" in
y)
echo "#define ${KEY} 1"
echo "#define __enabled_${KEY} 1"
echo "#define __enabled_${KEY}_MODULE 0"
;;
m)
echo "#define ${KEY} 1"
echo "#define __enabled_${KEY} 0"
echo "#define __enabled_${KEY}_MODULE 1"
;;
n)
echo "#define __enabled_${KEY} 0"
echo "#define __enabled_${KEY}_MODULE 0"
;;
*)
echo "#define ${KEY} \"${VALUE}\""
;;
esac
}
# write config variables
gen_config 'CONFIG_BATMAN_ADV_DEBUGFS' ${CONFIG_BATMAN_ADV_DEBUGFS:="y"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_DEBUG' ${CONFIG_BATMAN_ADV_DEBUG:="n"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_BLA' ${CONFIG_BATMAN_ADV_BLA:="y"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_DAT' ${CONFIG_BATMAN_ADV_DAT:="y"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_MCAST' ${CONFIG_BATMAN_ADV_MCAST:="y"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_NC' ${CONFIG_BATMAN_ADV_NC:="n"} >> "${TMP}"
gen_config 'CONFIG_BATMAN_ADV_BATMAN_V' ${CONFIG_BATMAN_ADV_BATMAN_V:="n"} >> "${TMP}"
# only regenerate compat-autoconf.h when config was changed
diff "${TMP}" "${TARGET}" > /dev/null 2>&1 || cp "${TMP}" "${TARGET}"