summaryrefslogtreecommitdiff
path: root/mk/buildlink2/logic
blob: 3f60a3cf705373228aac4d2b277c4675ea78e999 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# $NetBSD: logic,v 1.2 2003/01/10 09:41:53 jlam Exp $

quotedarg=no
addtocache=no
addtoprivatecache=no
cachesettings='arg="$cachearg"; cachehit=yes'

# $qarg contains a correctly-quoted $arg
case $arg in
*[\`\"\$\\]*)
	qarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
	quotedarg=yes
	;;
*)
	qarg="$arg"
	;;
esac
case $qarg in
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
	qarg="\"$qarg\""
	quotedarg=yes
	;;
esac
searcharg="$qarg"

case $arg in
-D*)
	arg="$qarg"
	addtocache=yes
	;;
-[ILRl]*|-Wl,*|/usr/lib/lib*|@LOCALBASE@/*/lib*|@X11BASE@/*/lib*)
	arg=`$echo "X$qarg" | $Xsed @_BLNK_TRANSFORM_SED@`
	addtocache=yes
	;;
*)
	arg="$qarg"
	addtocache=no
	;;
esac

. $post_logic

case $updatecache,$addtocache,$cacheall,$quotedarg in
yes,yes,yes,*|yes,yes,no,no)
	case $arg in
	*[\`\"\$\\]*)
		cachearg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
		;;
	*)
		cachearg="$arg"
		;;
	esac
	case $addtoprivatecache in
	yes)
		pre_cachefile=$private_pre_cache
		cachefile_add=$private_cache_add
		cachefile=$private_cache
		post_cachefile=$private_post_cache
		;;
	*)
		pre_cachefile=$pre_cache
		cachefile_add=$cache_add
		cachefile=$cache
		post_cachefile=$post_cache
		;;
	esac
	$cat >> $cachefile_add << EOF
$searcharg)
	cachearg="$cachearg"
	$cachesettings
	;;
EOF
	$cat $pre_cachefile $cachefile_add $post_cachefile > $cachefile
	;;
esac