unstack, sort: cleanup and improvement
[minix.git] / share / mk / bsd.info.mk
bloba24761a0798624ad7181d2f04ce21f2e6e63e356
1 # $NetBSD: bsd.info.mk,v 1.39 2009/02/28 19:18:52 joerg Exp $
3 .include <bsd.init.mk>
5 ##### Basic targets
6 cleandir: cleaninfo
7 realinstall: infoinstall
9 ##### Default values
10 INFOFLAGS?=
12 INFOFILES?=
14 ##### Build rules
15 .if ${MKINFO} != "no"
17 INFOFILES= ${TEXINFO:C/\.te?xi(nfo)?$/.info/}
19 realall: ${INFOFILES}
20 .NOPATH: ${INFOFILES}
22 .SUFFIXES: .txi .texi .texinfo .info
24 .txi.info .texi.info .texinfo.info:
25 ${_MKTARGET_CREATE}
26 ${TOOL_MAKEINFO} ${INFOFLAGS} --no-split --no-version-header -o ${.TARGET} ${.IMPSRC}
28 .endif # ${MKINFO} != "no"
30 ##### Install rules
31 infoinstall:: # ensure existence
32 .PHONY: infoinstall
34 .if ${MKINFO} != "no"
36 INFODIRFILE=${DESTDIR}${INFODIR}/dir
38 # serialize access to ${INFODIRFILE}; needed for parallel makes
39 __infoinstall: .USE
40 ${_MKTARGET_INSTALL}
41 ${INSTALL_FILE} \
42 -o ${INFOOWN_${.ALLSRC:T}:U${INFOOWN}} \
43 -g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}} \
44 -m ${INFOMODE_${.ALLSRC:T}:U${INFOMODE}} \
45 ${.ALLSRC} ${.TARGET}
46 @[ -f ${INFODIRFILE} ] && \
47 while ! ln ${INFODIRFILE} ${INFODIRFILE}.lock 2> /dev/null; \
48 do sleep 1; done; \
49 ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} -r ${.TARGET} 2> /dev/null; \
50 ${TOOL_INSTALL_INFO} -d ${INFODIRFILE} ${.TARGET}; \
51 rm -f ${INFODIRFILE}.lock
54 .for F in ${INFOFILES:O:u}
55 _FDIR:= ${INFODIR_${F}:U${INFODIR}} # dir overrides
56 _FNAME:= ${INFONAME_${F}:U${INFONAME:U${F:T}}} # name overrides
57 _F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
59 .if ${MKUPDATE} == "no"
60 ${_F}! ${F} __infoinstall # install rule
61 .if !defined(BUILD) && !make(all) && !make(${F})
62 ${_F}! .MADE # no build at install
63 .endif
64 .else
65 ${_F}: ${F} __infoinstall # install rule
66 .if !defined(BUILD) && !make(all) && !make(${F})
67 ${_F}: .MADE # no build at install
68 .endif
69 .endif
71 infoinstall:: ${_F}
72 .PRECIOUS: ${_F} # keep if install fails
73 .endfor
75 .undef _FDIR
76 .undef _FNAME
77 .undef _F
78 .endif # ${MKINFO} != "no"
80 ##### Clean rules
81 CLEANFILES+= ${INFOFILES}
83 cleaninfo: .PHONY
84 .if !empty(CLEANFILES)
85 rm -f ${CLEANFILES}
86 .endif
88 ##### Pull in related .mk logic
89 .include <bsd.obj.mk>
90 .include <bsd.sys.mk>
92 ${TARGETS}: # ensure existence