summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.files.mk
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-06-03 14:49:34 +0000
committerru <ru@FreeBSD.org>2002-06-03 14:49:34 +0000
commitf24282207af24197e2a44168f11aad864ba3a1dd (patch)
treede796cd01f625eac67ff08f9b8f94b359475f5f0 /share/mk/bsd.files.mk
parent22070ef7190bd598b0d904db2e88a67743b8a962 (diff)
downloadFreeBSD-src-f24282207af24197e2a44168f11aad864ba3a1dd.zip
FreeBSD-src-f24282207af24197e2a44168f11aad864ba3a1dd.tar.gz
Reimplement FILES support using bsd.files.mk with the
same set of features as in recently added bsd.incs.mk (FILESGROUPS, accessibility from both bsd.prog.mk and bsd.lib.mk, de-pessimized typical installation path, etc.) New standard targets: buildfiles, installfiles, and files (buildfiles + installfiles).
Diffstat (limited to 'share/mk/bsd.files.mk')
-rw-r--r--share/mk/bsd.files.mk68
1 files changed, 68 insertions, 0 deletions
diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk
new file mode 100644
index 0000000..daa8c88
--- /dev/null
+++ b/share/mk/bsd.files.mk
@@ -0,0 +1,68 @@
+# $FreeBSD$
+
+.if !target(__<bsd.init.mk>__)
+.error bsd.files.mk cannot be included directly.
+.endif
+
+FILESGROUPS?= FILES
+
+.if !target(buildfiles)
+.for group in ${FILESGROUPS}
+buildfiles: ${${group}}
+.endfor
+.endif
+
+all: buildfiles
+
+.if !target(installfiles)
+.for group in ${FILESGROUPS}
+.if defined(${group}) && !empty(${group})
+
+${group}OWN?= ${SHAREOWN}
+${group}GRP?= ${SHAREGRP}
+${group}MODE?= ${SHAREMODE}
+${group}DIR?= ${BINDIR}
+
+_${group}FILES=
+.for file in ${${group}}
+.if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \
+ defined(${group}MODE_${file:T}) || defined(${group}DIR_${file:T}) || \
+ defined(${group}NAME_${file:T})
+${group}OWN_${file:T}?= ${${group}OWN}
+${group}GRP_${file:T}?= ${${group}GRP}
+${group}MODE_${file:T}?= ${${group}MODE}
+${group}DIR_${file:T}?= ${${group}DIR}
+.if defined(${group}NAME)
+${group}NAME_${file:T}?= ${${group}NAME}
+.else
+${group}NAME_${file:T}?= ${file:T}
+.endif
+installfiles: _${group}INS_${file:T}
+_${group}INS_${file:T}: ${file}
+ ${INSTALL} ${COPY} -o ${${group}OWN_${.ALLSRC:T}} \
+ -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
+ ${.ALLSRC} \
+ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
+.else
+_${group}FILES+= ${file}
+.endif
+.endfor
+.if !empty(_${group}FILES)
+installfiles: _${group}INS
+_${group}INS: ${_${group}FILES}
+.if defined(${group}NAME)
+ ${INSTALL} ${COPY} -o ${${group}OWN} -g ${${group}GRP} \
+ -m ${${group}MODE} ${.ALLSRC} \
+ ${DESTDIR}${${group}DIR}/${${group}NAME}
+.else
+ ${INSTALL} ${COPY} -o ${${group}OWN} -g ${${group}GRP} \
+ -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
+.endif
+.endif
+
+.endif defined(${group}) && !empty(${group})
+.endfor
+
+.endif !target(installfiles)
+
+realinstall: installfiles
OpenPOWER on IntegriCloud