]> git.saurik.com Git - apple/xnu.git/blob - SETUP/seed_objroot
xnu-517.9.5.tar.gz
[apple/xnu.git] / SETUP / seed_objroot
1 #!/bin/sh
2
3 if [ ! $OBJROOT ]
4 then
5 echo "OBJROOT not defined"
6 exit 1
7 fi
8
9 if [ ! $PREBUILT_OBJROOT ]
10 then
11 PREBUILT_OBJROOT=/Prebuilt/$1/xnu/BUILD/obj
12 fi
13
14 if [ ! -e $PREBUILT_OBJROOT ]
15 then
16 echo "$PREBUILT_OBJROOT doesn't exist"
17 exit 1
18 else
19 if [ $# = 2 -a ! -e $PREBUILT_OBJROOT/$2 ]
20 then
21 echo "$PREBUILT_OBJROOT/$2 doesn't exist"
22 exit 1
23 fi
24 if [ -e $PREBUILT_OBJROOT/BUILDING_SEED_OBJROOT ]
25 then
26 echo "Building $PREBUILT_OBJROOT, try later"
27 exit 1
28 fi
29 fi
30
31 cd $PREBUILT_OBJROOT
32
33 if [ $# = 1 ]
34 then
35
36 if [ ! -e $OBJROOT ]
37 then
38 mkdir -p $OBJROOT
39 echo "Copying $PREBUILT_OBJROOT in $OBJROOT"
40 pax -rw . $OBJROOT
41 else
42 echo "Remove $OBJROOT before calling seed_objroot"
43 exit 1
44 fi
45
46 else
47
48 if [ ! -e $OBJROOT/$2 ]
49 then
50 mkdir -p $OBJROOT/$2
51 echo "Copying $PREBUILT_OBJROOT/$2 in $OBJROOT/$2"
52 pax -rw $2 $OBJROOT
53 RELEASE_OBJ=`echo $2 | sed 's/DEBUG/RELEASE/'`
54 if [ $1 != $RELEASE_OBJ -a ! -e $OBJROOT/$RELEASE_OBJ ]
55 then
56 mkdir -p $OBJROOT/$RELEASE_OBJ
57 echo "Copying $PREBUILT_OBJROOT/$RELEASE_OBJ in $OBJROOT/$RELEASE_OBJ"
58 pax -rw $RELEASE_OBJ $OBJROOT
59 fi
60
61 else
62 echo "remove $OBJROOT/$2 before calling seed_objroot"
63 exit 1
64 fi
65
66 fi
67
68 if [ ! -e $OBJROOT/EXPORT_HDRS ]
69 then
70 echo "Copying $PREBUILT_OBJROOT/EXPORT_HDRS in $OBJROOT/EXPORT_HDRS"
71 mkdir -p $OBJROOT/EXPORT_HDRS
72 pax -rw EXPORT_HDRS $OBJROOT
73 fi
74
75 cd $OBJROOT
76 if [ -e RELEASE_PPC/osfmk/RELEASE/config.RELEASE_PPC ]
77 then
78 PREV_OBJROOT=`grep objectdir RELEASE_PPC/osfmk/RELEASE/config.RELEASE_PPC | cut -f 2 -d\" |
79 sed 's|/RELEASE_PPC/osfmk/RELEASE||'`
80 fi
81 if [ -z $PREV_OBJROOT -a -e DEBUG_PPC/osfmk/DEBUG/config.DEBUG_PPC ]
82 then
83 PREV_OBJROOT=`grep objectdir DEBUG_PPC/osfmk/DEBUG/config.DEBUG_PPC | cut -f 2 -d\" |
84 sed 's|/DEBUG_PPC/osfmk/DEBUG||'`
85 fi
86 if [ -z $PREV_OBJROOT -a -e RELEASE_I386/osfmk/RELEASE/config.RELEASE_I386 ]
87 then
88 PREV_OBJROOT=`grep objectdir RELEASE_I386/osfmk/RELEASE/config.RELEASE_I386 | cut -f 2 -d\" |
89 sed 's|/RELEASE_I386/osfmk/RELEASE||'`
90 fi
91 if [ -z $PREV_OBJROOT -a -e DEBUG_I386/osfmk/DEBUG/config.DEBUG_I386 ]
92 then
93 PREV_OBJROOT=`grep objectdir DEBUG_I386/osfmk/DEBUG/config.DEBUG_I386 | cut -f 2 -d\" |
94 sed 's|/DEBUG_I386/osfmk/DEBUG||'`
95 fi
96 if [ -z $PREV_OBJROOT ]
97 then
98 echo "PREV_OBJROOT not found"
99 exit 1
100 fi
101
102 if [ -e RELEASE_PPC/osfmk/RELEASE/config.RELEASE_PPC ]
103 then
104 PREV_SRCROOT=`grep sourcedir RELEASE_PPC/osfmk/RELEASE/config.RELEASE_PPC | cut -f 2 -d\"`
105 fi
106 if [ -z $PREV_SRCROOT -a -e DEBUG_PPC/osfmk/DEBUG/config.DEBUG_PPC ]
107 then
108 PREV_SRCROOT=`grep sourcedir DEBUG_PPC/osfmk/DEBUG/config.DEBUG_PPC | cut -f 2 -d\"`
109 fi
110 if [ -z $PREV_SRCROOT -a -e RELEASE_I386/osfmk/RELEASE/config.RELEASE_I386 ]
111 then
112 PREV_SRCROOT=`grep sourcedir RELEASE_I386/osfmk/RELEASE/config.RELEASE_I386 | cut -f 2 -d\"`
113 fi
114 if [ -z $PREV_SRCROOT -a -e DEBUG_I386/osfmk/DEBUG/config.DEBUG_I386 ]
115 then
116 PREV_SRCROOT=`grep sourcedir DEBUG_I386/osfmk/DEBUG/config.DEBUG_I386 | cut -f 2 -d\"`
117 fi
118 if [ -z $PREV_SRCROOT ]
119 then
120 echo "PREV_SRCROOT not found"
121 exit 1
122 fi
123
124 echo "s|$PREV_OBJROOT|$OBJROOT|" > prebuild.sed
125 echo "s|$PREV_SRCROOT|$SRCROOT|" >>prebuild.sed
126
127 for i in `find . -name Makedep -print`
128 do
129 sed -f prebuild.sed $i > $i.tmp
130 rm $i
131 mv $i.tmp $i
132 done
133 rm -f `find $OBJROOT -name Makefile -print` prebuild.sed