summaryrefslogtreecommitdiffstats
path: root/20130123/mk/scripts.mk
blob: efd65f94ccd7ed59325de926cf80b52ace619df5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# $Id: scripts.mk,v 1.2 2006/11/09 01:55:18 sjg Exp $

.include <init.mk>

.if defined(SCRIPTS) 

all:	${SCRIPTS}

.PHONY:		scriptsinstall
install:	scriptsinstall

.if !target(scriptsinstall)
SCRIPTSDIR?=	${BINDIR}
SCRIPTSOWN?=	${BINOWN}
SCRIPTSGRP?=	${BINGRP}
SCRIPTSMODE?=	${BINMODE}

# how we get script name from src
SCRIPTSNAME_MOD?=T:R

script_targets= ${SCRIPTS:@s@${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}@}

scriptsinstall:: ${script_targets}

.PRECIOUS: ${script_targets}
.if !defined(UPDATE)
.PHONY: ${script_targets}
.endif

INSTALL_FLAGS?= ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
	-o ${OWN_${.TARGET:T}:U${SCRIPTSOWN}} \
	-g ${GRP_${.TARGET:T}:U${SCRIPTSGRP}} \
	-m ${MODE_${.TARGET:T}:U${SCRIPTSMODE}}

__SCRIPTINSTALL_USE: .USE
	${INSTALL} ${INSTALL_FLAGS_${.TARGET:T}:U${INSTALL_FLAGS}} \
	    ${.ALLSRC} ${.TARGET}

.for s in ${SCRIPTS}
.if !defined(BUILD) && !make(all) && !make(${s})
${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}:	.MADE
.endif
${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}:	${s} __SCRIPTINSTALL_USE
.endfor
.endif

.endif

.if !target(scriptsinstall)
scriptsinstall::
.endif

OpenPOWER on IntegriCloud