Undo part of the last commit. OBJFORMAT_PATH controls how the cross
[dragonfly.git] / share / mk / bsd.incs.mk
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.3 2003/08/08 04:18:41 dillon Exp $
3
4 .if !target(__<bsd.init.mk>__)
5 .error bsd.incs.mk cannot be included directly.
6 .endif
7
8 INCSGROUPS?=    INCS
9
10 .if !target(buildincludes)
11 .for group in ${INCSGROUPS}
12 buildincludes: ${${group}}
13 .endfor
14 .endif
15
16 all: buildincludes
17
18 .if !target(installincludes)
19 .for group in ${INCSGROUPS}
20 .if defined(${group}) && !empty(${group})
21
22 ${group}OWN?=   ${BINOWN}
23 ${group}GRP?=   ${BINGRP}
24 ${group}MODE?=  ${NOBINMODE}
25 ${group}DIR?=   ${INCLUDEDIR}
26
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
62
63 .endif defined(${group}) && !empty(${group})
64 .endfor
65
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)
79
80 realinstall: installincludes
81 .ORDER: beforeinstall installincludes