use unifdef to clean up some code
[platform/upstream/libdrm.git] / scripts / create_lk_drm.sh
1 #! /bin/bash
2 # script to create a Linux Kernel tree from the DRM tree for diffing etc..
3 #
4 # Original author - Dave Airlie (C) 2004 - airlied@linux.ie
5 #
6
7 if [ $# -lt 1 ] ;then
8         echo usage: $0 output_dir
9         exit 1
10 fi
11
12 if [ ! -d shared-core -o ! -d linux-core ]  ;then
13         echo not in DRM toplevel
14         exit 1
15 fi
16
17 OUTDIR=$1/drivers/char/drm/
18
19 echo "Copying kernel independent files"
20 mkdir -p $OUTDIR
21
22 ( cd linux-core/ ; make drm_pciids.h )
23 cp shared-core/*.[ch] $OUTDIR
24 cp linux-core/*.[ch] $OUTDIR
25 cp linux-core/Makefile.kernel $OUTDIR/Makefile
26
27 echo "Copying 2.6 Kernel files"
28 cp linux-core/Kconfig $OUTDIR/
29
30 cd $OUTDIR
31
32 for i in via*.[ch]
33 do
34 unifdef -D__linux__ -DVIA_HAVE_DMABLIT -DVIA_HAVE_CORE_MM $i > $i.tmp
35 mv $i.tmp $i
36 done
37
38 for i in sis*.[ch]
39 do
40 unifdef -D__linux__ -DVIA_HAVE_DMABLIT -DSIS_HAVE_CORE_MM $i > $i.tmp
41 mv $i.tmp $i
42 done
43 cd -