Author: bdrewery
Date: Wed Aug 31 19:30:52 2016
New Revision: 305147
URL: https://svnweb.freebsd.org/changeset/base/305147

Log:
  Add a 'make print-dir' that simply traverses all directories and prints them.
  
  This is useful for finding connected directories.
  
  MFC after:    1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile
  head/share/mk/bsd.dep.mk
  head/share/mk/bsd.init.mk
  head/share/mk/bsd.subdir.mk
  head/share/mk/local.meta.sys.mk
  head/share/mk/sys.mk

Modified: head/Makefile
==============================================================================
--- head/Makefile       Wed Aug 31 19:30:46 2016        (r305146)
+++ head/Makefile       Wed Aug 31 19:30:52 2016        (r305147)
@@ -109,7 +109,8 @@
 
 # Note: we use this awkward construct to be compatible with FreeBSD's
 # old make used in 10.0 and 9.2 and earlier.
-.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && 
!make(showconfig)
+.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && \
+    !make(showconfig) && !make(print-dir)
 # targets/Makefile plays the role of top-level
 .include "targets/Makefile"
 .else
@@ -132,7 +133,7 @@ TGTS=       all all-man buildenv buildenvvars 
        xdev-links native-xtools stageworld stagekernel stage-packages \
        create-world-packages create-kernel-packages create-packages \
        packages installconfig real-packages sign-packages package-pkg \
-       test-system-compiler
+       print-dir test-system-compiler
 
 # XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
 # It will only work for SUBDIR_TARGETS in make.conf.
@@ -257,6 +258,10 @@ _TARGET_ARCH=      ${XDEV_ARCH}
 _TARGET?=      ${MACHINE}
 _TARGET_ARCH?= ${MACHINE_ARCH}
 
+.if make(print-dir)
+.SILENT:
+.endif
+
 #
 # Make sure we have an up-to-date make(1). Only world and buildworld
 # should do this as those are the initial targets used for upgrades.

Modified: head/share/mk/bsd.dep.mk
==============================================================================
--- head/share/mk/bsd.dep.mk    Wed Aug 31 19:30:46 2016        (r305146)
+++ head/share/mk/bsd.dep.mk    Wed Aug 31 19:30:52 2016        (r305147)
@@ -82,9 +82,9 @@ _meta_filemon=        1
 # since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
 .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
     ${.TARGETS:M*install*} == ${.TARGETS} || \
-    make(analyze) || defined(_meta_filemon)
+    make(analyze) || defined(_meta_filemon) || make(print-dir)
 _SKIP_READ_DEPEND=     1
-.if ${MK_DIRDEPS_BUILD} == "no"
+.if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir)
 .MAKE.DEPENDFILE=      /dev/null
 .endif
 .endif
@@ -198,7 +198,7 @@ CFLAGS+=    ${DEPEND_CFLAGS}
 .endif # !defined(_meta_filemon)
 .endif # defined(SRCS)
 
-.if ${MK_DIRDEPS_BUILD} == "yes"
+.if ${MK_DIRDEPS_BUILD} == "yes" && !make(analyze) && !make(print-dir)
 # Prevent meta.autodep.mk from tracking "local dependencies".
 .depend:
 .include <meta.autodep.mk>

Modified: head/share/mk/bsd.init.mk
==============================================================================
--- head/share/mk/bsd.init.mk   Wed Aug 31 19:30:46 2016        (r305146)
+++ head/share/mk/bsd.init.mk   Wed Aug 31 19:30:52 2016        (r305147)
@@ -31,7 +31,7 @@ _SKIP_BUILD = not building at level 0
 .if ${MK_META_MODE} == "yes"
 .if !exists(/dev/filemon) && \
     ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \
-    !make(showconfig) && ${.MAKEFLAGS:M-V} == ""
+    !make(showconfig) && !make(print-dir) && ${.MAKEFLAGS:M-V} == ""
 .warning The filemon module (/dev/filemon) is not loaded.
 .warning META_MODE is less useful for incremental builds without filemon.
 .warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning.

Modified: head/share/mk/bsd.subdir.mk
==============================================================================
--- head/share/mk/bsd.subdir.mk Wed Aug 31 19:30:46 2016        (r305146)
+++ head/share/mk/bsd.subdir.mk Wed Aug 31 19:30:52 2016        (r305147)
@@ -42,15 +42,15 @@ SUBDIR_TARGETS+= \
                all all-man analyze buildconfig buildfiles buildincludes \
                checkdpadd clean cleandepend cleandir cleanilinks \
                cleanobj depend distribute files includes installconfig \
-               installfiles installincludes realinstall lint maninstall \
-               manlint obj objlink tags \
+               installfiles installincludes print-dir realinstall lint \
+               maninstall manlint obj objlink tags \
 
 # Described above.
 STANDALONE_SUBDIR_TARGETS+= \
                all-man buildconfig buildfiles buildincludes check checkdpadd \
                clean cleandepend cleandir cleanilinks cleanobj files includes \
-               installconfig installincludes installfiles maninstall manlint \
-               obj objlink \
+               installconfig installincludes installfiles print-dir \
+               maninstall manlint obj objlink
 
 # It is safe to install in parallel when staging.
 .if defined(NO_ROOT)
@@ -59,6 +59,16 @@ STANDALONE_SUBDIR_TARGETS+= realinstall
 
 .include <bsd.init.mk>
 
+.if make(print-dir)
+NEED_SUBDIR=   1
+ECHODIR=       :
+.SILENT:
+.if ${RELDIR:U.} != "."
+print-dir:     .PHONY
+       @echo ${RELDIR}
+.endif
+.endif
+
 .if !defined(NEED_SUBDIR)
 .if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && 
!(make(clean*) || make(destroy*))
 .include <meta.subdir.mk>

Modified: head/share/mk/local.meta.sys.mk
==============================================================================
--- head/share/mk/local.meta.sys.mk     Wed Aug 31 19:30:46 2016        
(r305146)
+++ head/share/mk/local.meta.sys.mk     Wed Aug 31 19:30:52 2016        
(r305147)
@@ -214,7 +214,8 @@ CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
 .if !empty(TIME_STAMP)
 TRACER= ${TIME_STAMP} ${:U}
 .endif
-.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH)
+.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
+    !make(print-dir)
 WITH_META_STATS= t
 .endif
 

Modified: head/share/mk/sys.mk
==============================================================================
--- head/share/mk/sys.mk        Wed Aug 31 19:30:46 2016        (r305146)
+++ head/share/mk/sys.mk        Wed Aug 31 19:30:52 2016        (r305147)
@@ -97,7 +97,7 @@ META_MODE?= normal
 # This needs to be done early - before .PATH is computed
 # Don't do this for 'make showconfig' as it enables all options where meta mode
 # is not expected.
-.if !make(showconfig)
+.if !make(showconfig) && !make(print-dir)
 .sinclude <auto.obj.mk>
 .endif
 .endif
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to