summaryrefslogtreecommitdiff
path: root/scripts/mkconfigs
blob: 38d7ac0541bc3ad1c47d90117b72084078513e53 (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
#!/bin/sh
#
# Copyright (C) 2002 Khalid Aziz <khalid_aziz at hp.com>
# Copyright (C) 2002 Randy Dunlap <rddunlap at osdl.org>
# Copyright (C) 2002 Al Stone <ahs3 at fc.hp.com>
# Copyright (C) 2002 Hewlett-Packard Company
#
#   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, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#   Busybox version by Matteo Croce <3297627799 at wind.it>
#
# Rules to generate bbconfigopts.h from .config:
#      - Retain lines that begin with "CONFIG_"
#      - Retain lines that begin with "# CONFIG_"
#      - lines that use double-quotes must \\-escape-quote them

config=.config

{
echo "\
#ifndef _BBCONFIGOPTS_H
#define _BBCONFIGOPTS_H
/*
 * busybox configuration settings.
 *
 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
 *
 * This file is generated automatically by scripts/mkconfigs.
 * Do not edit.
 */
static const char bbconfig_config[] ALIGN1 ="

grep '^#\? \?CONFIG_' "$config" \
| sed -e 's/\"/\\\"/g' -e 's/^/"/' -e 's/$/\\n"/'

echo ";"
echo "#endif"
} >"$1"

{
echo "\
#ifndef _BBCONFIGOPTS_BZ2_H
#define _BBCONFIGOPTS_BZ2_H
/*
 * busybox configuration settings.
 *
 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
 *
 * This file is generated automatically by scripts/mkconfigs.
 * Do not edit.
 */
static const char bbconfig_config_bz2[] ALIGN1 = {"

grep '^#\? \?CONFIG_' "$config" \
| bzip2 -1 | tee z.bz2 | dd bs=2 skip=1 2>/dev/null | od -v -t x1 \
| sed -e 's/^[^ ]*//' \
        -e 's/ //g' \
        -e '/^$/d' \
        -e 's/\(..\)/0x\1,/g'

echo "};"
echo "#endif"
} >"$2"