OSDN Git Service

pass canonical build name to mkfixinc.sh. Use it for choosing the fix build method
[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 build system name given
9        exit 1
10 fi
11
12 if [ -z "$machine" ]
13 then
14         echo No machine name given
15         exit 1
16 fi
17
18 target=../fixinc.sh
19
20 echo constructing ${target} for $machine to run on $build
21 fixincludes="${machine}"
22
23 # Choose fix build method by build system
24 case $build in
25         i?86-*-msdosdjgpp* )
26                 MAKE="${MAKE} -f ${srcdir}/Makefile.DOS srcdir=${srcdir}"
27                 ;;
28
29         *-*-beos* )
30                 MAKE="${MAKE} -f ${srcdir}/Makefile.BEOS srcdir=${srcdir}"
31                 # Remove the following line to enable fixincludes
32                 # (Makefile.BEOS is empty until Monday 12/4/00 :)
33                 fixincludes=
34                 ;;
35
36         * )
37                 MAKE="${MAKE} -f Makefile"
38                 ;;
39 esac
40
41 # Check for special fix rules for particular targets
42 case $machine in
43         *-*-sysv4* | \
44         i?86-*-sysv5* | \
45         i?86-*-udk*)
46                 fixincludes=fixinc.svr4
47                 ;;
48
49         i?86-*-interix* | \
50         alpha-*-interix*)
51                 fixincludes=fixinc.interix
52                 ;;
53
54         *-*-netbsd* | \
55         i?86-*-openbsd*)
56                 fixincludes=fixinc.wrap
57                 ;;
58
59         alpha*-*-winnt* | \
60         i?86-*-winnt3*)
61                 fixincludes=fixinc.winnt
62                 ;;
63
64         i?86-sequent-ptx* | i?86-sequent-sysv[34]*)
65                 fixincludes=fixinc.ptx
66                 ;;
67
68         alpha*-dec-vms* | \
69         arm-semi-aout | armel-semi-aout | \
70         arm-semi-aof | armel-semi-aof | \
71         arm-*-gnu* | \
72         c*-convex-* | \
73         hppa1.1-*-osf* | \
74         hppa1.0-*-osf* | \
75         hppa1.1-*-bsd* | \
76         hppa1.0-*-bsd* | \
77         hppa*-*-lites* | \
78         *-*-gnu* | \
79         i?86-moss-msdos* | i?86-*-moss* | \
80         i?86-*-osf1* | \
81         i?86-*-win32 | \
82         i?86-*-pe | i?86-*-cygwin* | \
83         i?86-*-mingw32* | \
84         i?86-*-uwin* | \
85         mips-sgi-irix5cross64 | \
86         powerpc-*-eabiaix* | \
87         powerpc-*-eabisim* | \
88         powerpc-*-eabi*    | \
89         powerpc-*-rtems*   | \
90         powerpcle-*-eabisim* | \
91         powerpcle-*-eabi*  | \
92         powerpcle-*-winnt* | \
93         powerpcle-*-pe | powerpcle-*-cygwin* | \
94         thumb-*-coff* | thumbel-*-coff* )
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