1# $Id: scripts.mk,v 1.2 2006/11/09 01:55:18 sjg Exp $ 2 3.include <init.mk> 4 5.if defined(SCRIPTS) 6 7all: ${SCRIPTS} 8 9.PHONY: scriptsinstall 10install: scriptsinstall 11 12.if !target(scriptsinstall) 13SCRIPTSDIR?= ${BINDIR} 14SCRIPTSOWN?= ${BINOWN} 15SCRIPTSGRP?= ${BINGRP} 16SCRIPTSMODE?= ${BINMODE} 17 18# how we get script name from src 19SCRIPTSNAME_MOD?=T:R 20 21script_targets= ${SCRIPTS:@s@${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}@} 22 23scriptsinstall:: ${script_targets} 24 25.PRECIOUS: ${script_targets} 26.if !defined(UPDATE) 27.PHONY: ${script_targets} 28.endif 29 30INSTALL_FLAGS?= ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \ 31 -o ${OWN_${.TARGET:T}:U${SCRIPTSOWN}} \ 32 -g ${GRP_${.TARGET:T}:U${SCRIPTSGRP}} \ 33 -m ${MODE_${.TARGET:T}:U${SCRIPTSMODE}} 34 35__SCRIPTINSTALL_USE: .USE 36 ${INSTALL} ${INSTALL_FLAGS_${.TARGET:T}:U${INSTALL_FLAGS}} \ 37 ${.ALLSRC} ${.TARGET} 38 39.for s in ${SCRIPTS} 40.if !defined(BUILD) && !make(all) && !make(${s}) 41${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}: .MADE 42.endif 43${DESTDIR}${SCRIPTSDIR_$s:U${SCRIPTSDIR}}/${SCRIPTSNAME_$s:U${s:${SCRIPTSNAME_MOD}}}: ${s} __SCRIPTINSTALL_USE 44.endfor 45.endif 46 47.endif 48 49.if !target(scriptsinstall) 50scriptsinstall:: 51.endif 52 53