xref: /openbsd/gnu/usr.bin/gcc/gcc/fixinc/mkfixinc.sh (revision 06dc6460)
1#! /bin/sh
2
3if [ $# -ne 2 ]
4then
5  echo "Usage: $0 <build-mach-triplet> <target-mach-triplet>"
6  exit 1
7fi
8
9build=$1
10machine=$2
11target=../fixinc.sh
12
13echo constructing ${target} for $machine to run on $build
14fixincludes="${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#
19case $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		;;
34esac
35
36# Check for special fix rules for particular targets
37case $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    *-*-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        ;;
97esac
98
99#  IF there is no include fixing,
100#  THEN create a no-op fixer and exit
101#
102if test -z "$fixincludes"
103then
104    (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
105    chmod 755 ${target}
106    exit 0
107fi
108
109#  IF the fixer is supplied in our source directory,
110#  THEN copy that into place
111#
112if test -f ${srcdir}/"${fixincludes}"
113then
114    echo copying ${srcdir}/$fixincludes to ${target}
115    cp ${srcdir}/$fixincludes ${target}
116    chmod 755 ${target}
117    exit 0
118fi
119
120#  OK.  We gotta make the thing.
121#  make and install either the binary or the default script
122
123defs="SHELL=\"$SHELL\" CC=\"$CC\" CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBERTY=\"$LIBERTY\""
124cmd="$MAKE ${defs} install-bin"
125echo $cmd
126eval $cmd
127