2011-09-10 20:57:35 +04:00
|
|
|
# $NetBSD: bsd.files.mk,v 1.42 2011/09/10 16:57:35 apb Exp $
|
2003-09-03 09:38:09 +04:00
|
|
|
|
|
|
|
.if !defined(_BSD_FILES_MK_)
|
|
|
|
_BSD_FILES_MK_=1
|
2003-07-18 12:26:01 +04:00
|
|
|
|
|
|
|
.include <bsd.init.mk>
|
1999-02-11 16:25:42 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.if !target(__fileinstall)
|
|
|
|
##### Basic targets
|
1997-05-09 17:25:46 +04:00
|
|
|
realinstall: filesinstall
|
2008-12-05 21:51:16 +03:00
|
|
|
realall: filesbuild
|
1997-03-27 20:33:34 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Default values
|
|
|
|
FILESDIR?= ${BINDIR}
|
|
|
|
FILESOWN?= ${BINOWN}
|
|
|
|
FILESGRP?= ${BINGRP}
|
|
|
|
FILESMODE?= ${NONBINMODE}
|
2000-06-06 09:40:47 +04:00
|
|
|
|
2008-12-05 21:51:16 +03:00
|
|
|
##### Build rules
|
|
|
|
filesbuild:
|
|
|
|
.PHONY: filesbuild
|
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Install rules
|
|
|
|
filesinstall:: # ensure existence
|
2004-01-29 04:48:45 +03:00
|
|
|
.PHONY: filesinstall
|
2000-06-06 09:40:47 +04:00
|
|
|
|
2004-05-13 17:05:53 +04:00
|
|
|
configfilesinstall:: .PHONY
|
|
|
|
|
2000-06-06 13:53:29 +04:00
|
|
|
__fileinstall: .USE
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_INSTALL}
|
2001-11-02 08:21:47 +03:00
|
|
|
${INSTALL_FILE} \
|
2000-06-10 18:12:03 +04:00
|
|
|
-o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \
|
|
|
|
-g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \
|
|
|
|
-m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \
|
2002-10-22 22:48:27 +04:00
|
|
|
${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
|
2000-06-06 13:53:29 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.endif # !target(__fileinstall)
|
|
|
|
|
2004-05-13 17:05:53 +04:00
|
|
|
|
2001-05-08 07:19:51 +04:00
|
|
|
.for F in ${FILES:O:u}
|
2001-11-02 08:21:47 +03:00
|
|
|
_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override
|
|
|
|
_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override
|
|
|
|
_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
|
2010-02-03 18:34:37 +03:00
|
|
|
_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}}
|
2001-11-02 08:21:47 +03:00
|
|
|
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUPDATE} == "no"
|
2002-02-12 00:14:58 +03:00
|
|
|
${_F}! ${F} __fileinstall # install rule
|
2008-12-05 21:51:16 +03:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
|
2002-02-12 00:14:58 +03:00
|
|
|
${_F}! .MADE # no build at install
|
|
|
|
.endif
|
|
|
|
.else
|
2001-11-02 08:21:47 +03:00
|
|
|
${_F}: ${F} __fileinstall # install rule
|
2008-12-05 21:51:16 +03:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
|
2001-11-02 08:21:47 +03:00
|
|
|
${_F}: .MADE # no build at install
|
1997-03-27 20:33:34 +03:00
|
|
|
.endif
|
2002-02-12 00:14:58 +03:00
|
|
|
.endif
|
|
|
|
|
2008-12-05 21:51:16 +03:00
|
|
|
.if ${_FDOBUILD} != "no"
|
|
|
|
filesbuild: ${F}
|
|
|
|
CLEANFILES+= ${F}
|
|
|
|
.endif
|
|
|
|
|
2002-02-12 00:14:58 +03:00
|
|
|
filesinstall:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
1997-03-27 20:33:34 +03:00
|
|
|
.endfor
|
1997-05-07 19:53:28 +04:00
|
|
|
|
2004-05-13 17:05:53 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# CONFIGFILES
|
|
|
|
#
|
|
|
|
configinstall: configfilesinstall
|
|
|
|
|
|
|
|
.for F in ${CONFIGFILES:O:u}
|
|
|
|
_FDIR:= ${FILESDIR_${F}:U${FILESDIR}} # dir override
|
|
|
|
_FNAME:= ${FILESNAME_${F}:U${FILESNAME:U${F:T}}} # name override
|
|
|
|
_F:= ${DESTDIR}${_FDIR}/${_FNAME} # installed path
|
2010-02-03 18:34:37 +03:00
|
|
|
_FDOBUILD:= ${FILESBUILD_${F}:U${FILESBUILD:Uno}}
|
2004-05-13 17:05:53 +04:00
|
|
|
|
|
|
|
.if ${MKUPDATE} == "no"
|
|
|
|
${_F}! ${F} __fileinstall # install rule
|
2008-12-05 21:51:16 +03:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
|
2004-05-13 17:05:53 +04:00
|
|
|
${_F}! .MADE # no build at install
|
|
|
|
.endif
|
|
|
|
.else
|
|
|
|
${_F}: ${F} __fileinstall # install rule
|
2008-12-05 21:51:16 +03:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${F}) && (${_FDOBUILD} == "no")
|
2004-05-13 17:05:53 +04:00
|
|
|
${_F}: .MADE # no build at install
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2008-12-05 21:51:16 +03:00
|
|
|
.if ${_FDOBUILD} != "no"
|
|
|
|
filesbuild: ${F}
|
|
|
|
CLEANFILES+= ${F}
|
|
|
|
.endif
|
|
|
|
|
2004-05-13 17:05:53 +04:00
|
|
|
configfilesinstall:: ${_F}
|
|
|
|
.PRECIOUS: ${_F} # keep if install fails
|
|
|
|
.endfor
|
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.undef _FDIR
|
|
|
|
.undef _FNAME
|
|
|
|
.undef _F
|
2003-09-03 09:38:09 +04:00
|
|
|
|
|
|
|
|
|
|
|
#
|
2003-09-20 10:20:41 +04:00
|
|
|
# BUILDSYMLINKS
|
2003-09-03 09:38:09 +04:00
|
|
|
#
|
2003-09-20 10:20:41 +04:00
|
|
|
.if defined(BUILDSYMLINKS) # {
|
2003-09-03 09:38:09 +04:00
|
|
|
|
2003-09-20 10:20:41 +04:00
|
|
|
.for _SL _TL in ${BUILDSYMLINKS}
|
|
|
|
BUILDSYMLINKS.s+= ${_SL}
|
|
|
|
BUILDSYMLINKS.t+= ${_TL}
|
2003-09-03 09:38:09 +04:00
|
|
|
${_TL}: ${_SL}
|
2008-08-25 12:11:04 +04:00
|
|
|
${_MKMSG} "symlink " ${.CURDIR:T}/${.TARGET}
|
2003-09-03 09:38:09 +04:00
|
|
|
rm -f ${.TARGET}
|
|
|
|
ln -s ${.ALLSRC} ${.TARGET}
|
|
|
|
.endfor
|
|
|
|
|
2003-09-20 10:20:41 +04:00
|
|
|
realall: ${BUILDSYMLINKS.t}
|
2003-09-03 09:38:09 +04:00
|
|
|
|
2011-09-10 20:57:35 +04:00
|
|
|
CLEANDIRFILES+= ${BUILDSYMLINKS.t}
|
2003-09-03 09:38:09 +04:00
|
|
|
|
|
|
|
.endif # }
|
|
|
|
|
2004-03-18 05:00:00 +03:00
|
|
|
#
|
|
|
|
# .uue -> "" handling (i.e. decode a given binary/object)
|
2004-03-18 06:26:55 +03:00
|
|
|
#
|
|
|
|
# UUDECODE_FILES - List of files which are stored in the source tree
|
|
|
|
# as <file>.uue and should be uudecoded.
|
|
|
|
#
|
2007-12-11 17:06:04 +03:00
|
|
|
# UUDECODE_FILES_RENAME_fn - For this file, rename its output to the provided
|
2004-03-18 06:26:55 +03:00
|
|
|
# name (handled via -p and redirecting stdout)
|
|
|
|
|
2004-03-18 05:00:00 +03:00
|
|
|
.if defined(UUDECODE_FILES) # {
|
|
|
|
.SUFFIXES: .uue
|
|
|
|
|
|
|
|
.uue:
|
|
|
|
${_MKTARGET_CREATE}
|
2004-05-17 16:58:17 +04:00
|
|
|
rm -f ${.TARGET} ${.TARGET}.tmp
|
|
|
|
${TOOL_UUDECODE} -p ${.IMPSRC} > ${.TARGET}.tmp \
|
|
|
|
&& mv ${.TARGET}.tmp ${UUDECODE_FILES_RENAME_${.TARGET}:U${.TARGET}}
|
2004-03-18 05:00:00 +03:00
|
|
|
|
|
|
|
realall: ${UUDECODE_FILES}
|
|
|
|
|
2004-05-17 16:58:17 +04:00
|
|
|
CLEANUUDECODE_FILES=${UUDECODE_FILES} ${UUDECODE_FILES:=.tmp}
|
2004-03-19 09:10:27 +03:00
|
|
|
.for i in ${UUDECODE_FILES}
|
|
|
|
CLEANUUDECODE_FILES+=${UUDECODE_FILES_RENAME_${i}}
|
|
|
|
.endfor
|
|
|
|
|
2011-09-10 20:57:35 +04:00
|
|
|
CLEANFILES+= ${CLEANUUDECODE_FILES}
|
2004-03-18 05:00:00 +03:00
|
|
|
.endif # }
|
|
|
|
|
2004-03-30 02:26:21 +04:00
|
|
|
##### Pull in related .mk logic
|
|
|
|
.include <bsd.obj.mk>
|
|
|
|
.include <bsd.sys.mk>
|
2011-09-10 20:57:35 +04:00
|
|
|
.include <bsd.clean.mk>
|
2004-03-30 02:26:21 +04:00
|
|
|
|
2003-09-03 09:38:09 +04:00
|
|
|
.endif # !defined(_BSD_FILES_MK_)
|