Add precautions so that threads won't race to exit1() and get stuck there.
[dragonfly.git] / share / mk / bsd.incs.mk
blob4ad9897cbd18d317c84ce8eaa423191346a78855
1 # $FreeBSD: src/share/mk/bsd.incs.mk,v 1.3.2.1 2002/07/22 14:21:51 ru Exp $
2 # $DragonFly: src/share/mk/bsd.incs.mk,v 1.6 2005/07/07 11:49:56 corecode Exp $
4 .if !target(__<bsd.init.mk>__)
5 .error bsd.incs.mk cannot be included directly.
6 .endif
8 INCSGROUPS?= INCS
10 .if !target(buildincludes)
11 .for group in ${INCSGROUPS}
12 buildincludes: ${${group}}
13 .endfor
14 .endif
16 all: buildincludes
18 .if !target(installincludes)
19 .for group in ${INCSGROUPS}
20 .if defined(${group}) && !empty(${group})
22 ${group}OWN?= ${BINOWN}
23 ${group}GRP?= ${BINGRP}
24 ${group}MODE?= ${NOBINMODE}
25 ${group}DIR?= ${INCLUDEDIR}
27 _${group}INCS=
28 .for header in ${${group}}
29 .if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \
30 defined(${group}MODE_${header:T}) || defined(${group}DIR_${header:T}) || \
31 defined(${group}NAME_${header:T})
32 ${group}OWN_${header:T}?= ${${group}OWN}
33 ${group}GRP_${header:T}?= ${${group}GRP}
34 ${group}MODE_${header:T}?= ${${group}MODE}
35 ${group}DIR_${header:T}?= ${${group}DIR}
36 .if defined(${group}NAME)
37 ${group}NAME_${header:T}?= ${${group}NAME}
38 .else
39 ${group}NAME_${header:T}?= ${header:T}
40 .endif
41 installincludes: _${group}INS_${header:T}
42 _${group}INS_${header:T}: ${header}
43 ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
44 -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
45 ${.ALLSRC} \
46 ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
47 .else
48 _${group}INCS+= ${header}
49 .endif
50 .endfor
51 .if !empty(_${group}INCS)
52 installincludes: _${group}INS
53 _${group}INS: ${_${group}INCS}
54 .if defined(${group}NAME)
55 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
56 ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
57 .else
58 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
59 ${.ALLSRC} ${DESTDIR}${${group}DIR}
60 .endif
61 .endif
63 .endif # defined(${group}) && !empty(${group})
64 .endfor
66 .if defined(INCSLINKS) && !empty(INCSLINKS)
67 installincludes:
68 @set ${INCSLINKS}; \
69 while test $$# -ge 2; do \
70 l=$$1; \
71 shift; \
72 t=${DESTDIR}$$1; \
73 shift; \
74 ${ECHO} $$t -\> $$l; \
75 ${LN} -fhs $$l $$t; \
76 done; true
77 .endif
78 .endif # !target(installincludes)
80 # include files are not installed when building bootstrap programs
82 .if !defined(BOOTSTRAPPING)
83 realinstall: installincludes
84 .ORDER: beforeinstall installincludes
85 .endif