Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / bsd.pkg.barrier.mk
blobab53e77d059c71386b0380e4826e408a7b550d46
1 # $NetBSD: bsd.pkg.barrier.mk,v 1.17 2009/05/16 01:27:30 joerg Exp $
3 _COOKIE.barrier= ${WRKDIR}/.barrier_cookie
5 # _BARRIER_PRE_TARGETS is a list of the targets that must be built before
6 # the "barrier" target invokes a new make.
8 _BARRIER_PRE_TARGETS= checksum-phase makedirs depends
10 # _BARRIER_POST_TARGETS is a list of the targets that must be built after
11 # the "barrier" target invokes a new make. This list is specially
12 # ordered so that if more than one is specified on the command-line,
13 # then pkgsrc will still do the right thing.
16 # FIXME: why is wrapper before extract?
17 _BARRIER_POST_TARGETS= tools
18 _BARRIER_POST_TARGETS+= wrapper
19 _BARRIER_POST_TARGETS+= extract
20 _BARRIER_POST_TARGETS+= patch
21 _BARRIER_POST_TARGETS+= configure
22 _BARRIER_POST_TARGETS+= build build-env
23 _BARRIER_POST_TARGETS+= test
24 _BARRIER_POST_TARGETS+= all
25 _BARRIER_POST_TARGETS+= stage-install
26 _BARRIER_POST_TARGETS+= reinstall
27 _BARRIER_POST_TARGETS+= replace
28 _BARRIER_POST_TARGETS+= package
29 _BARRIER_POST_TARGETS+= repackage
30 _BARRIER_POST_TARGETS+= package-install
31 _BARRIER_POST_TARGETS+= install
33 .for _target_ in ${_BARRIER_POST_TARGETS}
34 . if make(${_target_})
35 _BARRIER_CMDLINE_TARGETS+= ${_target_}
36 . endif
37 .endfor
39 ######################################################################
40 ### barrier (PRIVATE)
41 ######################################################################
42 ### barrier is a helper target that can be used to separate targets
43 ### that should be built in a new make process from being built in
44 ### the current one. The targets that must be built after the "barrier"
45 ### target invokes a new make should be listed in _BARRIER_POST_TARGETS,
46 ### and should be of the form:
47 ###
48 ### .if !defined(_PKGSRC_BARRIER)
49 ### foo: barrier
50 ### .else
51 ### foo: foo's real source dependencies
52 ### .endif
53 ###
54 ### Note that none of foo's real source dependencies should include
55 ### targets that occur before the barrier.
56 ###
58 .PHONY: barrier-error-check
59 barrier-error-check: error-check
61 .PHONY: barrier
62 barrier: ${_BARRIER_PRE_TARGETS} ${_COOKIE.barrier}
63 .if !defined(_PKGSRC_BARRIER)
64 . if defined(PKG_VERBOSE)
65 @${PHASE_MSG} "Invoking \`\`"${_BARRIER_CMDLINE_TARGETS:Q}"'' after barrier for ${PKGNAME}"
66 . endif
67 ${RUN} \
68 if ${TEST} -n "${_PKGSRC_UPDATE_CHECK}" && \
69 ${PKG_INFO} -qe ${PKGNAME}; then \
70 ${PHASE_MSG} "Skipping installation of already handled package"; \
71 else \
72 cd ${.CURDIR} \
73 && ${RECURSIVE_MAKE} ${MAKEFLAGS} _PKGSRC_BARRIER=yes ALLOW_VULNERABLE_PACKAGES= ${_BARRIER_CMDLINE_TARGETS} \
74 || { \
75 exitcode="$$?"; \
76 ${RECURSIVE_MAKE} ${MAKEFLAGS} _PKGSRC_BARRIER=yes barrier-error-check; \
77 exit "$$exitcode"; \
78 }; \
80 . if defined(PKG_VERBOSE)
81 @${PHASE_MSG} "Leaving \`\`"${_BARRIER_CMDLINE_TARGETS:Q}"'' after barrier for ${PKGNAME}"
82 . endif
83 .endif
85 ######################################################################
86 ### barrier-cookie (PRIVATE)
87 ######################################################################
88 ### barrier-cookie creates the "barrier" cookie file.
89 ###
90 ${_COOKIE.barrier}:
91 ${RUN}${MKDIR} ${.TARGET:H}
92 ${RUN}${ECHO} ${PKGNAME} > ${.TARGET}