freebsd-dev/share/mk/bsd.links.mk
Ruslan Ermilov badb7c1c6b Try really hard to fix parallel installs. Add a bunch of .ORDER
directives to ensure that all realinstall sub-tasks are executed
after beforeinstall, similarly ensure that all afterinstall sub-
tasks are executed after realinstall.  Demonstration:

all: task1 task2
.ORDER: task1 task2

task2: task2_subtask
.ORDER: task1 task2_subtask

task1 task2 task2_subtask:
	@sleep `jot -r 1 0 1.0`
	@echo ${.TARGET}

Without the second .ORDER directive, task2_subtask can be run in
parallel with task1.

Spotted by:	Andrea Campi <andrea@webcom.it>
2002-07-03 12:28:03 +00:00

32 lines
596 B
Makefile

# $FreeBSD$
.if !target(__<bsd.init.mk>__)
.error bsd.links.mk cannot be included directly.
.endif
afterinstall: _installlinks
.ORDER: realinstall _installlinks
_installlinks:
.if defined(LINKS) && !empty(LINKS)
@set ${LINKS}; \
while test $$# -ge 2; do \
l=${DESTDIR}$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
${ECHO} $$t -\> $$l; \
ln -f $$l $$t; \
done; true
.endif
.if defined(SYMLINKS) && !empty(SYMLINKS)
@set ${SYMLINKS}; \
while test $$# -ge 2; do \
l=$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
${ECHO} $$t -\> $$l; \
ln -fs $$l $$t; \
done; true
.endif