summaryrefslogtreecommitdiff
path: root/mk/wrapper/cmd-sink-osf1-ld
blob: 1dabe3a196f8d2b0889f1b1819c86290fad5d337 (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
54
# $NetBSD: cmd-sink-osf1-ld,v 1.1 2004/11/20 04:37:08 grant Exp $

# Empty out the command buffer and build up the command line in $cmd.
osf1runpath=
while ! queue_is_empty cmdbuf; do
	pop_queue cmdbuf arg
	$debug_log $wrapperlog "    (cmd-sink-osf1-ld) pop:  $arg"
	case $arg in
	##############################################################
	# OSF1 ld doesn't support multiple rpath parameters, accumulate
	# them into a single -rpath /path1:/path2:...:pathn
	##############################################################
	-rpath)
		pop_queue cmdbuf dir
		case $osf1runpath in
		"")	osf1runpath="$dir" ;;
		*)	osf1runpath="$osf1runpath:$dir" ;;
		esac
		$debug_log $wrapperlog "    (cmd-sink-osf1-ld) drop: $dir [adding to osf1runpath]"
		;;
	-R*|-Wl,-R*|-Wl,-rpath,*|-Wl,-rpath-link,*|-Wl,--rpath,*)
		case $arg in
		-R*)			R="-R" ;;
		-Wl,-R*)		R="-Wl,-R" ;;
		-Wl,-rpath,*)		R="-Wl,-rpath," ;;
		-Wl,-rpath-link,*)	R="-Wl,-rpath-link," ;;
		-Wl,--rpath,*)		R="-Wl,--rpath," ;;
		esac
		dir="${arg#$R}"
		case $osf1runpath in
		"")	osf1runpath="$dir" ;;
		*)	osf1runpath="$osf1runpath:$dir" ;;
		esac
		$debug_log $wrapperlog "    (cmd-sink-osf1-ld) drop: $dir [adding to osf1runpath]"
		;;
	-pthread)
		arg="-lpthread"
		$debug_log $wrapperlog "    (cmd-sink-osf1-ld) pop: $arg"
		. $buildcmd
		;;
	*)
		. $buildcmd
		;;
	esac
done

if $test -n "$osf1runpath"; then
	arg=-rpath
	$debug_log $wrapperlog "    (cmd-sink-osf1-ld) pop: $arg"
	. $buildcmd
	arg=$osf1runpath
	$debug_log $wrapperlog "    (cmd-sink-osf1-ld) pop: $arg [aggregate]"
	. $buildcmd
fi