OSDN Git Service

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