File: makemined

package info (click to toggle)
mined 2000.15.4-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 16,616 kB
  • ctags: 2,957
  • sloc: ansic: 123,254; sh: 10,042; makefile: 266; sed: 221; perl: 172; cpp: 30
file content (117 lines) | stat: -rwxr-xr-x 2,813 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#! /bin/sh


########################################################################
# go into source directory to make ...
cd src


########################################################################
# select make and cc programs
MAKE=${MAKE-make}

if [ "$GMAKE" = "" ]
then	# try to find gmake for use with gcc
	# (on some systems, Mac, I think, cc was gcc but make was not gmake
	#  which is a problem)
	if type gmake > /dev/null 2> /dev/null
	then	GMAKE=gmake
	else	if type gcc > /dev/null 2> /dev/null
		then	gdir=`type gcc | sed -e 's,.* ,,' -e 's,/[^/]*$,,'`
			if [ -x $gdir/make ]
			then	GMAKE=$gdir/make
			else	GMAKE=make
			fi
		else	GMAKE=make	# $MAKE ?
				# but make might be gmake while $MAKE is not
		fi
	fi
fi

# if make target is install, prevent using makefile.gcc as installation 
# target directories would be wrong
case "$1" in
*install*)	CC=true;;
esac

# if CC is explicitly set to gcc, shortcut to use it
case "$CC" in
gcc)	$GMAKE -f makefile.gcc $1
	exit;;
"")	CC=cc;;
esac


########################################################################
# for install targets, copy variables (root= etc) only if non-empty
copyvars () {
	case "$1" in
	?*)	shift;;
	esac
	makevars=
	for var in $*
	do	case $var in
		*=?*)	makevars="$makevars $var";;
		esac
	done
}

copyvars $*


########################################################################
# if make target is configure, redefine $MAKE to configure function
case "$1" in
configure)	MAKE=confmake
		GMAKE=$MAKE
		;;
esac

confmake () {
	while	case "$1" in
		-*)	true;;
		*)	false;;
		esac
	do	shift
	done
	rm -f makefile
	ln -s "$1" makefile
}


########################################################################
# select makefile suitable for operating system
case `uname` in
Linux*)	$MAKE -f makefile.linux $1 $makevars;;
Sun*)	if type $CC > /dev/null 2> /dev/null
	then	if $CC | grep "software package not installed" > /dev/null
		then	$GMAKE -f makefile.gcc $1 $makevars
		elif type $CC | grep "/ucb"
		then	$MAKE -f makefile.ucb $1 $makevars
		else	$MAKE -f makefile.sun $1 $makevars
		fi
	else	$GMAKE -f makefile.gcc $1 $makevars
	fi;;
HP*)	$MAKE -f makefile.hp $1 $makevars;;
*BSD*)	$GMAKE -f makefile.bsd $1 $makevars;;
CYG*)	if gcc -v 2>&1 | grep djgpp
	then	echo cross-compiling for djgpp on Cygwin system
		$MAKE -f makefile.dj $1 $makevars
	else	$MAKE -f makefile.cygwin $1 $makevars
	fi;;
Darwin*)
	if type gcc > /dev/null 2> /dev/null
	then	$MAKE -f makefile.osx $1 $makevars
	else	echo Mac compilation should have gcc available -
		echo keyboard mappings do not compile with cc
		false
	fi;;
Interix)
	$MAKE -f makefile.interix $1 $makevars;;
*)	echo trying to make in GNU mode
	$GMAKE -f makefile.gcc $1 $makevars;;
esac


########################################################################
# end