svc.startd: remove metainit dependency
[unleashed.git] / bin / bmake / mk / links.mk
blobaac3914fdd001cf3f1224eb6b55f51730b8df927
1 # $Id: links.mk,v 1.6 2014/09/29 17:14:40 sjg Exp $
3 # @(#) Copyright (c) 2005, Simon J. Gerraty
5 # This file is provided in the hope that it will
6 # be of use. There is absolutely NO WARRANTY.
7 # Permission to copy, redistribute or otherwise
8 # use this file is hereby granted provided that
9 # the above copyright notice and this notice are
10 # left intact.
12 # Please send copies of changes and bug-fixes to:
13 # sjg@crufty.net
16 # some platforms need something special
17 LN?= ln
18 ECHO?= echo
20 LINKS?=
21 SYMLINKS?=
23 __SYMLINK_SCRIPT= \
24 ${ECHO} "$$t -> $$l"; \
25 case `'ls' -l $$t 2> /dev/null` in \
26 *"> $$l") ;; \
27 *) \
28 mkdir -p `dirname $$t`; \
29 rm -f $$t; \
30 ${LN} -s $$l $$t;; \
31 esac
34 __LINK_SCRIPT= \
35 ${ECHO} "$$t -> $$l"; \
36 mkdir -p `dirname $$t`; \
37 rm -f $$t; \
38 ${LN} $$l $$t
40 _SYMLINKS_SCRIPT= \
41 while test $$\# -ge 2; do \
42 l=$$1; shift; \
43 t=${DESTDIR}$$1; shift; \
44 ${__SYMLINK_SCRIPT}; \
45 done; :;
47 _LINKS_SCRIPT= \
48 while test $$\# -ge 2; do \
49 l=${DESTDIR}$$1; shift; \
50 t=${DESTDIR}$$1; shift; \
51 ${__LINK_SCRIPT}; \
52 done; :;
54 _SYMLINKS_USE: .USE
55 @set ${$@_SYMLINKS:U${SYMLINKS}}; ${_SYMLINKS_SCRIPT}
57 _LINKS_USE: .USE
58 @set ${$@_LINKS:U${LINKS}}; ${_LINKS_SCRIPT}
61 # sometimes we want to ensure DESTDIR is ignored
62 _BUILD_SYMLINKS_SCRIPT= \
63 while test $$\# -ge 2; do \
64 l=$$1; shift; \
65 t=$$1; shift; \
66 ${__SYMLINK_SCRIPT}; \
67 done; :;
69 _BUILD_LINKS_SCRIPT= \
70 while test $$\# -ge 2; do \
71 l=$$1; shift; \
72 t=$$1; shift; \
73 ${__LINK_SCRIPT}; \
74 done; :;
76 _BUILD_SYMLINKS_USE: .USE
77 @set ${$@_SYMLINKS:U${SYMLINKS}}; ${_BUILD_SYMLINKS_SCRIPT}
79 _BUILD_LINKS_USE: .USE
80 @set ${$@_LINKS:U${LINKS}}; ${_BUILD_LINKS_SCRIPT}