~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/build/hcc

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# The contents of this file are subject to the Netscape Public
 
4
# License Version 1.1 (the "License"); you may not use this file
 
5
# except in compliance with the License. You may obtain a copy of
 
6
# the License at http://www.mozilla.org/NPL/
 
7
#
 
8
# Software distributed under the License is distributed on an "AS
 
9
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
10
# implied. See the License for the specific language governing
 
11
# rights and limitations under the License.
 
12
#
 
13
# The Original Code is mozilla.org code.
 
14
#
 
15
# The Initial Developer of the Original Code is Netscape
 
16
# Communications Corporation.  Portions created by Netscape are
 
17
# Copyright (C) 1998 Netscape Communications Corporation. All
 
18
# Rights Reserved.
 
19
#
 
20
# Contributor(s): 
 
21
#
 
22
 
 
23
#
 
24
# Fix brain-damaged compilers that don't understand -o and -c together
 
25
#
 
26
CC=`echo $1 | sed -e "s|'||g" -e 's|"||g'`
 
27
shift
 
28
DASH_C=0
 
29
DASH_O=0
 
30
DUMMY="XxxXxxX"
 
31
GET_OBJECT=0
 
32
OBJ="${DUMMY}"
 
33
OBJECT="${DUMMY}"
 
34
 
 
35
for i in $*
 
36
do
 
37
        [ "${CHECK_O}" = yes ]  && {
 
38
        case $i in
 
39
                ./*/*.o)        OBJECT="$i"
 
40
                        OPTS="${OPTS} -o"
 
41
                        DASH_O=1
 
42
                        ;;
 
43
                ./*.o)  OBJECT="`basename $i`"
 
44
                        i=""
 
45
                        DASH_O=1
 
46
                        ;;
 
47
                *.o)    if [ $i = `basename $i` ]
 
48
                        then
 
49
                                OBJECT="$i"
 
50
                                i=""
 
51
                        else
 
52
                                OPTS="${OPTS} -o"
 
53
                        fi
 
54
                        DASH_O=1
 
55
                        ;;
 
56
                *)      OPTS="${OPTS} -o $i"
 
57
                        DASH_O=1
 
58
                        i=""
 
59
                        ;;
 
60
        esac
 
61
        CHECK_O=no
 
62
        }
 
63
   case $i in
 
64
   -c)     DASH_C=1
 
65
        OPTS="${OPTS} -c"
 
66
                ;;
 
67
   -o)     CHECK_O=yes
 
68
                ;;
 
69
   *.c)    C_SRC=$i
 
70
        OPTS="${OPTS} $i"
 
71
# cc always creates the .o from the .c name
 
72
        OBJ=`basename $C_SRC .c`.o
 
73
                ;;
 
74
   *.s)    S_SRC=$i
 
75
        OPTS="${OPTS} $i"
 
76
# or the .o from the .s name
 
77
        OBJ=`basename $S_SRC .s`.o
 
78
                ;;
 
79
   *.o)    OBJECT=$i
 
80
        OPTS="${OPTS} $i"
 
81
                ;;
 
82
   *)   OPTS="${OPTS} $i"
 
83
                ;;
 
84
   esac
 
85
done
 
86
 
 
87
${CC} ${OPTS} || exit $?
 
88
 
 
89
# if there was no -c and -o we're done
 
90
[ $DASH_C = 1 -a $DASH_O = 1 ] || exit 0
 
91
 
 
92
# if $OBJ and $OBJECT are the same we're done
 
93
[ $OBJ = $OBJECT ] && exit 0
 
94
 
 
95
[ -f $OBJ ] && mv -f $OBJ $OBJECT