retire nonsymbolic rootdev, dev2name
[minix.git] / share / mk / bsd.files.mk
blobee5956c3308839ce3a7ea250275e34e523d4cb89
1 # $NetBSD: bsd.files.mk,v 1.40 2008/12/05 18:51:16 cube Exp $
3 .if !defined(_MINIX_FILES_MK_)
4 _MINIX_FILES_MK_=1
6 .include <bsd.init.mk>
8 .if !target(__fileinstall)
9 ##### Basic targets
10 realinstall: filesinstall
11 realall: filesbuild
13 ##### Default values
14 FILESDIR?= ${BINDIR}
15 FILESOWN?= ${BINOWN}
16 FILESGRP?= ${BINGRP}
17 FILESMODE?= ${NONBINMODE}
19 ##### Build rules
20 filesbuild:
21 .PHONY: filesbuild
23 ##### Install rules
24 filesinstall:: # ensure existence
25 .PHONY: filesinstall
27 configfilesinstall:: .PHONY
29 __fileinstall: .USE
30 ${_MKTARGET_INSTALL}
31 ${INSTALL_FILE} \
32 -o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \
33 -g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \
34 -m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \
35 ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
37 .endif # !target(__fileinstall)
40 .for F in ${FILES:O:u}
41 _FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override
42 _FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override
43 _F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
44 _FDOBUILD:= ${FILESBUILD_${F}:Uno}
46 .if ${MKUPDATE} == "no"
47 ${_F}! ${F} __fileinstall # install rule
48 .if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
49 ${_F}! .MADE # no build at install
50 .endif
51 .else
52 ${_F}: ${F} __fileinstall # install rule
53 .if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
54 ${_F}: .MADE # no build at install
55 .endif
56 .endif
58 .if ${_FDOBUILD} != "no"
59 filesbuild: ${F}
60 CLEANFILES+= ${F}
61 .endif
63 filesinstall:: ${_F}
64 .PRECIOUS: ${_F} # keep if install fails
65 .endfor
69 # CONFIGFILES
71 configinstall: configfilesinstall
73 .for F in ${CONFIGFILES:O:u}
74 _FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override
75 _FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override
76 _F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
77 _FDOBUILD:= ${FILESBUILD_${F}:Uno}
79 .if ${MKUPDATE} == "no"
80 ${_F}! ${F} __fileinstall # install rule
81 .if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
82 ${_F}! .MADE # no build at install
83 .endif
84 .else
85 ${_F}: ${F} __fileinstall # install rule
86 .if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
87 ${_F}: .MADE # no build at install
88 .endif
89 .endif
91 .if ${_FDOBUILD} != "no"
92 filesbuild: ${F}
93 CLEANFILES+= ${F}
94 .endif
96 configfilesinstall:: ${_F}
97 .PRECIOUS: ${_F} # keep if install fails
98 .endfor
100 .undef _FDIR
101 .undef _FNAME
102 .undef _F
106 # BUILDSYMLINKS
108 .if defined(BUILDSYMLINKS) # {
110 .for _SL _TL in ${BUILDSYMLINKS}
111 BUILDSYMLINKS.s+= ${_SL}
112 BUILDSYMLINKS.t+= ${_TL}
113 ${_TL}: ${_SL}
114 ${_MKMSG} "symlink " ${.CURDIR:T}/${.TARGET}
115 rm -f ${.TARGET}
116 ln -s ${.ALLSRC} ${.TARGET}
117 .endfor
119 realall: ${BUILDSYMLINKS.t}
121 cleandir: cleanbuildsymlinks
122 cleanbuildsymlinks: .PHONY
123 rm -f ${BUILDSYMLINKS.t}
125 .endif # }
128 # .uue -> "" handling (i.e. decode a given binary/object)
130 # UUDECODE_FILES - List of files which are stored in the source tree
131 # as <file>.uue and should be uudecoded.
133 # UUDECODE_FILES_RENAME_fn - For this file, rename its output to the provided
134 # name (handled via -p and redirecting stdout)
136 .if defined(UUDECODE_FILES) # {
137 .SUFFIXES: .uue
139 .uue:
140 ${_MKTARGET_CREATE}
141 rm -f ${.TARGET} ${.TARGET}.tmp
142 ${TOOL_UUDECODE} -p ${.IMPSRC} > ${.TARGET}.tmp \
143 && mv ${.TARGET}.tmp ${UUDECODE_FILES_RENAME_${.TARGET}:U${.TARGET}}
145 realall: ${UUDECODE_FILES}
147 CLEANUUDECODE_FILES=${UUDECODE_FILES} ${UUDECODE_FILES:=.tmp}
148 .for i in ${UUDECODE_FILES}
149 CLEANUUDECODE_FILES+=${UUDECODE_FILES_RENAME_${i}}
150 .endfor
152 clean: cleanuudecodefiles
153 cleanuudecodefiles: .PHONY
154 rm -f ${CLEANUUDECODE_FILES}
155 .endif # }
157 ##### Pull in related .mk logic
158 .include <bsd.obj.mk>
159 .include <bsd.sys.mk>
161 .endif # !defined(_MINIX_FILES_MK_)