3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This script will print the depth path for a mozilla directory based
9 # on the info in Makefile
11 # It's a hack. It's brute force. It's horrible.
12 # It don't use Artificial Intelligence. It don't use Virtual Reality.
13 # It's not perl. It's not python. But it works.
15 # Usage: print-depth-path.sh
17 # Send comments, improvements, bugs to jim_nance@yahoo.com
20 # Make sure a Makefile exists
24 echo "There ain't no 'Makefile' over here: $pwd, dude."
30 # awk can be quite primitave. Try enhanced versions first
31 for AWK
in gawk nawk
awk; do
32 if type $AWK 2>/dev
/null
1>/dev
/null
; then
45 sub("^.*DEPTH.*=[ \t]*", "", DEPTH)
46 dlen = split(DEPTH, darray, "/")
47 plen = split(PWD, parray, "/")
50 for(i=plen-dlen; i<=plen; i++) {
51 printf("%s%s", fsep, parray[i])