Subject: Proposal EXCLUDE_SUBDIRS
To: Frederick Bruckman <fb@enteract.com>
From: Frederick Bruckman <fb@enteract.com>
List: tech-misc
Date: 08/23/2000 23:41:39
As I got no response to my last post, I've cleaned this up a little,
and included directions. The idea is to arbitrarily exclude
directories on the command line or in /etc/mk.conf, like so:

.ifndef DESTDIR
EXCLUDE_SUBDIRS=	gnu/libexec gnu/usr.bin/sendmail \
			usr.sbin/amd
.endif # DESTDIR

The 'DESTDIR' thing is in case you ever wanted to do a "make release".
You can't depend on "make(release)" because of all the recursive makes.

I'm ready to commit this, if there are no objections.


Frederick


Index: bsd.README
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.README,v
retrieving revision 1.63.4.1
diff -c -r1.63.4.1 bsd.README
*** bsd.README	2000/06/24 06:59:38	1.63.4.1
--- bsd.README	2000/08/24 04:36:31
***************
*** 75,80 ****
--- 75,88 ----
  UNPRIVILEGED	If defined, don't set the owner/group/mode when installing
  		files or directories.  This allows a non-root "make install".
  
+ EXCLUDE_SUBDIRS	This can be set to a list of directories (or subdirectories)
+ 		to be arbitrarily excluded from the build. Directories are
+ 		specified relative to the top level, to any arbitrary depth,
+ 		such as, for example ``gnu/usr.sbin/sendmail gnu/libexec''.
+ 		Note that this isn't guaranteed to work in the general case,
+ 		as you could easily exclude a directory which builds targets
+ 		that are needed by some other directory.
+ 
  MKCATPAGES	If "no", don't build or install the catman pages.
  
  MKDOC		If "no", don't build or install the documentation.
Index: bsd.subdir.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.subdir.mk,v
retrieving revision 1.38
diff -c -r1.38 bsd.subdir.mk
*** bsd.subdir.mk	2000/06/06 08:54:06	1.38
--- bsd.subdir.mk	2000/08/24 04:36:31
***************
*** 10,15 ****
--- 10,24 ----
  .MAIN:		all
  .endif
  
+ .if defined(EXCLUDE_SUBDIRS)
+ .for __EXCLUDE_SUBDIR in ${EXCLUDE_SUBDIRS}
+ .if ${BSDSRCDIR}/${__EXCLUDE_SUBDIR:H} == ${.CURDIR}
+ __TMP_SUBDIR:=		${SUBDIR:N${__EXCLUDE_SUBDIR:T}}
+ SUBDIR:=		${__TMP_SUBDIR}
+ .endif
+ .endfor
+ .endif # defined(EXCLUDE_SUBDIRS)
+ 
  .for dir in ${SUBDIR}
  .if exists(${dir}.${MACHINE})
  __REALSUBDIR+=${dir}.${MACHINE}