Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk bsd.subdir.mk: remove practically dead code



details:   https://anonhg.NetBSD.org/src/rev/dce399cbdbb3
branches:  trunk
changeset: 368426:dce399cbdbb3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 10 21:16:57 2022 +0000

description:
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.

diffstat:

 share/mk/bsd.subdir.mk |  19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diffs (37 lines):

diff -r ffd8ca6a880d -r dce399cbdbb3 share/mk/bsd.subdir.mk
--- a/share/mk/bsd.subdir.mk    Sun Jul 10 21:11:49 2022 +0000
+++ b/share/mk/bsd.subdir.mk    Sun Jul 10 21:16:57 2022 +0000
@@ -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"



Home | Main Index | Thread Index | Old Index