string: factorize skip_spaces and export it to be generally available
[safe/jmp/linux-2.6] / scripts / headers.sh
1 #!/bin/sh
2 # Run headers_$1 command for all suitable architectures
3
4 # Stop on error
5 set -e
6
7 do_command()
8 {
9         if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
10                 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
11         elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then
12                 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
13         else
14                 printf "Ignoring arch: %s\n" ${arch}
15         fi
16 }
17
18 archs=$(ls ${srctree}/arch)
19
20 for arch in ${archs}; do
21         case ${arch} in
22         um)        # no userspace export
23                 ;;
24         cris)      # headers export are known broken
25                 ;;
26         *)
27                 if [ -d ${srctree}/arch/${arch} ]; then
28                         do_command $1 ${arch}
29                 fi
30                 ;;
31         esac
32 done
33
34