OSDN Git Service

f3679486ab5a6ffde7cda4b0d08886a5a8a53175
[pf3gnuchains/gcc-fork.git] / gcc / fixinc / mkfixinc.sh
1 #! /bin/sh
2
3 if [ $# -ne 2 ]
4 then
5   echo "Usage: $0 <build-mach-triplet> <target-mach-triplet>"
6   exit 1
7 fi
8
9 build=$1
10 machine=$2
11 target=../fixinc.sh
12
13 echo constructing ${target} for $machine to run on $build
14 fixincludes="${machine}"
15
16 # Choose one or two-process fix methodology.  Systems that cannot handle
17 # bi-directional pipes must use the two process method.
18 #
19 case $build in
20         i?86-*-msdosdjgpp* | \
21         *-*-beos* )
22                 MAKE="${MAKE} TARGETS=twoprocess"
23                 CFLAGS="${CFLAGS} -DSEPARATE_FIX_PROC"
24                 ;;
25
26         vax-dec-bsd* )
27                 CFLAGS="${CFLAGS} -Dexit=xexit -Datexit=xatexit"
28                 MAKE="${MAKE} TARGETS=oneprocess"
29                 ;;
30
31         * )
32                 MAKE="${MAKE} TARGETS=oneprocess"
33                 ;;
34 esac
35
36 # Check for special fix rules for particular targets
37 case $machine in
38     i?86-*-sysv4.2uw2* )
39         ;;
40
41     *-*-sysv4* )
42         fixincludes=fixinc.svr4
43         ;;
44
45     i?86-*-interix* | \
46     alpha-*-interix*)
47         fixincludes=fixinc.interix
48         ;;
49
50     i?86-*-openbsd*)
51         fixincludes=fixinc.wrap
52         ;;
53
54     alpha*-*-winnt* | \
55     i?86-*-winnt3*)
56         fixincludes=fixinc.winnt
57         ;;
58
59     i?86-sequent-ptx* | i?86-sequent-sysv[34]*)
60         fixincludes=fixinc.ptx
61         ;;
62
63     alpha*-dec-*vms* | \
64     arm-semi-aout | \
65     armel-semi-aout | \
66     arm-semi-aof | \
67     armel-semi-aof | \
68     hppa1.1-*-osf* | \
69     hppa1.0-*-osf* | \
70     hppa1.1-*-bsd* | \
71     hppa1.0-*-bsd* | \
72     hppa*-*-lites* | \
73     i370-*-openedition | \
74     i?86-moss-msdos* | \
75     i?86-*-moss* | \
76     i?86-*-osf1* | \
77     i?86-*-win32 | \
78     i?86-*-pe | \
79     i?86-*-cygwin* | \
80     i?86-*-mingw32* | \
81     i?86-*-uwin* | \
82     powerpc-*-eabiaix* | \
83     powerpc-*-eabisim* | \
84     powerpc-*-eabi*    | \
85     powerpc-*-rtems*   | \
86     powerpcle-*-eabisim* | \
87     powerpcle-*-eabi*  | \
88     powerpcle-*-winnt* | \
89     powerpcle-*-pe | \
90     powerpcle-*-cygwin* | \
91     thumb-*-coff* | \
92     thumbel-*-coff* )
93         #  Don't do any fixing.
94         #
95         fixincludes=
96         ;;
97 esac
98
99 #  IF there is no include fixing,
100 #  THEN create a no-op fixer and exit
101 #
102 if test -z "$fixincludes"
103 then
104     (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
105     chmod 755 ${target}
106     exit 0
107 fi
108
109 #  IF the fixer is supplied in our source directory,
110 #  THEN copy that into place
111 #
112 if test -f ${srcdir}/"${fixincludes}"
113 then
114     echo copying ${srcdir}/$fixincludes to ${target}
115     cp ${srcdir}/$fixincludes ${target}
116     chmod 755 ${target}
117     exit 0
118 fi
119
120 #  OK.  We gotta make the thing.
121 #  make and install either the binary or the default script
122
123 defs="SHELL=\"$SHELL\" CC=\"$CC\" CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\""
124 cmd="$MAKE ${defs} install-bin"
125 echo $cmd
126 eval $cmd