]> git.ipfire.org Git - people/ms/u-boot.git/blame - scripts/multiconfig.sh
kbuild: remove "*_felconfig" target
[people/ms/u-boot.git] / scripts / multiconfig.sh
CommitLineData
3ff291f3
MY
1#!/bin/sh
2#
3# A wrapper script to adjust Kconfig for U-Boot
4#
e02ee254 5# This file will be removed after cleaning up defconfig files
3ff291f3
MY
6#
7# Copyright (C) 2014, Masahiro Yamada <yamada.m@jp.panasonic.com>
8#
9# SPDX-License-Identifier: GPL-2.0+
10#
11
12set -e
13
3ff291f3
MY
14# Make a configuration target
15# Usage:
16# run_make_config <target> <objdir>
17# <target>: Make target such as "config", "menuconfig", "defconfig", etc.
3ff291f3 18run_make_config () {
3ff291f3
MY
19 # Linux expects defconfig files in arch/$(SRCARCH)/configs/ directory,
20 # but U-Boot has them in configs/ directory.
21 # Give SRCARCH=.. to fake scripts/kconfig/Makefile.
e02ee254 22 $MAKE -f $srctree/scripts/Makefile.build obj=scripts/kconfig SRCARCH=.. $1
3ff291f3
MY
23}
24
25do_silentoldconfig () {
26 run_make_config silentoldconfig
3ff291f3
MY
27
28 # If the following part fails, include/config/auto.conf should be
29 # deleted so "make silentoldconfig" will be re-run on the next build.
e02ee254 30 $MAKE -f $srctree/scripts/Makefile.autoconf || {
3ff291f3
MY
31 rm -f include/config/auto.conf
32 exit 1
33 }
34
35 # include/config.h has been updated after "make silentoldconfig".
36 # We need to touch include/config/auto.conf so it gets newer
37 # than include/config.h.
38 # Otherwise, 'make silentoldconfig' would be invoked twice.
39 touch include/config/auto.conf
3ff291f3
MY
40}
41
42cleanup_after_defconfig () {
43 rm -f configs/.tmp_defconfig
44 # ignore 'Directory not empty' error
45 # without using non-POSIX option '--ignore-fail-on-non-empty'
46 rmdir arch configs 2>/dev/null || true
47}
48
49# Usage:
50# do_board_defconfig <board>_defconfig
51do_board_defconfig () {
52 defconfig_path=$srctree/configs/$1
3ff291f3 53
8caaec62
MY
54 if [ ! -r $defconfig_path ]; then
55 echo >&2 "***"
703a08f2 56 echo >&2 "*** Can't find default configuration \"configs/$1\"!"
8caaec62
MY
57 echo >&2 "***"
58 exit 1
59 fi
60
3ff291f3 61 mkdir -p arch configs
e02ee254
MY
62 # prefix "*:" is deprecated. Drop it simply.
63 sed -e 's/^[+A-Z]*://' $defconfig_path > configs/.tmp_defconfig
3ff291f3
MY
64
65 run_make_config .tmp_defconfig || {
66 cleanup_after_defconfig
67 exit 1
68 }
69
3ff291f3
MY
70 cleanup_after_defconfig
71}
72
3ff291f3 73do_others () {
e02ee254 74 run_make_config $1
3ff291f3
MY
75}
76
77progname=$(basename $0)
78target=$1
79
80case $target in
81*_defconfig)
82 do_board_defconfig $target;;
83*_config)
d1b60d34 84 # backward compatibility
3ff291f3
MY
85 do_board_defconfig ${target%_config}_defconfig;;
86silentoldconfig)
87 do_silentoldconfig;;
3ff291f3
MY
88*)
89 do_others $target;;
90esac