From c7bf15175dbaf1dbb0ee7f709aff0655f1e0f8b4 Mon Sep 17 00:00:00 2001 From: bdrewery Date: Tue, 3 Jan 2017 23:06:39 +0000 Subject: MFC r305147: Add a 'make print-dir' that simply traverses all directories and prints them. --- Makefile | 9 +++++++-- share/mk/bsd.dep.mk | 6 +++--- share/mk/bsd.init.mk | 2 +- share/mk/bsd.subdir.mk | 18 ++++++++++++++---- share/mk/local.meta.sys.mk | 3 ++- share/mk/sys.mk | 2 +- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 0ae57c5..ec6a591 100644 --- a/Makefile +++ b/Makefile @@ -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 buildkernel buildworld \ 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. diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 9b076de..c5d242f 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -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 diff --git a/share/mk/bsd.init.mk b/share/mk/bsd.init.mk index 70cf24b..35cd3b1 100644 --- a/share/mk/bsd.init.mk +++ b/share/mk/bsd.init.mk @@ -32,7 +32,7 @@ all: beforebuild .WAIT .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. diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 504ef3f..7a64203 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -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 +.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 diff --git a/share/mk/local.meta.sys.mk b/share/mk/local.meta.sys.mk index b3b2152..cee4541 100644 --- a/share/mk/local.meta.sys.mk +++ b/share/mk/local.meta.sys.mk @@ -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 diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 3dcd404..00358f2 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -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 .endif .endif -- cgit v1.1