2c3632d14f
Lots of code refactoring, simplification and cleanup. Lots of new unit-tests providing much higher code coverage. All courtesy of rillig at netbsd. Other significant changes: o new read-only variable .SHELL which provides the path of the shell used to run scripts (as defined by the .SHELL target). o variable parsing detects more errors. o new debug option -dl: LINT mode, does the equivalent of := for all variable assignments so that file and line number are reported for variable parse errors.
81 lines
1.6 KiB
Makefile
81 lines
1.6 KiB
Makefile
# $Id: links.mk,v 1.7 2020/08/19 17:51:53 sjg Exp $
|
|
#
|
|
# @(#) Copyright (c) 2005, Simon J. Gerraty
|
|
#
|
|
# This file is provided in the hope that it will
|
|
# be of use. There is absolutely NO WARRANTY.
|
|
# Permission to copy, redistribute or otherwise
|
|
# use this file is hereby granted provided that
|
|
# the above copyright notice and this notice are
|
|
# left intact.
|
|
#
|
|
# Please send copies of changes and bug-fixes to:
|
|
# sjg@crufty.net
|
|
#
|
|
|
|
# some platforms need something special
|
|
LN?= ln
|
|
ECHO?= echo
|
|
|
|
LINKS?=
|
|
SYMLINKS?=
|
|
|
|
__SYMLINK_SCRIPT= \
|
|
${ECHO} "$$t -> $$l"; \
|
|
case `'ls' -l $$t 2> /dev/null` in \
|
|
*"> $$l") ;; \
|
|
*) \
|
|
mkdir -p `dirname $$t`; \
|
|
rm -f $$t; \
|
|
${LN} -s $$l $$t;; \
|
|
esac
|
|
|
|
|
|
__LINK_SCRIPT= \
|
|
${ECHO} "$$t -> $$l"; \
|
|
mkdir -p `dirname $$t`; \
|
|
rm -f $$t; \
|
|
${LN} $$l $$t
|
|
|
|
_SYMLINKS_SCRIPT= \
|
|
while test $$\# -ge 2; do \
|
|
l=$$1; shift; \
|
|
t=${DESTDIR}$$1; shift; \
|
|
${__SYMLINK_SCRIPT}; \
|
|
done; :;
|
|
|
|
_LINKS_SCRIPT= \
|
|
while test $$\# -ge 2; do \
|
|
l=${DESTDIR}$$1; shift; \
|
|
t=${DESTDIR}$$1; shift; \
|
|
${__LINK_SCRIPT}; \
|
|
done; :;
|
|
|
|
_SYMLINKS_USE: .USE
|
|
@set ${$@_SYMLINKS:U${SYMLINKS}}; ${_SYMLINKS_SCRIPT}
|
|
|
|
_LINKS_USE: .USE
|
|
@set ${$@_LINKS:U${LINKS}}; ${_LINKS_SCRIPT}
|
|
|
|
|
|
# sometimes we want to ensure DESTDIR is ignored
|
|
_BUILD_SYMLINKS_SCRIPT= \
|
|
while test $$\# -ge 2; do \
|
|
l=$$1; shift; \
|
|
t=$$1; shift; \
|
|
${__SYMLINK_SCRIPT}; \
|
|
done; :;
|
|
|
|
_BUILD_LINKS_SCRIPT= \
|
|
while test $$\# -ge 2; do \
|
|
l=$$1; shift; \
|
|
t=$$1; shift; \
|
|
${__LINK_SCRIPT}; \
|
|
done; :;
|
|
|
|
_BUILD_SYMLINKS_USE: .USE
|
|
@set ${$@_SYMLINKS:U${SYMLINKS}}; ${_BUILD_SYMLINKS_SCRIPT}
|
|
|
|
_BUILD_LINKS_USE: .USE
|
|
@set ${$@_LINKS:U${LINKS}}; ${_BUILD_LINKS_SCRIPT}
|