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	*-*-haiku* )
23		MAKE="${MAKE} TARGETS=twoprocess"
24		CFLAGS="${CFLAGS} -DSEPARATE_FIX_PROC"
25		;;
26
27	vax-dec-bsd* )
28		CFLAGS="${CFLAGS} -Dexit=xexit -Datexit=xatexit"
29		MAKE="${MAKE} TARGETS=oneprocess"
30		;;
31
32	* )
33		MAKE="${MAKE} TARGETS=oneprocess"
34		;;
35esac
36
37# Check for special fix rules for particular targets
38case $machine in
39    alpha*-dec-*vms* | \
40    arm-semi-aof | \
41	hppa1.1-*-osf* | \
42	hppa1.1-*-bsd* | \
43    i370-*-openedition | \
44    i?86-moss-msdos* | \
45    i?86-*-moss* | \
46    i?86-*-pe | \
47    i?86-*-cygwin* | \
48    i?86-*-mingw32* | \
49    i?86-*-uwin* | \
50    i?86-*-interix* | \
51	powerpc-*-eabiaix* | \
52	powerpc-*-eabisim* | \
53	powerpc-*-eabi*    | \
54	powerpc-*-rtems*   | \
55	powerpcle-*-eabisim* | \
56    powerpcle-*-eabi* )
57        #  Don't do any fixing.
58        #
59		fixincludes=
60		;;
61esac
62
63#  IF there is no include fixing,
64#  THEN create a no-op fixer and exit
65#
66if test -z "$fixincludes"
67then
68    (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
69    chmod 755 ${target}
70    exit 0
71fi
72
73#  OK.  We gotta make the thing.
74#  make and install either the binary or the default script
75
76defs="SHELL=\"$SHELL\" CC=\"$CC\" CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\""
77cmd="$MAKE ${defs} install-bin"
78echo $cmd
79eval $cmd
80