Module Name:    src
Committed By:   rillig
Date:           Sun Jul 10 21:16:58 UTC 2022

Modified Files:
        src/share/mk: bsd.subdir.mk

Log Message:
bsd.subdir.mk: remove practically dead code

The condition '${dir:H} != ""' is almost always satisfied, since 2001 at
least.  The only input for the modifier ':H' that leads to an empty
string is "/".  It doesn't make sense though to specify the root
directory as a subdirectory.

While here, remove quotes around the left-hand side of comparisons in
conditions.  The quotes have become redundant in 2008, when the .for
loop stopped inserting raw text into the .for loop body.

If the special case for "/" had actually been intended, it should have
been written as the equivalent '.if ${dir} == "/"' instead of hiding
this feature behind an edge case behavior of the modifier ':H'.

Based on the comments, the condition should have been '${dir:M/*}', but
it hadn't been written that way.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/share/mk/bsd.subdir.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.subdir.mk
diff -u src/share/mk/bsd.subdir.mk:1.54 src/share/mk/bsd.subdir.mk:1.55
--- src/share/mk/bsd.subdir.mk:1.54	Sun Jun 10 17:55:11 2018
+++ src/share/mk/bsd.subdir.mk	Sun Jul 10 21:16:57 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.subdir.mk,v 1.54 2018/06/10 17:55:11 christos Exp $
+#	$NetBSD: bsd.subdir.mk,v 1.55 2022/07/10 21:16:57 rillig Exp $
 #	@(#)bsd.subdir.mk	8.1 (Berkeley) 6/8/93
 
 .include <bsd.init.mk>
@@ -6,26 +6,11 @@
 .if !defined(NOSUBDIR)					# {
 
 .for dir in ${SUBDIR}
-.if "${dir}" == ".WAIT"
-# Don't play with .WAIT
-__REALSUBDIR+=${dir}
-.else
-.if "${dir:H}" != ""
-# It is a relative path; make it absolute so exists can't search the path.
-.if exists(${.CURDIR}/${dir}.${MACHINE})
+.if ${dir} != ".WAIT" && exists(${.CURDIR}/${dir}.${MACHINE})
 __REALSUBDIR+=${dir}.${MACHINE}
 .else
 __REALSUBDIR+=${dir}
 .endif
-.else
-# It is an absolute path; leave it alone
-.if exists(${dir}.${MACHINE})
-__REALSUBDIR+=${dir}.${MACHINE}
-.else
-__REALSUBDIR+=${dir}
-.endif
-.endif
-.endif
 .endfor
 
 .if ${MKGROFF} == "yes"

Reply via email to