File: aimk

package info (click to toggle)
pvm 3.4beta7-4
  • links: PTS
  • area: main
  • in suites: slink
  • size: 5,256 kB
  • ctags: 5,938
  • sloc: ansic: 66,147; makefile: 1,446; fortran: 631; sh: 424; csh: 70; asm: 37
file content (99 lines) | stat: -rwxr-xr-x 2,108 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
#
#	$Id: aimk,v 1.1 1996/09/23 21:15:36 pvmsrc Exp $
#
#	aimk.sh
#
#	Make wrapper for multiple arch. builds.
#
#	Automatically sets PVM_ARCH for make to use.
#
#	Action depends on makefile locations:
#	1.  If $PVM_ARCH/Makefile or $PVM_ARCH/makefile exists,
#		chdir to $PVM_ARCH and exec make there.
#
#	2.  Else if ./Makefile.aimk exists,
#		chdir to $PVM_ARCH and exec make
#		with -f $PVM_ROOT/conf/$PVM_ARCH.def
#		and -f $AIMK_SRC/Makefile.aimk PVM_ARCH=$PVM_ARCH
#		$AIMK_SRC is the original working directory before the chdir.
#
#	3.  Else will simply exec make in cwd.
#
#	usage:
#	    aimk [-here] [ make args ... ]
#
#	09 Apr 1993  Manchek
#

makeincwd=0
found=1
while [ $# -ge 1 -a $found = 1 ]; do
	found=0
	case "$1" in
	-here ) makeincwd=1; shift; found=1 ;;
	esac
done

case "x$PVM_ROOT" in x )
	if [ -d /usr/lib/pvm3 ]; then
		PVM_ROOT=/usr/lib/pvm3
	elif [ -d /usr/local/lib/pvm3 ]; then
		PVM_ROOT=/usr/local/lib/pvm3
	else
		echo aimk: PVM_ROOT not defined >&2
		exit 1
	fi
;; esac

case "x$PVM_ARCH" in x | xUNKNOWN )
	PVM_ARCH="`$PVM_ROOT/lib/pvmgetarch`"
	case "x$PVM_ARCH" in x )
		echo 'aimk: no pvmgetarch - is $PVM_ROOT set correctly?' >&2
		exit 1
	;; esac
;; esac

export PVM_ARCH
export PVM_ROOT

#
# run make in cwd or subdir if exists.
#

if [ $makeincwd = 0 -a \( -f $PVM_ARCH/Makefile -o -f $PVM_ARCH/makefile \) ]; then
	echo making in $PVM_ARCH/ for $PVM_ARCH
	cd $PVM_ARCH
	if [ "$*" = "" ]; then
		exec make PVM_ARCH=$PVM_ARCH
	else
		exec make PVM_ARCH=$PVM_ARCH "$@"
	fi

else
	if [ $makeincwd = 0 -a -f Makefile.aimk ]; then
		if [ ! -d $PVM_ARCH ]; then
			mkdir $PVM_ARCH
		fi
		echo making in $PVM_ARCH/ for $PVM_ARCH
		AIMK_SRC=`pwd`
		export AIMK_SRC
		cd $PVM_ARCH
		if [ "$*" = "" ]; then
			exec make -f $PVM_ROOT/conf/$PVM_ARCH.def -f $AIMK_SRC/Makefile.aimk PVM_ARCH=$PVM_ARCH
		else
			exec make -f $PVM_ROOT/conf/$PVM_ARCH.def -f $AIMK_SRC/Makefile.aimk PVM_ARCH=$PVM_ARCH "$@"
		fi

	else
		echo making in . for $PVM_ARCH
		if [ "$*" = "" ]; then
			exec make PVM_ARCH=$PVM_ARCH
		else
			exec make PVM_ARCH=$PVM_ARCH "$@"
		fi
	fi
fi

exit 1