Subject: Addition to make (debugging mainly)
To: None <tech-toolchain@netbsd.org>
From: James Chacon <jmc@netbsd.org>
List: tech-toolchain
Date: 06/16/2005 13:17:36
--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
I'd like to add -dn to make so that the scripts it creates in /tmp don't
get auto-unlinked.
I've found when debugging -j issues at times it's a lot simpler to just
look at what was passed into sh/ksh rather than parsing -dj or -dx output.
Anyone have an issue/comments?
Thanks
James
--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Index: job.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/job.c,v
retrieving revision 1.93
diff -u -r1.93 job.c
--- job.c 16 Jun 2005 18:07:45 -0000 1.93
+++ job.c 16 Jun 2005 18:12:52 -0000
@@ -1991,7 +1991,8 @@
(void)strcpy(tfile, TMPPAT);
if ((tfd = mkstemp(tfile)) == -1)
Punt("Could not create temporary file %s", strerror(errno));
- (void) eunlink(tfile);
+ if (!DEBUG(SCRIPT))
+ (void) eunlink(tfile);
JobSigUnlock(&mask);
job->cmdFILE = fdopen(tfd, "w+");
Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/main.c,v
retrieving revision 1.108
diff -u -r1.108 main.c
--- main.c 3 Jun 2005 16:15:46 -0000 1.108
+++ main.c 16 Jun 2005 18:12:52 -0000
@@ -395,6 +395,9 @@
case 'm':
debug |= DEBUG_MAKE;
break;
+ case 'n':
+ debug |= DEBUG_SCRIPT;
+ break;
case 's':
debug |= DEBUG_SUFF;
break;
Index: make.1
===================================================================
RCS file: /cvsroot/src/usr.bin/make/make.1,v
retrieving revision 1.110
diff -u -r1.110 make.1
--- make.1 15 Jun 2005 22:39:27 -0000 1.110
+++ make.1 16 Jun 2005 18:12:52 -0000
@@ -132,6 +132,13 @@
.It Ar m
Print debugging information about making targets, including modification
dates.
+.It Ar n
+Don't delete the temporary command scripts created in /tmp when running
+commands. These are created via
+.Xr mkstemp 3
+and have names of the form /tmp/makeXXXXX.
+.Em NOTE:
+This can create many file in /tmp so use with care.
.It Ar s
Print debugging information about suffix-transformation rules.
.It Ar t
Index: make.h
===================================================================
RCS file: /cvsroot/src/usr.bin/make/make.h,v
retrieving revision 1.54
diff -u -r1.54 make.h
--- make.h 8 May 2005 00:38:47 -0000 1.54
+++ make.h 16 Jun 2005 18:12:52 -0000
@@ -432,6 +432,7 @@
#define DEBUG_SHELL 0x0800
#define DEBUG_ERROR 0x1000
#define DEBUG_GRAPH3 0x10000
+#define DEBUG_SCRIPT 0x20000
#define CONCAT(a,b) a##b
--ew6BAiZeqk4r7MaW--