Subject: bin/9566: .BEGIN target does not follow dependencies
To: None <gnats-bugs@gnats.netbsd.org>
From: None <arnej@pvv.org>
List: netbsd-bugs
Date: 03/07/2000 12:54:59
>Number: 9566
>Category: bin
>Synopsis: .BEGIN target does not follow dependencies
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 7 12:54:00 2000
>Last-Modified:
>Originator: Arne H Juul
>Organization:
PVV
>Release: NetBSD-current as of Mar 7 2000
>Environment:
System: NetBSD nocturne.fast.no 1.4T NetBSD 1.4T (NOCTURNE) #4: Sat Feb 26 14:01:58 CET 2000 arnej@nocturne.fast.no:/usr/src/sys/arch/i386/compile/NOCTURNE i386
>Description:
The documentation for make states:
.BEGIN Any command lines attached to this target are executed before
anything else is done.
This is *exactly* right: only command lines attached to .BEGIN
will be run, make won't process .BEGIN as a normal make target,
so it's useless to have .BEGIN depend on anything. Similar for
.END and .INTERRUPT. Note that there's several places in -current
sources where this mistake has been made.
>How-To-Repeat:
Test with this Makefile:
all:
@echo "testing .BEGIN and .END processing."
@echo "press ^C to test .INTERRUPT processing."
sleep 3
.BEGIN: begindep
@echo begin target has been run
.END: enddep
@echo end target has been run
.INTERRUPT: interdep
@echo interrupt target has been run
begindep:
@echo begin dependency has been run
enddep:
@echo end dependency has been run
interdep:
@echo interrupt dependency has been run
>Fix:
I don't know if it would make sense to make .BEGIN processing
work more like a normal target or not, so the attached patch
only clarifies the matter in the documentation.
Index: make.1
===================================================================
RCS file: /cvs/basesrc/usr.bin/make/make.1,v
retrieving revision 1.38
diff -u -r1.38 make.1
--- make.1 2000/02/08 12:56:28 1.38
+++ make.1 2000/03/07 20:48:06
@@ -930,6 +930,7 @@
.It Ic .BEGIN
Any command lines attached to this target are executed before anything
else is done.
+Note that dependencies are useless, they will not be processed.
.It Ic .DEFAULT
This is sort of a
.Ic .USE
@@ -947,6 +948,7 @@
.It Ic .END
Any command lines attached to this target are executed after everything
else is done.
+Note that dependencies are useless, they will not be processed.
.It Ic .IGNORE
Mark each of the sources with the
.Ic .IGNORE
@@ -958,6 +960,7 @@
If
.Nm
is interrupted, the commands for this target will be executed.
+Note that dependencies are useless, they will not be processed.
.It Ic .MAIN
If no target is specified when
.Nm
>Audit-Trail:
>Unformatted: