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