1#!/bin/bash
2#
3# NAME:
4#         linuxize.sh - create linuxized ACPICA source
5#
6# SYNOPSIS:
7#         linuxize.sh [-s] <file>
8#
9# DESCRIPTION:
10#         Convert ACPICA source to Linux format.
11#         Parameters:
12#          file     Path of file to be linuxized.
13#         Options:
14#          -s       Force regeneration of acpisrc.
15#
16
17usage()
18{
19	echo "Usage:"
20	echo "`basename $0` [-s] <file>"
21	echo "Where:"
22	echo "        -s: generate acpisrc"
23	echo "      file: path of file to be linuxized"
24	exit -1
25}
26
27while getopts "s" opt
28do
29	case $opt in
30	s) FORCE_ACPISRC=force;;
31	?) echo "Invalid argument $opt"
32	   usage;;
33	esac
34done
35shift $(($OPTIND - 1))
36
37if [ -z "$1" ] ; then
38	usage
39fi
40
41SCRIPT=`(cd \`dirname $0\`; pwd)`
42. $SCRIPT/libacpica.sh
43
44ACPICADIR=`getdir $1`
45ACPICAFILE=`getfile $1`
46LINUXDIR=$CURDIR/linux/${ACPICADIR#${SRCDIR}/}
47LINUXFILE=$CURDIR/linux/${ACPICAFILE#${SRCDIR}/}
48
49# Generate latest version of the acpisrc utility
50echo "[linuxize.sh] Generating tool (acpisrc)..."
51make_acpisrc $SRCDIR $FORCE_ACPISRC > /dev/null
52
53echo "[linuxize.sh] Converting format (acpisrc)..."
54mkdir -p $LINUXDIR
55rm -f $LINUXFILE
56$ACPISRC -ldqy $ACPICAFILE $LINUXFILE > /dev/null
57
58# indent all .c and .h files
59echo "[linuxize.sh] Converting format (lindent)..."
60lindent $CURDIR/linux
61