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
This commit is contained in:
Bryan Drewery 2016-08-31 19:30:52 +00:00
parent 776d5e11e9
commit 9e2f435fc1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305147
6 changed files with 28 additions and 12 deletions

View File

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

View File

@ -82,9 +82,9 @@ _meta_filemon= 1
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used.
.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \ .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
${.TARGETS:M*install*} == ${.TARGETS} || \ ${.TARGETS:M*install*} == ${.TARGETS} || \
make(analyze) || defined(_meta_filemon) make(analyze) || defined(_meta_filemon) || make(print-dir)
_SKIP_READ_DEPEND= 1 _SKIP_READ_DEPEND= 1
.if ${MK_DIRDEPS_BUILD} == "no" .if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir)
.MAKE.DEPENDFILE= /dev/null .MAKE.DEPENDFILE= /dev/null
.endif .endif
.endif .endif
@ -198,7 +198,7 @@ CFLAGS+= ${DEPEND_CFLAGS}
.endif # !defined(_meta_filemon) .endif # !defined(_meta_filemon)
.endif # defined(SRCS) .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". # Prevent meta.autodep.mk from tracking "local dependencies".
.depend: .depend:
.include <meta.autodep.mk> .include <meta.autodep.mk>

View File

@ -31,7 +31,7 @@ _SKIP_BUILD = not building at level 0
.if ${MK_META_MODE} == "yes" .if ${MK_META_MODE} == "yes"
.if !exists(/dev/filemon) && \ .if !exists(/dev/filemon) && \
${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_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 The filemon module (/dev/filemon) is not loaded.
.warning META_MODE is less useful for incremental builds without filemon. .warning META_MODE is less useful for incremental builds without filemon.
.warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning. .warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning.

View File

@ -42,15 +42,15 @@ SUBDIR_TARGETS+= \
all all-man analyze buildconfig buildfiles buildincludes \ all all-man analyze buildconfig buildfiles buildincludes \
checkdpadd clean cleandepend cleandir cleanilinks \ checkdpadd clean cleandepend cleandir cleanilinks \
cleanobj depend distribute files includes installconfig \ cleanobj depend distribute files includes installconfig \
installfiles installincludes realinstall lint maninstall \ installfiles installincludes print-dir realinstall lint \
manlint obj objlink tags \ maninstall manlint obj objlink tags \
# Described above. # Described above.
STANDALONE_SUBDIR_TARGETS+= \ STANDALONE_SUBDIR_TARGETS+= \
all-man buildconfig buildfiles buildincludes check checkdpadd \ all-man buildconfig buildfiles buildincludes check checkdpadd \
clean cleandepend cleandir cleanilinks cleanobj files includes \ clean cleandepend cleandir cleanilinks cleanobj files includes \
installconfig installincludes installfiles maninstall manlint \ installconfig installincludes installfiles print-dir \
obj objlink \ maninstall manlint obj objlink
# It is safe to install in parallel when staging. # It is safe to install in parallel when staging.
.if defined(NO_ROOT) .if defined(NO_ROOT)
@ -59,6 +59,16 @@ STANDALONE_SUBDIR_TARGETS+= realinstall
.include <bsd.init.mk> .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 !defined(NEED_SUBDIR)
.if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*)) .if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*))
.include <meta.subdir.mk> .include <meta.subdir.mk>

View File

@ -214,7 +214,8 @@ CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
.if !empty(TIME_STAMP) .if !empty(TIME_STAMP)
TRACER= ${TIME_STAMP} ${:U} TRACER= ${TIME_STAMP} ${:U}
.endif .endif
.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) .if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
!make(print-dir)
WITH_META_STATS= t WITH_META_STATS= t
.endif .endif

View File

@ -97,7 +97,7 @@ META_MODE?= normal
# This needs to be done early - before .PATH is computed # 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 # Don't do this for 'make showconfig' as it enables all options where meta mode
# is not expected. # is not expected.
.if !make(showconfig) .if !make(showconfig) && !make(print-dir)
.sinclude <auto.obj.mk> .sinclude <auto.obj.mk>
.endif .endif
.endif .endif