1#!/bin/sh
2
3# Copyright (c) 1993 Eric P. Allman
4# Copyright (c) 1993 The Regents of the University of California.
5# All rights reserved.
6#
7# %sccs.include.redist.sh%
8#
9#       @(#)makesendmail	8.4 (Berkeley) 01/24/94
10#
11
12#
13#  A quick-and-dirty script to compile sendmail in the presence of
14#  multiple architectures and Makefiles.
15#
16
17# determine machine architecture
18arch=`uname -m`
19case $arch
20in
21  sun4*)	arch=sun4;;
22
23  9000/*)	arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;;
24esac
25
26# determine operating system type
27os=`uname -s`
28
29# determine operating system release
30rel=`uname -r`
31rbase=`echo $rel | sed 's/\..*//''`
32
33# now try to find a reasonable object directory
34if [ -r obj.$os.$arch.$rel ]; then
35	obj=obj.$os.$arch.$rel
36elif [ -r obj.$os.$arch.$rbase.x ]; then
37	obj=obj.$os.$arch.$rbase.x
38elif [ -r obj.$os.$rel ]; then
39	obj=obj.$os.$rel
40elif [ -r obj.$os.$rbase.x ]; then
41	obj=obj.$os.$rbase.x
42elif [ -r obj.$os.$arch ]; then
43	obj=obj.$os.$arch
44elif [ -r obj.$arch.$rel ]; then
45	obj=obj.$arch.$rel
46elif [ -r obj.$arch.$rbase.x ]; then
47	obj=obj.$arch.$rbase.x
48elif [ -r obj.$os ]; then
49	obj=obj.$os
50elif [ -r obj.$arch ]; then
51	obj=obj.$arch
52elif [ -r obj.$rel ]; then
53	obj=obj.$rel
54else
55	# no existing obj directory -- try to create one if Makefile found
56	obj=obj.$os.$arch.$rel
57	if [ -r Makefile.$os.$arch.$rel ]; then
58		makefile=Makefile.$os.$arch.$rel
59	elif [ -r Makefile.$os.$arch.$rbase.x ]; then
60		makefile=Makefile.$os.$arch.$rbase.x
61	elif [ -r Makefile.$os.$rel ]; then
62		makefile=Makefile.$os.$rel
63	elif [ -r Makefile.$os.$rbase.x ]; then
64		makefile=Makefile.$os.$base.x
65	elif [ -r Makefile.$os.$arch ]; then
66		makefile=Makefile.$os.$arch
67	elif [ -r Makefile.$arch.$rel ]; then
68		makefile=Makefile.$arch.$rel
69	elif [ -r Makefile.$arch.$rbase.x ]; then
70		makefile=Makefile.$arch.$rbase.x
71	elif [ -r Makefile.$os ]; then
72		makefile=Makefile.$os
73	elif [ -r Makefile.$arch ]; then
74		makefile=Makefile.$arch
75	elif [ -r Makefile.$rel ]; then
76		makefile=Makefile.$rel
77	else
78		echo "Cannot determine how to support $arch.$os.$rel"
79		exit 1
80	fi
81	echo "Creating $obj using $makefile"
82	mkdir $obj
83	(cd $obj; ln -s ../*.[ch158] ../sendmail.hf .; ln -s ../$makefile Makefile)
84fi
85echo "Making in $obj"
86cd $obj
87exec make -f Makefile $*
88