summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2001-04-07 11:13:46 +0000
committerru <ru@FreeBSD.org>2001-04-07 11:13:46 +0000
commit214ce2c82faaecaee72a1a6707f999bb099541a5 (patch)
treebb09775436d5de260af9346a7c1de97876d31a63 /share/mk
parent03f530375fd1f5bead8254ddaa2f5633d4bde401 (diff)
downloadFreeBSD-src-214ce2c82faaecaee72a1a6707f999bb099541a5.zip
FreeBSD-src-214ce2c82faaecaee72a1a6707f999bb099541a5.tar.gz
Introduce SCRIPTS for bsd.prog.mk. See bsd.README for details.
Idea stolen from NetBSD. Reviewed by: bde
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.README5
-rw-r--r--share/mk/bsd.prog.mk31
2 files changed, 34 insertions, 2 deletions
diff --git a/share/mk/bsd.README b/share/mk/bsd.README
index 3032622..ce340d3 100644
--- a/share/mk/bsd.README
+++ b/share/mk/bsd.README
@@ -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>.
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 5fcd08a..7d281b8 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -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
OpenPOWER on IntegriCloud