aboutsummaryrefslogtreecommitdiff
path: root/share/mk/bsd.sys.mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/bsd.sys.mk')
-rw-r--r--share/mk/bsd.sys.mk74
1 files changed, 74 insertions, 0 deletions
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 1d8b49d4142a..fe3715a2be5d 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -141,3 +141,77 @@ PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
.PHONY: ${PHONY_NOTMAIN}
.NOTMAIN: ${PHONY_NOTMAIN}
+
+.if !defined(.PARSEDIR)
+# this is a no-op
+.WAIT:
+.endif
+
+.if ${MK_STAGING} != "no"
+.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*))
+staging stage_libs stage_files stage_as stage_links stage_symlinks:
+.else
+# allow targets like beforeinstall to be leveraged
+DESTDIR= ${STAGE_OBJTOP}
+
+.if commands(beforeinstall)
+.if !empty(_LIBS) || ${MK_STAGING_PROG} != "no"
+staging: beforeinstall
+.endif
+.endif
+
+# normally only libs and includes are staged
+.if ${MK_STAGING_PROG} != "no"
+STAGE_DIR.prog= ${STAGE_OBJTOP}${BINDIR}
+
+.if !empty(PROG)
+.if defined(PROGNAME)
+STAGE_AS_SETS+= prog
+STAGE_AS_${PROG}= ${PROGNAME}
+stage_as.prog: ${PROG}
+.else
+STAGE_SETS+= prog
+stage_files.prog: ${PROG}
+staging: stage_files
+.endif
+.endif
+.endif
+
+.if !empty(_LIBS) && !defined(INTERNALLIB)
+stage_libs: ${_LIBS}
+.endif
+
+.if !empty(INCS) || !empty(INCSGROUPS) && target(buildincludes)
+beforebuild: buildincludes
+.endif
+
+.for t in stage_libs stage_files stage_as
+.if target($t)
+staging: $t
+.endif
+.endfor
+
+.if !empty(STAGE_AS_SETS)
+staging: stage_as
+.endif
+
+.if !empty(_LIBS) || ${MK_STAGING_PROG} != "no"
+
+.if !empty(LINKS)
+staging: stage_links
+STAGE_SETS+= links
+STAGE_LINKS.links= ${LINKS}
+.endif
+
+.if !empty(SYMLINKS)
+staging: stage_symlinks
+STAGE_SETS+= links
+STAGE_SYMLINKS.links= ${SYMLINKS}
+.endif
+
+.endif
+
+.include <meta.stage.mk>
+.endif
+.endif
+