Subject: Proposal: cd /usr/pkgsrc/foo ; make bar
To: None <tech-pkg@netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: tech-pkg
Date: 12/03/1998 02:40:28
I've had two occasions now where I wanted bsd.pkg.subdir.mk recognize
custom targets and execute them in every pkg of a category, just like
build, install, ... do:
1. When I made a custom "hf-install" target (that did a "make install"
   unless there was a precompiled pkg available, which was pkg_add'ed
   then instead)
2. Now, running all benchmarks in that category by typing "make
   benchmark". 

I'd propose to solve this by adding a generic ${PKG_MISC_TARGETS} target
(targets) to the loop in bsd.pkg.subdir.mk, containing whatever additional
commands should be handled, see the patch to bsd.pkg.subdir.mk below.

A solution to the scenario #1 above would then be to add
"PKG_MISC_TARGETS+=hf-install" to /etc/mk.conf, for #2, something like
"PKG_MISC_TARGETS=benchmark" could be added to the
pkgsrc/benchmarks/Makefile, see patch below. 

Any objections to commit this? (If not, I'll probably do it on the
weekend). 


 - Hubert

Index: mk/bsd.pkg.subdir.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.subdir.mk,v
retrieving revision 1.21
diff -u -r1.21 bsd.pkg.subdir.mk
--- bsd.pkg.subdir.mk	1998/09/23 13:09:33	1.21
+++ bsd.pkg.subdir.mk	1998/12/03 01:28:14
@@ -90,7 +90,7 @@
 
 .for __target in all fetch fetch-list package extract configure \
 		 build clean distclean depend describe reinstall tags checksum \
-		 mirror-distfiles deinstall
+		 mirror-distfiles deinstall ${PKG_MISC_TARGETS}
 .if !target(__target)
 ${__target}: _SUBDIRUSE
 .endif
Index: benchmarks/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/benchmarks/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile	1998/11/20 15:31:21	1.11
+++ Makefile	1998/12/03 01:28:14
@@ -2,6 +2,8 @@
 # FreeBSD Id: Makefile,v 1.4 1997/02/16 13:32:59 andreas Exp
 #
 
+PKG_MISC_TARGETS?=	benchmark
+
     SUBDIR += benchfft
     SUBDIR += bonnie
     SUBDIR += bytebench


-- 
Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>