Introduce SCRIPTS for bsd.prog.mk. See bsd.README for details.

Idea stolen from NetBSD.

Reviewed by:	bde
This commit is contained in:
Ruslan Ermilov 2001-04-07 11:13:46 +00:00
parent b16307b534
commit f7ee8cfe3f
2 changed files with 34 additions and 2 deletions

View File

@ -250,6 +250,11 @@ SUBDIR A list of subdirectories that should be built as well.
Each of the targets will execute the same target in the
subdirectories.
SCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
The installation is controlled by the SCRIPTSNAME, SCRIPTSOWN,
SCRIPTSGRP, SCRIPTSMODE, SCRIPTSDIR variables that can be
further specialized by SCRIPTS<VAR>_<script>.
The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
if it exists, as well as the include file <bsd.man.mk>.

View File

@ -68,9 +68,9 @@ MAN1= ${MAN}
.MAIN: all
.if !defined(NOMAN)
all: objwarn ${PROG} all-man _SUBDIR
all: objwarn ${PROG} ${SCRIPTS} all-man _SUBDIR
.else
all: objwarn ${PROG} _SUBDIR
all: objwarn ${PROG} ${SCRIPTS} _SUBDIR
.endif
CLEANFILES+= ${PROG} ${OBJS}
@ -132,6 +132,33 @@ realinstall: beforeinstall
done; true
.endif
.if defined(SCRIPTS) && !empty(SCRIPTS)
realinstall: _scriptsinstall
SCRIPTSDIR?= ${BINDIR}
SCRIPTSOWN?= ${BINOWN}
SCRIPTSGRP?= ${BINGRP}
SCRIPTSMODE?= ${BINMODE}
.for script in ${SCRIPTS}
.if defined(SCRIPTSNAME)
SCRIPTSNAME_${script:T}?= ${SCRIPTSNAME}
.else
SCRIPTSNAME_${script:T}?= ${script:T:R}
.endif
SCRIPTSDIR_${script:T}?= ${SCRIPTSDIR}
SCRIPTSOWN_${script:T}?= ${SCRIPTSOWN}
SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP}
SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
_scriptsinstall: SCRIPTSINS_${script:T}
SCRIPTSINS_${script:T}: ${script}
${INSTALL} ${COPY} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
-g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
${_INSTALLFLAGS} ${.ALLSRC} \
${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}}
.endfor
.endif
install: afterinstall _SUBDIR
.if !defined(NOMAN)
afterinstall: realinstall maninstall