From af2dc86820850767516c56fda409efaef5a20436 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Mon, 3 Jun 2002 14:49:34 +0000 Subject: [PATCH] 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). --- Makefile | 2 +- share/mk/Makefile | 3 +- share/mk/bsd.files.mk | 68 ++++++++++++++++++++++++++++++++++++++++++ share/mk/bsd.lib.mk | 1 + share/mk/bsd.prog.mk | 30 ++----------------- share/mk/bsd.subdir.mk | 2 +- 6 files changed, 75 insertions(+), 31 deletions(-) create mode 100644 share/mk/bsd.files.mk diff --git a/Makefile b/Makefile index 463e1996c77f..5549368b492f 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ TGTS= all all-man buildkernel buildworld checkdpadd clean \ reinstallkernel installmost installworld libraries lint maninstall \ mk most obj objlink regress rerelease tags update -BITGTS= includes +BITGTS= files includes BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} .ORDER: buildworld installworld diff --git a/share/mk/Makefile b/share/mk/Makefile index 9dd75ce93e84..563bd39087bc 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -2,7 +2,8 @@ # @(#)Makefile 8.1 (Berkeley) 6/8/93 FILES= bsd.README -FILES+= bsd.cpu.mk bsd.dep.mk bsd.doc.mk bsd.info.mk bsd.incs.mk bsd.init.mk +FILES+= bsd.cpu.mk bsd.dep.mk bsd.doc.mk bsd.files.mk +FILES+= bsd.info.mk bsd.incs.mk bsd.init.mk FILES+= bsd.kern.mk bsd.kmod.mk FILES+= bsd.lib.mk bsd.libnames.mk bsd.man.mk bsd.nls.mk bsd.obj.mk bsd.own.mk FILES+= bsd.port.mk bsd.port.post.mk bsd.port.pre.mk bsd.port.subdir.mk diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk new file mode 100644 index 000000000000..daa8c88e0e40 --- /dev/null +++ b/share/mk/bsd.files.mk @@ -0,0 +1,68 @@ +# $FreeBSD$ + +.if !target(____) +.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 diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 701d3f426487..a340982ff7af 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -339,6 +339,7 @@ realinstall: done; true .endif +.include .include .if !defined(NOMAN) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 6ecbf5062f07..505a5f9f8a20 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -73,7 +73,7 @@ MAN1= ${MAN} .endif .endif -all: objwarn ${PROG} ${SCRIPTS} ${FILES} +all: objwarn ${PROG} ${SCRIPTS} .if !defined(NOMAN) all: _manpages .endif @@ -169,33 +169,7 @@ _SCRIPTSINS_${script:T}: ${script} .endfor .endif -.if defined(FILES) && !empty(FILES) -realinstall: _filesinstall - -FILESDIR?= ${BINDIR} -FILESOWN?= ${SHAREOWN} -FILESGRP?= ${SHAREGRP} -FILESMODE?= ${SHAREMODE} - -.for file in ${FILES} -.if defined(FILESNAME) -FILESNAME_${file:T}?= ${FILESNAME} -.else -FILESNAME_${file:T}?= ${file:T} -.endif -FILESDIR_${file:T}?= ${FILESDIR} -FILESOWN_${file:T}?= ${FILESOWN} -FILESGRP_${file:T}?= ${FILESGRP} -FILESMODE_${file:T}?= ${FILESMODE} -_filesinstall: _FILESINS_${file:T} -_FILESINS_${file:T}: ${file} - ${INSTALL} ${COPY} -o ${FILESOWN_${.ALLSRC:T}} \ - -g ${FILESGRP_${.ALLSRC:T}} -m ${FILESMODE_${.ALLSRC:T}} \ - ${.ALLSRC} \ - ${DESTDIR}${FILESDIR_${.ALLSRC:T}}/${FILESNAME_${.ALLSRC:T}} -.endfor -.endif - +.include .include .if !defined(NOMAN) diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 20a38d7292a8..492503597480 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -63,7 +63,7 @@ ${SUBDIR}:: ${__target}: _SUBDIR .endfor -.for __target in includes +.for __target in files includes .for __stage in build install ${__stage}${__target}: .if make(${__stage}${__target})