svn commit: r300313 - in head: contrib/bmake contrib/bmake/mk contrib/bmake/mk/sys usr.bin/bmake

Simon J. Gerraty sjg at FreeBSD.org
Fri May 20 17:35:42 UTC 2016


Author: sjg
Date: Fri May 20 17:35:39 2016
New Revision: 300313
URL: https://svnweb.freebsd.org/changeset/base/300313

Log:
  Merge bmake-20160512

Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/arch.c
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/compat.c
  head/contrib/bmake/job.c
  head/contrib/bmake/main.c
  head/contrib/bmake/make.1
  head/contrib/bmake/meta.c
  head/contrib/bmake/meta.h
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/auto.dep.mk
  head/contrib/bmake/mk/autodep.mk
  head/contrib/bmake/mk/dirdeps.mk
  head/contrib/bmake/mk/dpadd.mk
  head/contrib/bmake/mk/final.mk
  head/contrib/bmake/mk/gendirdeps.mk
  head/contrib/bmake/mk/init.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/lib.mk
  head/contrib/bmake/mk/libnames.mk
  head/contrib/bmake/mk/meta.autodep.mk
  head/contrib/bmake/mk/meta.sys.mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/mk/nls.mk
  head/contrib/bmake/mk/own.mk
  head/contrib/bmake/mk/prog.mk
  head/contrib/bmake/mk/subdir.mk
  head/contrib/bmake/mk/sys.mk
  head/contrib/bmake/mk/sys/AIX.mk
  head/contrib/bmake/mk/sys/Darwin.mk
  head/contrib/bmake/mk/sys/Generic.mk
  head/contrib/bmake/mk/sys/HP-UX.mk
  head/contrib/bmake/mk/sys/IRIX.mk
  head/contrib/bmake/mk/sys/Linux.mk
  head/contrib/bmake/mk/sys/NetBSD.mk
  head/contrib/bmake/mk/sys/OSF1.mk
  head/contrib/bmake/mk/sys/OpenBSD.mk
  head/contrib/bmake/mk/sys/SunOS.mk
  head/contrib/bmake/mk/sys/UnixWare.mk
  head/contrib/bmake/mk/warnings.mk
  head/contrib/bmake/parse.c
  head/contrib/bmake/str.c
  head/usr.bin/bmake/Makefile
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/ChangeLog	Fri May 20 17:35:39 2016	(r300313)
@@ -1,3 +1,26 @@
+2016-05-12  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (_MAKE_VERSION): 20160512
+	  Merge with NetBSD make, pick up
+	  o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS
+	    this is useful for gcov builds.
+	  o propagate errors from filemon(4).
+	
+2016-05-09  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (_MAKE_VERSION): 20160509
+	  Merge with NetBSD make, pick up
+	  o remove use of non-standard types u_int etc.
+	  o meta.c: apply realpath() before matching against metaIgnorePaths
+
+2016-04-04  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Makefile (_MAKE_VERSION): 20160404
+	  Merge with NetBSD make, pick up
+	  o allow makefile to set .MAKE.JOBS
+
+	* Makefile (PROG_NAME): use ${_MAKE_VERSION}
+
 2016-03-15  Simon J. Gerraty  <sjg at bad.crufty.net>
 
 	* Makefile (_MAKE_VERSION): 20160315

Modified: head/contrib/bmake/Makefile
==============================================================================
--- head/contrib/bmake/Makefile	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/Makefile	Fri May 20 17:35:39 2016	(r300313)
@@ -1,7 +1,7 @@
-#	$Id: Makefile,v 1.58 2016/03/15 23:39:12 sjg Exp $
+#	$Id: Makefile,v 1.63 2016/05/12 20:34:46 sjg Exp $
 
 # Base version on src date
-_MAKE_VERSION= 20160315
+_MAKE_VERSION= 20160512
 
 PROG=	bmake
 
@@ -131,9 +131,9 @@ OPTIONS_DEFAULT_NO+= \
 .include <own.mk>
 
 .if ${MK_PROG_VERSION} == "yes"
-PROG_NAME= ${PROG}-${MAKE_VERSION}
+PROG_NAME= ${PROG}-${_MAKE_VERSION}
 .if ${MK_PROG_LINK} == "yes"
-SYMLINKS+= ${PROG}-${MAKE_VERSION} ${BINDIR}/${PROG}
+SYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG}
 .endif
 .endif
 

Modified: head/contrib/bmake/arch.c
==============================================================================
--- head/contrib/bmake/arch.c	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/arch.c	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $	*/
+/*	$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $");
+__RCSID("$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -832,7 +832,7 @@ ArchSVR4Entry(Arch *ar, char *name, size
 	    }
 	if (DEBUG(ARCH)) {
 	    fprintf(debug_file, "Found svr4 archive name table with %lu entries\n",
-	            (u_long)entry);
+	            (unsigned long)entry);
 	}
 	return 0;
     }
@@ -850,7 +850,7 @@ ArchSVR4Entry(Arch *ar, char *name, size
     if (entry >= ar->fnamesize) {
 	if (DEBUG(ARCH)) {
 	    fprintf(debug_file, "SVR4 entry offset %s is greater than %lu\n",
-		   name, (u_long)ar->fnamesize);
+		   name, (unsigned long)ar->fnamesize);
 	}
 	return 2;
     }

Modified: head/contrib/bmake/bmake.1
==============================================================================
--- head/contrib/bmake/bmake.1	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/bmake.1	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.255 2016/03/14 07:42:15 matthias Exp $
+.\"	$NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd February 19, 2016
+.Dd May 10, 2016
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -913,6 +913,9 @@ Provides a list of path prefixes that sh
 because the contents are expected to change over time.
 The default list includes:
 .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp
+.It Va .MAKE.META.IGNORE_PATTERNS
+Provides a list of patterns to match against pathnames.
+Ignore any that match.
 .It Va .MAKE.META.PREFIX
 Defines the message printed for each meta file updated in "meta verbose" mode.
 The default value is:

Modified: head/contrib/bmake/bmake.cat1
==============================================================================
--- head/contrib/bmake/bmake.cat1	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/bmake.cat1	Fri May 20 17:35:39 2016	(r300313)
@@ -586,6 +586,10 @@ VVAARRIIAABBLLEE AASSSSIIGG
                      The default list includes: `_/_d_e_v _/_e_t_c _/_p_r_o_c _/_t_m_p _/_v_a_r_/_r_u_n
                      _/_v_a_r_/_t_m_p'
 
+     _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_T_E_R_N_S
+                     Provides a list of patterns to match against pathnames.
+                     Ignore any that match.
+
      _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X
                      Defines the message printed for each meta file updated in
                      "meta verbose" mode.  The default value is:
@@ -1471,4 +1475,4 @@ BBUUGGSS
 
      There is no way of escaping a space character in a filename.
 
-NetBSD 5.1                     February 19, 2016                    NetBSD 5.1
+NetBSD 5.1                       May 10, 2016                       NetBSD 5.1

Modified: head/contrib/bmake/compat.c
==============================================================================
--- head/contrib/bmake/compat.c	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/compat.c	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $	*/
+/*	$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.104 2016/02/18 18:29:14 christos Exp $");
+__RCSID("$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -586,7 +586,8 @@ Compat_Make(void *gnp, void *pgnp)
 	}
 #ifdef USE_META
 	if (useMeta && !NoExecute(gn)) {
-	    meta_job_finish(NULL);
+	    if (meta_job_finish(NULL) != 0)
+		gn->made = ERROR;
 	}
 #endif
 

Modified: head/contrib/bmake/job.c
==============================================================================
--- head/contrib/bmake/job.c	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/job.c	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $	*/
+/*	$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.186 2016/02/18 18:29:14 christos Exp $");
+__RCSID("$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1072,7 +1072,11 @@ JobFinish (Job *job, WAIT_T status)
 
 #ifdef USE_META
     if (useMeta) {
-	meta_job_finish(job);
+	int x;
+
+	if ((x = meta_job_finish(job)) != 0 && status == 0) {
+	    status = x;
+	}
     }
 #endif
     

Modified: head/contrib/bmake/main.c
==============================================================================
--- head/contrib/bmake/main.c	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/main.c	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.244 2016/04/05 04:25:43 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1152,14 +1152,6 @@ main(int argc, char **argv)
 	}
 
 	/*
-	 * Be compatible if user did not specify -j and did not explicitly
-	 * turned compatibility on
-	 */
-	if (!compatMake && !forceJobs) {
-		compatMake = TRUE;
-	}
-	
-	/*
 	 * Initialize archive, target and suffix modules in preparation for
 	 * parsing the makefile(s)
 	 */
@@ -1275,6 +1267,36 @@ main(int argc, char **argv)
 	Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);
 	free(p1);
 
+	if (!forceJobs && !compatMake &&
+	    Var_Exists(".MAKE.JOBS", VAR_GLOBAL)) {
+	    char *value;
+	    int n;
+
+	    value = Var_Subst(NULL, "${.MAKE.JOBS}", VAR_GLOBAL, VARF_WANTRES);
+	    n = strtol(value, NULL, 0);
+	    if (n < 1) {
+		(void)fprintf(stderr, "%s: illegal value for .MAKE.JOBS -- must be positive integer!\n",
+		    progname);
+		exit(1);
+	    }
+	    if (n != maxJobs) {
+		Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
+		Var_Append(MAKEFLAGS, value, VAR_GLOBAL);
+	    }
+	    maxJobs = n;
+	    maxJobTokens = maxJobs;
+	    forceJobs = TRUE;
+	    free(value);
+	}
+
+	/*
+	 * Be compatible if user did not specify -j and did not explicitly
+	 * turned compatibility on
+	 */
+	if (!compatMake && !forceJobs) {
+	    compatMake = TRUE;
+	}
+
 	if (!compatMake)
 	    Job_ServerStart(maxJobTokens, jp_0, jp_1);
 	if (DEBUG(JOB))

Modified: head/contrib/bmake/make.1
==============================================================================
--- head/contrib/bmake/make.1	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/make.1	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.255 2016/03/14 07:42:15 matthias Exp $
+.\"	$NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd February 19, 2016
+.Dd May 10, 2016
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -924,6 +924,9 @@ Provides a list of path prefixes that sh
 because the contents are expected to change over time.
 The default list includes:
 .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp
+.It Va .MAKE.META.IGNORE_PATTERNS
+Provides a list of patterns to match against pathnames.
+Ignore any that match.
 .It Va .MAKE.META.PREFIX
 Defines the message printed for each meta file updated in "meta verbose" mode.
 The default value is:

Modified: head/contrib/bmake/meta.c
==============================================================================
--- head/contrib/bmake/meta.c	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/meta.c	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.54 2016/03/11 07:01:21 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.57 2016/05/12 20:28:34 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -66,6 +66,9 @@ static char *metaIgnorePathsStr;	/* stri
 #ifndef MAKE_META_IGNORE_PATHS
 #define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
 #endif
+#ifndef MAKE_META_IGNORE_PATTERNS
+#define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS"
+#endif
 
 Boolean useMeta = FALSE;
 static Boolean useFilemon = FALSE;
@@ -73,6 +76,7 @@ static Boolean writeMeta = FALSE;
 static Boolean metaEnv = FALSE;		/* don't save env unless asked */
 static Boolean metaVerbose = FALSE;
 static Boolean metaIgnoreCMDs = FALSE;	/* ignore CMDs in .meta files */
+static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */
 static Boolean metaCurdirOk = FALSE;	/* write .meta in .CURDIR Ok? */
 static Boolean metaSilent = FALSE;	/* if we have a .meta be SILENT */
 
@@ -157,28 +161,33 @@ filemon_open(BuildMon *pbm)
  * Read the build monitor output file and write records to the target's
  * metadata file.
  */
-static void
+static int
 filemon_read(FILE *mfp, int fd)
 {
     char buf[BUFSIZ];
     int n;
+    int error;
 
     /* Check if we're not writing to a meta data file.*/
     if (mfp == NULL) {
 	if (fd >= 0)
 	    close(fd);			/* not interested */
-	return;
+	return 0;
     }
     /* rewind */
     (void)lseek(fd, (off_t)0, SEEK_SET);
 
+    error = 0;
     fprintf(mfp, "\n-- filemon acquired metadata --\n");
 
     while ((n = read(fd, buf, sizeof(buf))) > 0) {
-	fwrite(buf, 1, n, mfp);
+	if ((int)fwrite(buf, 1, n, mfp) < n)
+	    error = EIO;
     }
     fflush(mfp);
-    close(fd);
+    if (close(fd) < 0)
+	error = errno;
+    return error;
 }
 #endif
 
@@ -620,6 +629,15 @@ meta_mode_init(const char *make_mode)
     if (metaIgnorePathsStr) {
 	str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL);
     }
+
+    /*
+     * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS}
+     */
+    cp = NULL;
+    if (Var_Value(MAKE_META_IGNORE_PATTERNS, VAR_GLOBAL, &cp)) {
+	metaIgnorePatterns = TRUE;
+	free(cp);
+    }
 }
 
 /*
@@ -744,27 +762,35 @@ meta_job_output(Job *job, char *cp, cons
     }
 }
 
-void
+int
 meta_cmd_finish(void *pbmp)
 {
+    int error = 0;
 #ifdef USE_FILEMON
     BuildMon *pbm = pbmp;
+    int x;
 
     if (!pbm)
 	pbm = &Mybm;
 
     if (pbm->filemon_fd >= 0) {
-	close(pbm->filemon_fd);
-	filemon_read(pbm->mfp, pbm->mon_fd);
+	if (close(pbm->filemon_fd) < 0)
+	    error = errno;
+	x = filemon_read(pbm->mfp, pbm->mon_fd);
+	if (error == 0 && x != 0)
+	    error = x;
 	pbm->filemon_fd = pbm->mon_fd = -1;
     }
 #endif
+    return error;
 }
 
-void
+int
 meta_job_finish(Job *job)
 {
     BuildMon *pbm;
+    int error = 0;
+    int x;
 
     if (job != NULL) {
 	pbm = &job->bm;
@@ -772,11 +798,14 @@ meta_job_finish(Job *job)
 	pbm = &Mybm;
     }
     if (pbm->mfp != NULL) {
-	meta_cmd_finish(pbm);
-	fclose(pbm->mfp);
+	error = meta_cmd_finish(pbm);
+	x = fclose(pbm->mfp);
+	if (error == 0 && x != 0)
+	    error = errno;
 	pbm->mfp = NULL;
 	pbm->meta_fname[0] = '\0';
     }
+    return error;
 }
 
 void
@@ -1209,14 +1238,35 @@ meta_oodate(GNode *gn, Boolean oodate)
 		     * be part of the dependencies because
 		     * they are _expected_ to change.
 		     */
-		    if (*p == '/' &&
-			Lst_ForEach(metaIgnorePaths, prefix_match, p)) {
+		    if (*p == '/') {
+			realpath(p, fname1); /* clean it up */
+			if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) {
 #ifdef DEBUG_META_MODE
-			if (DEBUG(META))
-			    fprintf(debug_file, "meta_oodate: ignoring: %s\n",
-				    p);
+			    if (DEBUG(META))
+				fprintf(debug_file, "meta_oodate: ignoring path: %s\n",
+					p);
 #endif
-			break;
+			    break;
+			}
+		    }
+
+		    if (metaIgnorePatterns) {
+			char *pm;
+
+			snprintf(fname1, sizeof(fname1),
+				 "${%s:@m@${%s:L:M$m}@}",
+				 MAKE_META_IGNORE_PATTERNS, p);
+			pm = Var_Subst(NULL, fname1, gn, VARF_WANTRES);
+			if (*pm) {
+#ifdef DEBUG_META_MODE
+			    if (DEBUG(META))
+				fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n",
+					p);
+#endif
+			    free(pm);
+			    break;
+			}
+			free(pm);
 		    }
 
 		    /*

Modified: head/contrib/bmake/meta.h
==============================================================================
--- head/contrib/bmake/meta.h	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/meta.h	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.h,v 1.4 2016/03/07 21:45:43 christos Exp $ */
+/*      $NetBSD: meta.h,v 1.5 2016/05/12 20:28:34 sjg Exp $ */
 
 /*
  * Things needed for 'meta' mode.
@@ -48,8 +48,8 @@ void meta_job_start(struct Job *, GNode 
 void meta_job_child(struct Job *);
 void meta_job_error(struct Job *, GNode *, int, int);
 void meta_job_output(struct Job *, char *, const char *);
-void meta_cmd_finish(void *);
-void meta_job_finish(struct Job *);
+int  meta_cmd_finish(void *);
+int  meta_job_finish(struct Job *);
 Boolean meta_oodate(GNode *, Boolean);
 void meta_compat_start(void);
 void meta_compat_child(void);

Modified: head/contrib/bmake/mk/ChangeLog
==============================================================================
--- head/contrib/bmake/mk/ChangeLog	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/mk/ChangeLog	Fri May 20 17:35:39 2016	(r300313)
@@ -1,3 +1,57 @@
+2016-05-12  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* install-mk (MK_VERSION): 20160512
+
+	* dpadd.mk: always include local.dpadd.mk if it exists
+	  remove some things that better belong in local.dpadd.mk
+	  skip INCLUDES_* for staged libs unless SRC_* defined.
+
+	* own.mk: add INCLUDEDIR
+	
+2016-04-18  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* dirdeps.mk: when doing -f dirdeps.mk if target suppies no
+	  TARGET_MACHINE - :E will be empty or match part of path, use
+	  ${MACHINE}
+
+2016-04-07  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* meta.autodep.mk: issue a warning if UPDATE_DEPENDFILE=NO due to
+	  NO_FILEMON_COOKIE  
+
+	* dirdeps.mk: move the logic that allows for 
+	  make -f dirdeps.mk some/dir.${TARGET_SPEC}
+	  inside the check for !target(_DIRDEP_USE)
+
+2016-04-04  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* Use <> when including local*.mk and others which may exist
+	  elsewhere so that user can better control what they get.
+	
+	* meta.autodep.mk (NO_FILEMON_COOKIE): 
+	  create a cookie if we ever build dir with nofilemon
+	  so that UPDATE_DEPENDFILE will be forced to NO until cleaned.
+
+2016-04-01  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* install-mk (MK_VERSION): 20160401
+	
+	* meta2deps.py: fix old print statement when debugging.
+
+	* gendirdeps.mk: META2DEPS_CMD append M2D_EXCLUDES with -X
+	  patch from Bryan Drewery
+
+2016-03-22  Simon J. Gerraty  <sjg at bad.crufty.net>
+
+	* install-mk (MK_VERSION): 20160317 (St. Pats)
+	
+	* warnings.mk: g++ does not like -Wimplicit
+	
+	* sys.mk sys/*.mk lib.mk prog.mk: use CXX_SUFFIXES to handle the
+	  pelthora of common suffixes for C++
+	
+	* lib.mk: use .So for shared objects
+
 2016-03-15  Simon J. Gerraty  <sjg at bad.crufty.net>
 
 	* install-mk (MK_VERSION): 20160315

Modified: head/contrib/bmake/mk/auto.dep.mk
==============================================================================
--- head/contrib/bmake/mk/auto.dep.mk	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/mk/auto.dep.mk	Fri May 20 17:35:39 2016	(r300313)
@@ -1,6 +1,6 @@
 #
 # RCSid:
-#	$Id: auto.dep.mk,v 1.4 2016/02/18 21:16:39 sjg Exp $
+#	$Id: auto.dep.mk,v 1.5 2016/04/05 15:58:37 sjg Exp $
 #
 #	@(#) Copyright (c) 2010, Simon J. Gerraty
 #
@@ -66,7 +66,7 @@ ${.MAKE.DEPENDFILE}: ${OBJS} ${POBJS} ${
 .if empty(_SKIP_BUILD)
 _all_objs = ${OBJS} ${POBJS} ${SOBJS}
 .for d in ${_all_objs:M*o:T:O:u:%=%.d}
-.dinclude "$d"
+.dinclude <$d>
 .endfor
 .endif
 

Modified: head/contrib/bmake/mk/autodep.mk
==============================================================================
--- head/contrib/bmake/mk/autodep.mk	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/mk/autodep.mk	Fri May 20 17:35:39 2016	(r300313)
@@ -1,6 +1,6 @@
 #
 # RCSid:
-#	$Id: autodep.mk,v 1.34 2014/08/04 05:12:27 sjg Exp $
+#	$Id: autodep.mk,v 1.36 2016/04/05 15:58:37 sjg Exp $
 #
 #	@(#) Copyright (c) 1999-2010, Simon J. Gerraty
 #
@@ -25,7 +25,11 @@ __${.PARSEFILE}__:
 DEPENDFILE?= .depend
 .for d in ${DEPENDFILE:N.depend}
 # bmake only groks .depend
-.-include "$d"
+.if ${MAKE_VERSION} < 20160218
+.-include <$d>
+.else
+.dinclude <$d>
+.endif
 .endfor
 
 # it does nothing if SRCS is not defined or is empty
@@ -75,6 +79,9 @@ CXXFLAGS_MD=${CXXFLAGS:M-[IUD]*} ${CPPFL
 CC_MD?=${CC}
 CXX_MD?=${CXX}
 
+# should have been set by sys.mk
+CXX_SUFFIXES?= .cc .cpp .cxx .C
+
 # so we can do an explicit make depend, but not otherwise
 .if make(depend)
 .SUFFIXES:	.d
@@ -100,7 +107,7 @@ CXX_MD?=${CXX}
 	@echo updating dependencies for $<
 	@${SHELL} -ec "${CC_MD} -M ${CPPFLAGS_MD} ${AINC} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; }
 
-.cc.d .cpp.d .C.d .cxx.d:
+${CXX_SUFFIXES:%=%.d}:
 	@echo updating dependencies for $<
 	@${SHELL} -ec "${CXX_MD} -M ${CXXFLAGS_MD} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; }
 .else
@@ -120,7 +127,7 @@ CXX_MD?=${CXX}
 .s.d .S.d:
 	${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} ${AINC} $< > $@ || { ${RM} -f $@; false; }
 
-.cc.d .cpp.d .C.d .cxx.d:
+${CXX_SUFFIXES:%=%.d}:
 	${CXX_MD} ${CFLAGS_MD:S/D//} ${CXXFLAGS_MD} $< > $@ || { ${RM} -f $@; false; }
 .endif
 

Modified: head/contrib/bmake/mk/dirdeps.mk
==============================================================================
--- head/contrib/bmake/mk/dirdeps.mk	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/mk/dirdeps.mk	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.62 2016/03/16 00:11:53 sjg Exp $
+# $Id: dirdeps.mk,v 1.67 2016/04/18 21:50:47 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -121,6 +121,26 @@ _DIRDEP_USE_LEVEL?= 0
 # and non-specific Makefile.depend*
 
 .if !target(_DIRDEP_USE)
+
+.if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != ""
+# This little trick let's us do
+#
+# mk -f dirdeps.mk some/dir.${TARGET_SPEC}
+#
+all:
+${.TARGETS:Nall}: all
+DIRDEPS := ${.TARGETS:M*[/.]*}
+# so that -DNO_DIRDEPS works
+DEP_RELDIR := ${DIRDEPS:[1]:R}
+# this will become DEP_MACHINE below
+TARGET_MACHINE := ${DIRDEPS:[1]:E:C/,.*//}
+.if ${TARGET_MACHINE:N*/*} == ""
+TARGET_MACHINE := ${MACHINE}
+.endif
+# disable DIRDEPS_CACHE as it does not like this trick
+MK_DIRDEPS_CACHE = no
+.endif
+
 # make sure we get the behavior we expect
 .MAKE.SAVE_DOLLARS = no
 
@@ -244,20 +264,6 @@ DEP_${TARGET_SPEC_VARS:[$i]} := ${_tspec
 DEP_MACHINE := ${_DEP_TARGET_SPEC}
 .endif
 
-.if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != ""
-# This little trick let's us do
-#
-# mk -f dirdeps.mk some/dir.${TARGET_SPEC}
-#
-all:
-${.TARGETS:Nall}: all
-DIRDEPS := ${.TARGETS:M*/*}
-# so that -DNO_DIRDEPS works
-DEP_RELDIR := ${DIRDEPS:R:[1]}
-# disable DIRDEPS_CACHE as it does not like this trick
-MK_DIRDEPS_CACHE = no
-.endif
-
 # reset each time through
 _build_all_dirs =
 
@@ -284,7 +290,7 @@ _DEP_RELDIR := ${DEP_RELDIR}
 # pickup customizations
 # as below you can use !target(_DIRDEP_USE) to protect things
 # which should only be done once.
-.-include "local.dirdeps.mk"
+.-include <local.dirdeps.mk>
 
 .if !target(_DIRDEP_USE)
 # things we skip for host tools
@@ -304,7 +310,13 @@ DEP_SKIP_DIR = ${SKIP_DIR} \
 
 NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}}
 
-.if defined(NO_DIRDEPS) || defined(NODIRDEPS) || defined(WITHOUT_DIRDEPS)
+.if defined(NODIRDEPS) || defined(WITHOUT_DIRDEPS)
+NO_DIRDEPS =
+.elif defined(WITHOUT_DIRDEPS_BELOW)
+NO_DIRDEPS_BELOW =
+.endif
+
+.if defined(NO_DIRDEPS)
 # confine ourselves to the original dir and below.
 DIRDEPS_FILTER += M${_DEP_RELDIR}*
 .elif defined(NO_DIRDEPS_BELOW)
@@ -370,7 +382,7 @@ MK_DIRDEPS_CACHE ?= no
 BUILD_DIRDEPS_CACHE ?= no
 BUILD_DIRDEPS ?= yes
 
-.if !defined(NO_DIRDEPS)
+.if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW)
 .if ${MK_DIRDEPS_CACHE} == "yes"
 # this is where we will cache all our work
 DIRDEPS_CACHE?= ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.}
@@ -452,7 +464,7 @@ _this_dir := ${SRCTOP}/${DEP_RELDIR}
 
 # on rare occasions, there can be a need for extra help
 _dep_hack := ${_this_dir}/${.MAKE.DEPENDFILE_PREFIX}.inc
-.-include "${_dep_hack}"
+.-include <${_dep_hack}>
 
 .if ${DEP_RELDIR} != ${_DEP_RELDIR} || ${DEP_TARGET_SPEC} != ${TARGET_SPEC}
 # this should be all

Modified: head/contrib/bmake/mk/dpadd.mk
==============================================================================
--- head/contrib/bmake/mk/dpadd.mk	Fri May 20 17:25:36 2016	(r300312)
+++ head/contrib/bmake/mk/dpadd.mk	Fri May 20 17:35:39 2016	(r300313)
@@ -1,4 +1,4 @@
-# $Id: dpadd.mk,v 1.19 2014/04/05 22:56:54 sjg Exp $
+# $Id: dpadd.mk,v 1.21 2016/05/18 20:54:55 sjg Exp $
 #
 #	@(#) Copyright (c) 2004, Simon J. Gerraty
 #
@@ -21,71 +21,91 @@ __${.PARSEFILE}__:
 _OBJDIR?= ${.OBJDIR}
 _CURDIR?= ${.CURDIR}
 
+.if ${_CURDIR} == ${SRCTOP}
+RELDIR=.
+RELTOP=.
+.else
+RELDIR?= ${_CURDIR:S,${SRCTOP}/,,}
+.if ${RELDIR} == ${_CURDIR}
+RELDIR?= ${_OBJDIR:S,${OBJTOP}/,,}
+.endif
+RELTOP?= ${RELDIR:C,[^/]+,..,g}
+.endif
+RELOBJTOP?= ${OBJTOP}
+RELSRCTOP?= ${SRCTOP}
+
+# we get included just about everywhere so this is handy...
+# C*DEBUG_XTRA are for defining on cmd line etc 
+# so do not use in makefiles.
+.ifdef CFLAGS_DEBUG_XTRA
+CFLAGS_LAST += ${CFLAGS_DEBUG_XTRA}
+.endif
+.ifdef CXXFLAGS_DEBUG_XTRA
+CXXFLAGS_LAST += ${CXXFLAGS_DEBUG_XTRA}
+.endif
+
+.-include <local.dpadd.mk>
+
 # DPLIBS helps us ensure we keep DPADD and LDADD in sync
 DPLIBS+= ${DPLIBS_LAST}
-DPADD+= ${DPLIBS}
+DPADD+= ${DPLIBS:N-*}
 .for __lib in ${DPLIBS:T:R}
-LDADD+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
+.if "${_lib:M-*}" != ""
+LDADD += ${__lib}
+.else
+LDADD += ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
+.endif
 .endfor
 
 # DPADD can contain things other than libs
-__dpadd_libs = ${DPADD:M*/lib*}
+__dpadd_libs := ${DPADD:M*/lib*}
 
 # some libs have dependencies...
 # DPLIBS_* allows bsd.libnames.mk to flag libs which must be included
 # in DPADD for a given library.
-.for __lib in ${__dpadd_libs:@d@${DPLIBS_${d:T:R}}@}
+# Gather all such dependencies into __ldadd_all_xtras
+# dups will be dealt with later.
+# Note: libfoo_pic uses DPLIBS_libfoo
+__ldadd_all_xtras=
+.for __lib in ${__dpadd_libs:@d@${DPLIBS_${d:T:R:S,_pic,,}}@}
+__ldadd_all_xtras+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
 .if "${DPADD:M${__lib}}" == ""
 DPADD+= ${__lib}
-LDADD+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
 .endif
 .endfor
 # Last of all... for libc and libgcc
 DPADD+= ${DPADD_LAST}
 
+# de-dupuplicate __ldadd_all_xtras into __ldadd_xtras
+# in reverse order so that libs end up listed after all that needed them.
+__ldadd_xtras=
+.for __lib in ${__ldadd_all_xtras:[-1..1]}
+.if "${__ldadd_xtras:M${__lib}}" == "" || ${NEED_IMPLICIT_LDADD:tl:Uno} != "no"
+__ldadd_xtras+= ${__lib}
+.endif
+.endfor
+
+.if !empty(__ldadd_xtras)
+# now back to the original order
+__ldadd_xtras:= ${__ldadd_xtras:[-1..1]}
+LDADD+= ${__ldadd_xtras}
+.endif
+
 # Convert DPADD into -I and -L options and add them to CPPFLAGS and LDADD
 # For the -I's convert the path to a relative one.  For separate objdirs
 # the DPADD paths will be to the obj tree so we need to subst anyway.
 
-# If USE_PROFILE is yes, then check for profiled versions of libs
-# and use them.
-
-USE_PROFILE?=no
-.if defined(LIBDL) && exists(${LIBDL})
-.if defined(PROG) && (make(${PROG}_p) || ${USE_PROFILE} == yes) && \
-	defined(LDFLAGS) && ${LDFLAGS:M-export-dynamic}
-# building profiled version of a prog that needs dlopen to work
-DPLIBS+= ${LIBDL}
-.endif
-.endif
-
-.if defined(LIBDMALLOC) && exists(${LIBDMALLOC})
-.if defined(USE_DMALLOC) && ${USE_DMALLOC} != no
-.if !defined(NO_DMALLOC)
-CPPFLAGS+= -DUSE_DMALLOC
-.endif
-DPLIBS+= ${LIBDMALLOC}
-.endif
-.endif
+# update this
+__dpadd_libs := ${DPADD:M*/lib*}
 
 # Order -L's to search ours first.
 # Avoids picking up old versions already installed.
-__dpadd_libdirs := ${__dpadd_libs:R:H:S/^/-L/g:O:u:N-L}
+__dpadd_libdirs := ${__dpadd_libs}:R:H:S/^/-L/g:O:u:N-L}
 LDADD += ${__dpadd_libdirs:M-L${OBJTOP}/*}
-LDADD += ${__dpadd_libdirs:N-L${OBJTOP}/*}
-
-.if ${.CURDIR} == ${SRCTOP}
-RELDIR=.
-RELTOP=.
-.else
-RELDIR?= ${.CURDIR:S,${SRCTOP}/,,}
-.if ${RELDIR} == ${.CURDIR}
-RELDIR?= ${.OBJDIR:S,${OBJTOP}/,,}
+LDADD += ${__dpadd_libdirs:N-L${OBJTOP}/*:N-L${HOST_LIBDIR:U/usr/lib}}
+.if defined(HOST_LIBDIR) && ${HOST_LIBDIR} != "/usr/lib"
+LDADD+= -L${HOST_LIBDIR}
 .endif
-RELTOP?= ${RELDIR:C,[^/]+,..,g}
-.endif
-RELOBJTOP?= ${OBJTOP}
-RELSRCTOP?= ${SRCTOP}
 
 .if !make(dpadd)
 .ifdef LIB
@@ -109,7 +129,8 @@ __dpadd_libs += ${SRC_LIBS}
 DPMAGIC_LIBS += ${__dpadd_libs} \
 	${__dpadd_libs:@d@${DPMAGIC_LIBS_${d:T:R}}@}
 
-.for __lib in ${DPMAGIC_LIBS:O:u}
+# we skip this for staged libs
+.for __lib in ${DPMAGIC_LIBS:O:u:N${STAGE_OBJTOP:Unot}*/lib/*}
 # 
 # if SRC_libfoo is not set, then we assume that the srcdir corresponding
 # to where we found the library is correct.
@@ -127,6 +148,35 @@ INCLUDES_${__lib:T:R}?= -I${exists(${SRC
 
 .endfor
 
+# even for staged libs we sometimes 
+# need to allow direct -I to avoid cicular dependencies 
+.for __lib in ${DPMAGIC_LIBS:O:u:T:R}
+.if !empty(SRC_${__lib}) && empty(INCLUDES_${__lib})
+# must be a staged lib
+.if exists(${SRC_${__lib}}/h)
+INCLUDES_${__lib} = -I${SRC_${__lib}}/h
+.else
+INCLUDES_${__lib} = -I${SRC_${__lib}}
+.endif
+.endif
+.endfor
+
+# when linking a shared lib, avoid non pic libs
+SHLDADD+= ${LDADD:N-[lL]*}
+.for __lib in ${__dpadd_libs:u}
+.if defined(SHLIB_NAME) && ${LDADD:M-l${__lib:T:R:S,lib,,}} != ""
+.if ${__lib:T:N*_pic.a:N*.so} == "" || exists(${__lib:R}.so)
+SHLDADD+= -l${__lib:T:R:S,lib,,}
+.elif exists(${__lib:R}_pic.a)
+SHLDADD+= -l${__lib:T:R:S,lib,,}_pic
+.else
+.warning ${RELDIR}.${TARGET_SPEC} needs ${__lib:T:R}_pic.a
+SHLDADD+= -l${__lib:T:R:S,lib,,}
+.endif
+SHLDADD+= -L${__lib:H}
+.endif
+.endfor
+
 # Now for the bits we actually need
 __dpadd_incs=
 .for __lib in ${__dpadd_libs:u}
@@ -134,20 +184,25 @@ __dpadd_incs=
 __ldadd=-l${__lib:T:R:S,lib,,}
 LDADD := ${LDADD:S,^${__ldadd}$,${__ldadd}_p,g}
 .endif
+.endfor
 
 #
-# Some libs generate headers, so we potentially need both
-# the src dir and the obj dir.
-# If ${INCLUDES_libfoo} contains a word ending in /h, we assume that either
-# 1. it does not generate headers or
-# 2. INCLUDES_libfoo will have been set correctly
-# XXX it gets ugly avoiding duplicates... 
-# use :? to ensure .for does not prevent correct evaluation
-#
 # We take care of duplicate suppression later.
-__dpadd_incs += ${"${INCLUDES_${__lib:T:R}:M*/h}":? :-I${OBJ_${__lib:T:R}}}
-__dpadd_incs += ${INCLUDES_${__lib:T:R}}
-.endfor
+# don't apply :T:R too early
+__dpadd_incs += ${__dpadd_libs:u:@x@${INCLUDES_${x:T:R}}@}
+__dpadd_incs += ${__dpadd_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_${x:T:R}}@}
+
+__dpadd_last_incs += ${__dpadd_libs:u:@x@${INCLUDES_LAST_${x:T:R}}@}
+__dpadd_last_incs += ${__dpadd_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_LAST_${x:T:R}}@}
+
+.if defined(HOSTPROG) || ${MACHINE} == "host"
+# we want any -I/usr/* last
+__dpadd_last_incs := \
+	${__dpadd_last_incs:N-I/usr/*} \
+	${__dpadd_incs:M-I/usr/*} \
+	${__dpadd_last_incs:M-I/usr/*} 
+__dpadd_incs := ${__dpadd_incs:N-I/usr/*}
+.endif
 
 #
 # eliminate any duplicates - but don't mess with the order
@@ -164,13 +219,21 @@ __$t_incs+= $i
 .endfor
 .endfor
 
+.for t in CFLAGS_LAST CXXFLAGS_LAST
+# avoid duplicates
+__$t_incs:=${$t:M-I*:u}
+.for i in ${__dpadd_last_incs}
+.if "${__$t_incs:M$i}" == ""
+$t+= $i
+__$t_incs+= $i
+.endif
+.endfor
+.endfor
+
 # This target is used to gather a list of
 # dir: ${DPADD}
 # entries
 .if make(*dpadd*)
-# allow overrides
-.-include "dpadd++.mk"
-
 .if !target(dpadd)
 dpadd:	.NOTMAIN
 .if defined(DPADD) && ${DPADD} != ""
@@ -193,4 +256,17 @@ dpadd:	.NOTMAIN
 .PATH: ${SRC_PATHADD}
 .endif
 
+# after all that, if doing -n we don't care
+.if ${.MAKEFLAGS:Ux:M-n} != ""
+DPADD =

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list