Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / bin / update_pch.sh
blob95457e561d32134bef7a00e78a1f6bafc12d8e9d
1 #! /bin/bash
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # Usage: update_pch.sh [<module>/inc/pch/precompiled_xxx.hxx]
11 # Usage: update_pch.sh [<module>]
12 # Invoke: make cmd cmd="./bin/update_pch.sh [..]"
14 root=`dirname $0`
15 root=`cd $root/.. && pwd`
16 cd $root
18 if test -z "$1"; then
19 headers=`ls ./*/inc/pch/precompiled_*.hxx`
20 else
21 headers="$@"
24 # Split the headers into an array.
25 IFS=' ' read -a aheaders <<< $headers
26 hlen=${#aheaders[@]};
27 if [ $hlen -gt 1 ]; then
28 if [ -z "$PARALLELISM" ]; then
29 PARALLELISM=0 # Let xargs decide
31 echo $headers | xargs -n 1 -P $PARALLELISM $0
32 exit $?
35 for x in $headers; do
36 if [ -d "$x" ]; then
37 # We got a directory, find pch files to update.
38 headers=`find $root/$x/ -type f -iname "precompiled_*.hxx"`
39 $0 "$headers"
40 else
41 header=$x
42 echo updating `echo $header | sed -e s%$root/%%`
43 module=`readlink -f $header | sed -e s%$root/%% -e s%/.*%%`
44 libname=`echo $header | sed -e s/.*precompiled_// -e s/\.hxx//`
46 ./bin/update_pch "$module" "$libname"
48 done
50 #echo Done.
51 exit 0