summaryrefslogtreecommitdiffstats
path: root/tools/build
blob: 7a374f0166bb694155760d3f45cf8b4867c6699c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#
# $Id: build,v 1.1.1.1 2000/02/16 23:32:47 shmit Exp $

os=`uname -s`
rev=`uname -r`
rev_major=`echo $rev | cut -d. -f1`

case $os in
FreeBSD)
	if [ $rev_major -ge 3 ]; then
		target=freebsd
	else
		target=freebsd2
	fi
	;;
Linux)
	target=linux
	;;
SunOS)
	if [ $rev_major -ge 5 ]; then
		target=solaris
	else
		target=sunos
	fi
	;;
*)
	echo "I don't know how to build for your platform, please poke" 1>&2
	echo "around in Makefiles/os and tools/build to get the server" 1>&2
	echo "to work on your platform." 1>&2
	exit 1
	;;
esac

# Figure out which make to use.
make=$1 && shift 1

# Clobber the target makefile if the target of the build is the Makefile.
if [ "$1" = "target" ]; then
	rm -f Makefiles/os/target
	echo "Setting build target to $target."
	ln -s $target Makefiles/os/target && exit 0
	exit 1
fi

# Make sure the OS Makefile is in place.
if [ ! -f Makefiles/os/target ]; then
	echo "Setting build target to $target."
	ln -s $target Makefiles/os/target || exit 1
fi

# Now build the target.
$make MAKE=$make -f Makefiles/build $*