diff options
45 files changed, 541 insertions, 323 deletions
diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog index 6f47f1af305e..b38e1d1afc11 100644 --- a/contrib/bmake/ChangeLog +++ b/contrib/bmake/ChangeLog @@ -1,3 +1,26 @@ +2016-05-12 Simon J. Gerraty <sjg@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@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@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@bad.crufty.net> * Makefile (_MAKE_VERSION): 20160315 diff --git a/contrib/bmake/Makefile b/contrib/bmake/Makefile index 87f6254b07e5..8e89dddbbaed 100644 --- a/contrib/bmake/Makefile +++ b/contrib/bmake/Makefile @@ -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 diff --git a/contrib/bmake/arch.c b/contrib/bmake/arch.c index f613a663e394..1b5bab7da3e0 100644 --- a/contrib/bmake/arch.c +++ b/contrib/bmake/arch.c @@ -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_t size, FILE *arch) } 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_t size, FILE *arch) 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; } diff --git a/contrib/bmake/bmake.1 b/contrib/bmake/bmake.1 index 915963cd0476..27532d8adfa5 100644 --- a/contrib/bmake/bmake.1 +++ b/contrib/bmake/bmake.1 @@ -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 should be ignored; 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: diff --git a/contrib/bmake/bmake.cat1 b/contrib/bmake/bmake.cat1 index 091bdd48883e..b155283b27fe 100644 --- a/contrib/bmake/bmake.cat1 +++ b/contrib/bmake/bmake.cat1 @@ -586,6 +586,10 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS 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 diff --git a/contrib/bmake/compat.c b/contrib/bmake/compat.c index 475c59d51118..87e126114253 100644 --- a/contrib/bmake/compat.c +++ b/contrib/bmake/compat.c @@ -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 diff --git a/contrib/bmake/job.c b/contrib/bmake/job.c index 54c25f50585d..340d3b61eafc 100644 --- a/contrib/bmake/job.c +++ b/contrib/bmake/job.c @@ -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 diff --git a/contrib/bmake/main.c b/contrib/bmake/main.c index be6039e7dea8..0a89d94af0fd 100644 --- a/contrib/bmake/main.c +++ b/contrib/bmake/main.c @@ -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, 1989, 1990, 1993\ #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)) diff --git a/contrib/bmake/make.1 b/contrib/bmake/make.1 index 07b23207f022..f2c2cf9644da 100644 --- a/contrib/bmake/make.1 +++ b/contrib/bmake/make.1 @@ -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 should be ignored; 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: diff --git a/contrib/bmake/meta.c b/contrib/bmake/meta.c index 4faf83638eb7..3167807b1562 100644 --- a/contrib/bmake/meta.c +++ b/contrib/bmake/meta.c @@ -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; /* string storage for the list */ #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, const char *nl) } } -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); } /* diff --git a/contrib/bmake/meta.h b/contrib/bmake/meta.h index e9f5ed362969..8f1018e89a7d 100644 --- a/contrib/bmake/meta.h +++ b/contrib/bmake/meta.h @@ -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); diff --git a/contrib/bmake/mk/ChangeLog b/contrib/bmake/mk/ChangeLog index 50d6719bdeab..81a6cba65343 100644 --- a/contrib/bmake/mk/ChangeLog +++ b/contrib/bmake/mk/ChangeLog @@ -1,3 +1,57 @@ +2016-05-12 Simon J. Gerraty <sjg@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@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@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@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@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@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@bad.crufty.net> * install-mk (MK_VERSION): 20160315 diff --git a/contrib/bmake/mk/auto.dep.mk b/contrib/bmake/mk/auto.dep.mk index 6bc53e528ac1..55b2971be6e0 100644 --- a/contrib/bmake/mk/auto.dep.mk +++ b/contrib/bmake/mk/auto.dep.mk @@ -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} ${SOBJS} .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 diff --git a/contrib/bmake/mk/autodep.mk b/contrib/bmake/mk/autodep.mk index 84dea816fa35..7ed4c3932208 100644 --- a/contrib/bmake/mk/autodep.mk +++ b/contrib/bmake/mk/autodep.mk @@ -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]*} ${CPPFLAGS} 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 diff --git a/contrib/bmake/mk/dirdeps.mk b/contrib/bmake/mk/dirdeps.mk index c2350765c4a3..0e5784183fa1 100644 --- a/contrib/bmake/mk/dirdeps.mk +++ b/contrib/bmake/mk/dirdeps.mk @@ -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:[$i]} 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 diff --git a/contrib/bmake/mk/dpadd.mk b/contrib/bmake/mk/dpadd.mk index abc92df761c5..146365180bb1 100644 --- a/contrib/bmake/mk/dpadd.mk +++ b/contrib/bmake/mk/dpadd.mk @@ -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}/,,} -.endif -RELTOP?= ${RELDIR:C,[^/]+,..,g} +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 -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_${__lib:T:R}}/h):?${SRC_${__lib:T:R}}/h .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 = +.elif ${.MAKE.MODE:Mmeta*} != "" && exists(${.MAKE.DEPENDFILE}) +DPADD_CLEAR_DPADD ?= yes +.if ${DPADD_CLEAR_DPADD} == "yes" +# save this +__dpadd_libs := ${__dpadd_libs} +# we have made what use of it we can of DPADD +DPADD = +.endif +.endif + .endif diff --git a/contrib/bmake/mk/final.mk b/contrib/bmake/mk/final.mk index 5f4118993814..235d36dfe26d 100644 --- a/contrib/bmake/mk/final.mk +++ b/contrib/bmake/mk/final.mk @@ -1,10 +1,10 @@ -# $Id: final.mk,v 1.5 2011/03/11 05:22:38 sjg Exp $ +# $Id: final.mk,v 1.6 2016/04/05 15:58:37 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: # provide a hook for folk who want to do scary stuff -.-include "${.CURDIR}/../Makefile-final.inc" +.-include <${.CURDIR:H}/Makefile-final.inc> .if !empty(STAGE) .-include <stage.mk> diff --git a/contrib/bmake/mk/gendirdeps.mk b/contrib/bmake/mk/gendirdeps.mk index 8b803385c54b..68f32be6bfa7 100644 --- a/contrib/bmake/mk/gendirdeps.mk +++ b/contrib/bmake/mk/gendirdeps.mk @@ -1,4 +1,4 @@ -# $Id: gendirdeps.mk,v 1.30 2016/02/27 00:20:39 sjg Exp $ +# $Id: gendirdeps.mk,v 1.32 2016/04/05 15:58:37 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -82,7 +82,7 @@ META_FILES := ${META_FILES:T:O:u} .export META_FILES # pickup customizations -.-include "local.gendirdeps.mk" +.-include <local.gendirdeps.mk> # these are actually prefixes that we'll skip # they should all be absolute paths @@ -138,7 +138,8 @@ META2DEPS_CMD += -T ${TARGET_OBJ_SPEC} .endif META2DEPS_CMD += \ -R ${RELDIR} -H ${HOST_TARGET} \ - ${M2D_OBJROOTS:O:u:@o@-O $o@} + ${M2D_OBJROOTS:O:u:@o@-O $o@} \ + ${M2D_EXCLUDES:O:u:@o@-X $o@} \ M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${_objroot} @@ -255,6 +256,7 @@ DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:C,//+,/,g:O:u} .if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" .info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS} +.info ${RELDIR}: M2D_EXCLUDES=${M2D_EXCLUDES} .info ${RELDIR}: dir_list='${dir_list}' .info ${RELDIR}: dpadd_dir_list='${dpadd_dir_list}' .info ${RELDIR}: dirdep_list='${dirdep_list}' diff --git a/contrib/bmake/mk/init.mk b/contrib/bmake/mk/init.mk index 43561b528ad8..cb5ab820901a 100644 --- a/contrib/bmake/mk/init.mk +++ b/contrib/bmake/mk/init.mk @@ -1,4 +1,4 @@ -# $Id: init.mk,v 1.10 2015/12/07 04:28:31 sjg Exp $ +# $Id: init.mk,v 1.12 2016/04/05 15:58:37 sjg Exp $ # # @(#) Copyright (c) 2002, Simon J. Gerraty # @@ -23,11 +23,14 @@ _this_mk_dir := ${.PARSEDIR} .endif .-include <local.init.mk> -.-include "${.CURDIR:H}/Makefile.inc" +.-include <${.CURDIR:H}/Makefile.inc> .include <own.mk> .MAIN: all +# should have been set by sys.mk +CXX_SUFFIXES?= .cc .cpp .cxx .C + .if !empty(WARNINGS_SET) || !empty(WARNINGS_SET_${MACHINE_ARCH}) .include <warnings.mk> .endif diff --git a/contrib/bmake/mk/install-mk b/contrib/bmake/mk/install-mk index 307660954574..f944129f9944 100644 --- a/contrib/bmake/mk/install-mk +++ b/contrib/bmake/mk/install-mk @@ -55,7 +55,7 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: install-mk,v 1.123 2016/03/16 00:13:16 sjg Exp $ +# $Id: install-mk,v 1.126 2016/05/18 20:54:55 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20160315 +MK_VERSION=20160512 OWNER= GROUP= MODE=444 diff --git a/contrib/bmake/mk/lib.mk b/contrib/bmake/mk/lib.mk index c76fd9be8929..23612665359f 100644 --- a/contrib/bmake/mk/lib.mk +++ b/contrib/bmake/mk/lib.mk @@ -1,4 +1,4 @@ -# $Id: lib.mk,v 1.52 2015/11/14 18:09:57 sjg Exp $ +# $Id: lib.mk,v 1.53 2016/03/22 20:45:14 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -40,8 +40,8 @@ SHLIB_FULLVERSION := ${SHLIB_FULLVERSION} # add additional suffixes not exported. # .po is used for profiling object files. -# .so is used for PIC object files. -.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h +# .So is used for PIC object files. +.SUFFIXES: .out .a .ln .So .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .m CFLAGS+= ${COPTS} @@ -62,12 +62,12 @@ CFLAGS+= ${COPTS} # with ELF, also set shared-lib version for ld.so. # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors -# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects. +# FPICFLAGS: flags for ${FC} to compile .[fF] files to .So objects. # CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS} -# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects. +# CPICFLAGS: flags for ${CC} to compile .[cC] files to .So objects. # CAPICFLAGS flags for {$CC} to compiling .[Ss] files # (usually just ${CPPPICFLAGS} ${CPICFLAGS}) -# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects. +# APICFLAGS: flags for ${AS} to assemble .[sS] to .So objects. .if ${TARGET_OSNAME} == "NetBSD" .if ${MACHINE_ARCH} == "alpha" @@ -162,14 +162,14 @@ LD_shared=-b LD_so=sl DLLIB= # HPsUX lorder does not grok anything but .o -LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.so,'` +LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'` LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` .elif ${TARGET_OSNAME} == "OSF1" LD_shared= -msym -shared -expect_unresolved '*' LD_solib= -all lib${LIB}_pic.a DLLIB= # lorder does not grok anything but .o -LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.so,'` +LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'` LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` AR_cq= -cqs .elif ${TARGET_OSNAME} == "FreeBSD" @@ -273,7 +273,7 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age ${COMPILE.c} ${.IMPSRC} # for the normal .a we do not want to strip symbols -.cc.o .C.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} .S.o .s.o: @@ -284,10 +284,10 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age .c.po: ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET} -.cc.po .C.po: +${CXX_SUFFIXES:%=%.po}: ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET} -.S.so .s.so: +.S.So .s.So: ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} .else .c.po: @@ -296,13 +296,13 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o -.cc.po .C.po: +${CXX_SUFFIXES:%=%.po}: @echo ${COMPILE.cc} ${CXX_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET} @${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o -.S.so .s.so: +.S.So .s.So: @echo ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} @${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} @@ -310,23 +310,23 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age .endif .if (${LD_x} == "") -.c.so: +.c.So: ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} -.cc.so .C.so: +${CXX_SUFFIXES:%=%.So}: ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} .S.po .s.po: ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} .else -.c.so: +.c.So: @echo ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} @${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o -.cc.so .C.so: +${CXX_SUFFIXES:%=%.So}: @echo ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} @${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} @@ -396,7 +396,7 @@ prebuild: all: _SUBDIRUSE .for s in ${SRCS:N*.h:M*/*} -${.o .so .po .lo:L:@o@${s:T:R}$o@}: $s +${.o .So .po .lo:L:@o@${s:T:R}$o@}: $s .endfor OBJS+= ${SRCS:T:N*.h:R:S/$/.o/g} @@ -441,7 +441,7 @@ lib${LIB}_p.a:: ${POBJS} @${AR} ${AR_cq} ${.TARGET} ${LD_pobjs} ${RANLIB} ${.TARGET} -SOBJS+= ${OBJS:.o=.so} +SOBJS+= ${OBJS:.o=.So} .NOPATH: ${SOBJS} lib${LIB}_pic.a:: ${SOBJS} @echo building shared object ${LIB} library @@ -502,7 +502,7 @@ cleandir: _SUBDIRUSE clean .if defined(SRCS) && (!defined(MKDEP) || ${MKDEP} != autodep) afterdepend: .depend @(TMP=/tmp/_depend$$$$; \ - sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \ + sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.So \1.ln:/' \ < .depend > $$TMP; \ mv $$TMP .depend) .endif diff --git a/contrib/bmake/mk/libnames.mk b/contrib/bmake/mk/libnames.mk index 60e12eb5109a..b0eabed5ea53 100644 --- a/contrib/bmake/mk/libnames.mk +++ b/contrib/bmake/mk/libnames.mk @@ -1,4 +1,4 @@ -# $Id: libnames.mk,v 1.7 2009/12/25 07:34:03 sjg Exp $ +# $Id: libnames.mk,v 1.8 2016/04/05 15:58:37 sjg Exp $ # # @(#) Copyright (c) 2007-2009, Simon J. Gerraty # @@ -16,7 +16,7 @@ DLIBEXT ?= .a DSHLIBEXT ?= .so -.-include "local.libnames.mk" -.-include "sjg.libnames.mk" -.-include "fwall.libnames.mk" -.-include "host.libnames.mk" +.-include <local.libnames.mk> +.-include <sjg.libnames.mk> +.-include <fwall.libnames.mk> +.-include <host.libnames.mk> diff --git a/contrib/bmake/mk/meta.autodep.mk b/contrib/bmake/mk/meta.autodep.mk index 831e89f02259..5d6a0be91991 100644 --- a/contrib/bmake/mk/meta.autodep.mk +++ b/contrib/bmake/mk/meta.autodep.mk @@ -1,4 +1,4 @@ -# $Id: meta.autodep.mk,v 1.41 2016/03/11 01:29:38 sjg Exp $ +# $Id: meta.autodep.mk,v 1.44 2016/04/07 17:00:38 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -18,7 +18,7 @@ _this ?= ${.PARSEFILE} .if !target(__${_this}__) __${_this}__: .NOTMAIN -.-include "local.autodep.mk" +.-include <local.autodep.mk> .if defined(SRCS) # it would be nice to be able to query .SUFFIXES @@ -55,6 +55,21 @@ _OBJTOP ?= ${OBJTOP} _OBJROOT ?= ${OBJROOT:U${_OBJTOP}} _DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T} +.if ${.MAKE.LEVEL} > 0 || ${BUILD_AT_LEVEL0:Uyes:tl} == "yes" +# do not allow auto update if we ever built this dir without filemon +NO_FILEMON_COOKIE = .nofilemon +CLEANFILES += ${NO_FILEMON_COOKIE} +.if ${.MAKE.MODE:Uno:Mnofilemon} != "" +UPDATE_DEPENDFILE = NO +all: ${NO_FILEMON_COOKIE} +${NO_FILEMON_COOKIE}: .NOMETA + @echo UPDATE_DEPENDFILE=NO > ${.TARGET} +.elif exists(${NO_FILEMON_COOKIE}) +UPDATE_DEPENDFILE = NO +.warning ${RELDIR} built with nofilemon; UPDATE_DEPENDFILE=NO +.endif +.endif + .if ${.MAKE.LEVEL} == 0 .if ${BUILD_AT_LEVEL0:Uyes:tl} == "no" UPDATE_DEPENDFILE = NO diff --git a/contrib/bmake/mk/meta.sys.mk b/contrib/bmake/mk/meta.sys.mk index 764f2d1570ef..dde2c48575a1 100644 --- a/contrib/bmake/mk/meta.sys.mk +++ b/contrib/bmake/mk/meta.sys.mk @@ -1,4 +1,4 @@ -# $Id: meta.sys.mk,v 1.27 2016/02/22 22:44:58 sjg Exp $ +# $Id: meta.sys.mk,v 1.28 2016/04/05 15:58:37 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -20,7 +20,7 @@ .if ${MAKE_VERSION:U0} > 20100901 .if !target(.ERROR) -.-include "local.meta.sys.mk" +.-include <local.meta.sys.mk> # absoulte path to what we are reading. _PARSEDIR = ${.PARSEDIR:tA} diff --git a/contrib/bmake/mk/meta2deps.py b/contrib/bmake/mk/meta2deps.py index ed183f0b944c..6361493db0dd 100755 --- a/contrib/bmake/mk/meta2deps.py +++ b/contrib/bmake/mk/meta2deps.py @@ -37,7 +37,7 @@ We only pay attention to a subset of the information in the """ RCSid: - $Id: meta2deps.py,v 1.18 2015/04/03 18:23:25 sjg Exp $ + $Id: meta2deps.py,v 1.19 2016/04/02 20:45:40 sjg Exp $ Copyright (c) 2011-2013, Juniper Networks, Inc. All rights reserved. @@ -482,7 +482,7 @@ class MetaFile: for p in self.excludes: if p and path.startswith(p): if self.debug > 2: - print >> self.debug_out, "exclude:", p, path + print("exclude:", p, path, file=self.debug_out) return # we don't want to resolve the last component if it is # a symlink diff --git a/contrib/bmake/mk/nls.mk b/contrib/bmake/mk/nls.mk index e302c8dc88cb..67c5eeaa9f3b 100644 --- a/contrib/bmake/mk/nls.mk +++ b/contrib/bmake/mk/nls.mk @@ -1,9 +1,8 @@ # $NetBSD: bsd.nls.mk,v 1.3 1996/10/18 02:34:45 thorpej Exp $ .if !target(.MAIN) -.if exists(${.CURDIR}/../Makefile.inc) -.include "${.CURDIR}/../Makefile.inc" -.endif +# init.mk not included +.-include <${.CURDIR:H}/Makefile.inc> .MAIN: all .endif diff --git a/contrib/bmake/mk/own.mk b/contrib/bmake/mk/own.mk index 070044f8a7a0..b9e4f99ea1f5 100644 --- a/contrib/bmake/mk/own.mk +++ b/contrib/bmake/mk/own.mk @@ -1,4 +1,4 @@ -# $Id: own.mk,v 1.30 2015/11/14 18:09:57 sjg Exp $ +# $Id: own.mk,v 1.32 2016/05/18 20:54:29 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -20,8 +20,8 @@ TARGET_OSTYPE?= ${HOST_OSTYPE} TARGET_HOST?= ${HOST_TARGET} # these may or may not exist -.-include "${TARGET_HOST}.mk" -.-include "config.mk" +.-include <${TARGET_HOST}.mk> +.-include <config.mk> RM?= rm LN?= ln @@ -79,7 +79,7 @@ PRINTOBJDIR= echo # prevent infinite recursion # we really like to have SRCTOP and OBJTOP defined... .if !defined(SRCTOP) || !defined(OBJTOP) -.-include "srctop.mk" +.-include <srctop.mk> .endif .if !defined(SRCTOP) || !defined(OBJTOP) @@ -154,6 +154,7 @@ MANGRP?= ${BINGRP} MANOWN?= ${BINOWN} MANMODE?= ${NONBINMODE} +INCLUDEDIR?= ${libprefix}/include LIBDIR?= ${libprefix}/lib SHLIBDIR?= ${libprefix}/lib .if ${USE_SHLIBDIR:Uno} == "yes" diff --git a/contrib/bmake/mk/prog.mk b/contrib/bmake/mk/prog.mk index 3a7a07ea78ed..db77da298066 100644 --- a/contrib/bmake/mk/prog.mk +++ b/contrib/bmake/mk/prog.mk @@ -1,4 +1,4 @@ -# $Id: prog.mk,v 1.25 2013/07/18 05:46:24 sjg Exp $ +# $Id: prog.mk,v 1.26 2016/03/22 20:45:14 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -66,17 +66,11 @@ CLEANFILES+=strings @${CC} ${CFLAGS} -c x.c -o ${.TARGET} @rm -f x.c -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - @mv -f x.c x.cc @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET} @rm -f x.cc - -.C.o: - ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - - @mv -f x.c x.C - @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET} - @rm -f x.C .endif diff --git a/contrib/bmake/mk/subdir.mk b/contrib/bmake/mk/subdir.mk index 313b7d7a3b2b..2511d1037503 100644 --- a/contrib/bmake/mk/subdir.mk +++ b/contrib/bmake/mk/subdir.mk @@ -1,4 +1,4 @@ -# $Id: subdir.mk,v 1.14 2012/11/12 04:34:33 sjg Exp $ +# $Id: subdir.mk,v 1.15 2016/04/05 15:58:37 sjg Exp $ # skip missing directories... # $NetBSD: bsd.subdir.mk,v 1.11 1996/04/04 02:05:06 jtc Exp $ @@ -9,9 +9,7 @@ # keep everyone happy _SUBDIRUSE: .elif !commands(_SUBDIRUSE) && !defined(NO_SUBDIR) && !defined(NOSUBDIR) -.if exists(${.CURDIR}/Makefile.inc) -.include "Makefile.inc" -.endif +.-include <${.CURDIR}/Makefile.inc> .if !target(.MAIN) .MAIN: all .endif diff --git a/contrib/bmake/mk/sys.mk b/contrib/bmake/mk/sys.mk index 9dc0796ead07..325ce827c5ad 100644 --- a/contrib/bmake/mk/sys.mk +++ b/contrib/bmake/mk/sys.mk @@ -1,4 +1,4 @@ -# $Id: sys.mk,v 1.41 2015/11/14 20:20:34 sjg Exp $ +# $Id: sys.mk,v 1.43 2016/04/05 15:58:37 sjg Exp $ # # @(#) Copyright (c) 2003-2009, Simon J. Gerraty # @@ -109,6 +109,10 @@ _TARGETS := ${.TARGETS} # early customizations .-include <local.sys.env.mk> +# Popular suffixes for C++ +CXX_SUFFIXES += .cc .cpp .cxx .C +CXX_SUFFIXES := ${CXX_SUFFIXES:O:u} + # find the OS specifics .if defined(SYS_OS_MK) .include <${SYS_OS_MK}> @@ -143,7 +147,7 @@ OPTIONS_DEFAULT_DEPENDENT += \ AUTO_OBJ/DIRDEPS_BUILD \ STAGING/DIRDEPS_BUILD \ -.-include "options.mk" +.-include <options.mk> .if ${MK_DIRDEPS_BUILD:Uno} == "yes" MK_META_MODE = yes @@ -201,7 +205,7 @@ Mkdirs= Mkdirs() { \ .c.cpp-out: @${COMPILE.c:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$' -.cc.cpp-out: +${CXX_SUFFIXES:%=%.cpp-out}: @${COMPILE.cc:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$' # late customizations diff --git a/contrib/bmake/mk/sys/AIX.mk b/contrib/bmake/mk/sys/AIX.mk index 18adfa6befda..3109c23c58f1 100644 --- a/contrib/bmake/mk/sys/AIX.mk +++ b/contrib/bmake/mk/sys/AIX.mk @@ -9,7 +9,7 @@ ROOT_GROUP= system NOPIC=no # no shared libs? -.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4 +.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 .LIBS: .a @@ -91,20 +91,11 @@ YACC.y= ${YACC} ${YFLAGS} rm -f $*.o # C++ -.cc: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a: - ${COMPILE.cc} ${.IMPSRC} - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -.C: - ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.C.o: - ${COMPILE.cc} ${.IMPSRC} -.C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/Darwin.mk b/contrib/bmake/mk/sys/Darwin.mk index d05e32ae895e..28cb414a7f1e 100644 --- a/contrib/bmake/mk/sys/Darwin.mk +++ b/contrib/bmake/mk/sys/Darwin.mk @@ -4,7 +4,7 @@ OS= Darwin unix?= We run ${OS}. -.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h +.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .dylib .LIBS: .a .dylib @@ -114,20 +114,11 @@ YACC.y?= ${YACC} ${YFLAGS} rm -f $*.o # C++ -.cc: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a: - ${COMPILE.cc} ${.IMPSRC} - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -.C: - ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.C.o: - ${COMPILE.cc} ${.IMPSRC} -.C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/Generic.mk b/contrib/bmake/mk/sys/Generic.mk index 179da9743598..acf78329cf84 100644 --- a/contrib/bmake/mk/sys/Generic.mk +++ b/contrib/bmake/mk/sys/Generic.mk @@ -1,8 +1,8 @@ -# $Id: Generic.mk,v 1.11 2010/09/24 05:59:53 sjg Exp $ +# $Id: Generic.mk,v 1.12 2016/03/22 20:45:14 sjg Exp $ # # some reasonable defaults -.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h +.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .LIBS: .a @@ -110,11 +110,11 @@ YACC.y?= ${YACC} ${YFLAGS} ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} # C++ -.cc .cpp .cxx .C: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o .cpp.o .cxx.o .C.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a .cpp.a .cxx.a .C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/HP-UX.mk b/contrib/bmake/mk/sys/HP-UX.mk index f6e3e2c81377..95cc59595c68 100644 --- a/contrib/bmake/mk/sys/HP-UX.mk +++ b/contrib/bmake/mk/sys/HP-UX.mk @@ -1,4 +1,4 @@ -# $Id: HP-UX.mk,v 1.9 2003/09/30 16:42:23 sjg Exp $ +# $Id: HP-UX.mk,v 1.10 2016/03/22 20:45:14 sjg Exp $ # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -14,7 +14,7 @@ OSMAJOR?=9 OSMAJOR?=10 __HPUX_VERSION?=${OSMAJOR} -.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4 +.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 LIBMODE= 755 LIBCRT0= /lib/crt0.o @@ -131,20 +131,11 @@ YACC.y= ${YACC} ${YFLAGS} rm -f $*.o # C++ -.cc: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a: - ${COMPILE.cc} ${.IMPSRC} - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -.C: - ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.C.o: - ${COMPILE.cc} ${.IMPSRC} -.C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/IRIX.mk b/contrib/bmake/mk/sys/IRIX.mk index 783e405b24c6..6909bdfcb4ba 100644 --- a/contrib/bmake/mk/sys/IRIX.mk +++ b/contrib/bmake/mk/sys/IRIX.mk @@ -10,7 +10,7 @@ ROOT_GROUP!= sed -n /:0:/s/:.*//p /etc/group unix?= We run ${OS}. .endif -.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h +.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .LIBS: .a @@ -102,11 +102,11 @@ YACC.y?= ${YACC} ${YFLAGS} ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} # C++ -.cc .cpp .cxx .C: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o .cpp.o .cxx.o .C.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a .cpp.a .cxx.a .C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/Linux.mk b/contrib/bmake/mk/sys/Linux.mk index 862cde647800..c619412bcb86 100644 --- a/contrib/bmake/mk/sys/Linux.mk +++ b/contrib/bmake/mk/sys/Linux.mk @@ -1,4 +1,4 @@ -# $Id: Linux.mk,v 1.7 2011/03/02 05:05:21 sjg Exp $ +# $Id: Linux.mk,v 1.8 2016/03/22 20:45:14 sjg Exp $ # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -12,7 +12,7 @@ LIBCRT0= /dev/null NEED_SOLINKS=yes -.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4 +.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 .LIBS: .a @@ -94,20 +94,11 @@ YACC.y= ${YACC} ${YFLAGS} rm -f $*.o # C++ -.cc: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a: - ${COMPILE.cc} ${.IMPSRC} - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -.C: - ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.C.o: - ${COMPILE.cc} ${.IMPSRC} -.C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/NetBSD.mk b/contrib/bmake/mk/sys/NetBSD.mk index 4bc7da1d840a..a17a3f85bb4b 100644 --- a/contrib/bmake/mk/sys/NetBSD.mk +++ b/contrib/bmake/mk/sys/NetBSD.mk @@ -19,7 +19,7 @@ MAKE_VERSION = 20010606 .endif .endif -.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h +.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .LIBS: .a @@ -137,11 +137,11 @@ YACC.y?= ${YACC} ${YFLAGS} ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} # C++ -.cc .cpp .cxx .C: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o .cpp.o .cxx.o .C.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a .cpp.a .cxx.a .C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/OSF1.mk b/contrib/bmake/mk/sys/OSF1.mk index a8d729a6c2db..dfaa896680ef 100644 --- a/contrib/bmake/mk/sys/OSF1.mk +++ b/contrib/bmake/mk/sys/OSF1.mk @@ -1,4 +1,4 @@ -# $Id: OSF1.mk,v 1.6 2003/09/30 16:42:23 sjg Exp $ +# $Id: OSF1.mk,v 1.7 2016/03/22 20:45:15 sjg Exp $ # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -11,7 +11,7 @@ LIBCRT0= /dev/null PATH=/usr/sbin:/usr/bin:/usr/ucb:/opt/gnu/bin:/usr/ccs/bin -.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4 +.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 .LIBS: .a @@ -105,20 +105,11 @@ YACC.y= ${YACC} ${YFLAGS} rm -f $*.o # C++ -.cc: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a: - ${COMPILE.cc} ${.IMPSRC} - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -.C: - ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.C.o: - ${COMPILE.cc} ${.IMPSRC} -.C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/OpenBSD.mk b/contrib/bmake/mk/sys/OpenBSD.mk index ed496f12c208..c8d7e3e42f9c 100644 --- a/contrib/bmake/mk/sys/OpenBSD.mk +++ b/contrib/bmake/mk/sys/OpenBSD.mk @@ -4,7 +4,7 @@ OS= OpenBSD unix?= We run ${OS}. -.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h +.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .LIBS: .a @@ -112,11 +112,11 @@ YACC.y?= ${YACC} ${YFLAGS} ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} # C++ -.cc .cpp .cxx .C: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o .cpp.o .cxx.o .C.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a .cpp.a .cxx.a .C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/SunOS.mk b/contrib/bmake/mk/sys/SunOS.mk index 73f8062794e2..75d83c2bf442 100644 --- a/contrib/bmake/mk/sys/SunOS.mk +++ b/contrib/bmake/mk/sys/SunOS.mk @@ -1,4 +1,4 @@ -# $Id: SunOS.mk,v 1.6 2014/04/05 22:56:54 sjg Exp $ +# $Id: SunOS.mk,v 1.7 2016/03/22 20:45:15 sjg Exp $ .if ${.PARSEFILE} == "sys.mk" .include <host-target.mk> @@ -41,7 +41,7 @@ CPP= cpp # the rest is common -.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4 +.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 .LIBS: .a @@ -126,20 +126,11 @@ YACC.y= ${YACC} ${YFLAGS} rm -f $*.o # C++ -.cc: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a: - ${COMPILE.cc} ${.IMPSRC} - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -.C: - ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.C.o: - ${COMPILE.cc} ${.IMPSRC} -.C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/sys/UnixWare.mk b/contrib/bmake/mk/sys/UnixWare.mk index f21895b6e60b..49a52a238997 100644 --- a/contrib/bmake/mk/sys/UnixWare.mk +++ b/contrib/bmake/mk/sys/UnixWare.mk @@ -1,4 +1,4 @@ -# $Id: UnixWare.mk,v 1.1 2005/10/09 22:56:40 sjg Exp $ +# $Id: UnixWare.mk,v 1.2 2016/03/22 20:45:15 sjg Exp $ # based on "Id: SunOS.5.sys.mk,v 1.6 2003/09/30 16:42:23 sjg Exp " # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -12,7 +12,7 @@ LIBCRT0= /dev/null PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/ccs/lib:/usr/ucb:/usr/local/bin -.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4 +.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 .LIBS: .a @@ -148,20 +148,11 @@ YACC.y?= ${YACC} ${YFLAGS} rm -f $*.o # C++ -.cc: +${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.cc.o: +${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} -.cc.a: - ${COMPILE.cc} ${.IMPSRC} - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -.C: - ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} -.C.o: - ${COMPILE.cc} ${.IMPSRC} -.C.a: +${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o diff --git a/contrib/bmake/mk/warnings.mk b/contrib/bmake/mk/warnings.mk index dc230bc83280..7fb3ebd4a8f8 100644 --- a/contrib/bmake/mk/warnings.mk +++ b/contrib/bmake/mk/warnings.mk @@ -1,5 +1,5 @@ # RCSid: -# $Id: warnings.mk,v 1.9 2016/02/20 02:00:58 sjg Exp $ +# $Id: warnings.mk,v 1.14 2016/04/05 15:58:37 sjg Exp $ # # @(#) Copyright (c) 2002, Simon J. Gerraty # @@ -19,7 +19,7 @@ .MAKE.SAVE_DOLLARS = no # Any number of warnings sets can be added. -.-include "warnings-sets.mk" +.-include <warnings-sets.mk> # Modest defaults - put more elaborate sets in warnings-sets.mk # -Wunused etc are here so you can set @@ -50,6 +50,11 @@ EXTRA_WARNINGS?= ${HIGH_WARNINGS} -Wextra DEFAULT_WARNINGS_SET?= MIN WARNINGS_SET?= ${DEFAULT_WARNINGS_SET} +# There is always someone who wants more... +.if !empty(WARNINGS_XTRAS) +${WARNINGS_SET}_WARNINGS += ${WARNINGS_XTRAS} +.endif + # If you add sets, besure to list them (you don't have to touch this list). ALL_WARNINGS_SETS+= MIN LOW MEDIUM HIGH EXTRA @@ -72,7 +77,7 @@ _empty_warnings: .PHONY # Without -O or if we've set -O0 somewhere - to make debugging more effective, # we need to turn off -Wuninitialized as otherwise we get a warning that # -Werror turns into an error. To be safe, set W_uninitialized blank. -_w_cflags:= ${CFLAGS} ${CPPFLAGS} +_w_cflags= ${CFLAGS} ${CFLAGS_LAST} ${CPPFLAGS} .if ${_w_cflags:M-O*} == "" || ${_w_cflags:M-O0} != "" W_uninitialized= .endif @@ -118,6 +123,7 @@ CFLAGS+= ${WARNINGS_${.TARGET:T:R}.o:U${WARNINGS}} # it is rather silly that g++ blows up on some warning flags NO_CXX_WARNINGS+= \ + implicit \ missing-declarations \ missing-prototypes \ nested-externs \ diff --git a/contrib/bmake/parse.c b/contrib/bmake/parse.c index 03275e2c5085..6d2cfb40a6e1 100644 --- a/contrib/bmake/parse.c +++ b/contrib/bmake/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.213 2016/03/11 13:54:47 matthias Exp $ */ +/* $NetBSD: parse.c,v 1.214 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: parse.c,v 1.213 2016/03/11 13:54:47 matthias Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.214 2016/04/06 09:57:00 gson Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: parse.c,v 1.213 2016/03/11 13:54:47 matthias Exp $"); +__RCSID("$NetBSD: parse.c,v 1.214 2016/04/06 09:57:00 gson Exp $"); #endif #endif /* not lint */ #endif @@ -809,11 +809,11 @@ ParseMessage(char *line) return FALSE; } - while (isalpha((u_char)*line)) + while (isalpha((unsigned char)*line)) line++; - if (!isspace((u_char)*line)) + if (!isspace((unsigned char)*line)) return FALSE; /* not for us */ - while (isspace((u_char)*line)) + while (isspace((unsigned char)*line)) line++; line = Var_Subst(NULL, line, VAR_CMD, VARF_WANTRES); diff --git a/contrib/bmake/str.c b/contrib/bmake/str.c index 0260447f8178..5e4e8f6cc1c9 100644 --- a/contrib/bmake/str.c +++ b/contrib/bmake/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $ */ +/* $NetBSD: str.c,v 1.36 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: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $"; +static char rcsid[] = "$NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else -__RCSID("$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $"); +__RCSID("$NetBSD: str.c,v 1.36 2016/04/06 09:57:00 gson Exp $"); #endif #endif /* not lint */ #endif @@ -102,7 +102,7 @@ str_concat(const char *s1, const char *s2, int flags) len2 = strlen(s2); /* allocate length plus separator plus EOS */ - result = bmake_malloc((u_int)(len1 + len2 + 2)); + result = bmake_malloc((unsigned int)(len1 + len2 + 2)); /* copy first string into place */ memcpy(result, s1, len1); diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile index 8e1afa2df2bf..d573436e2896 100644 --- a/usr.bin/bmake/Makefile +++ b/usr.bin/bmake/Makefile @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $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?= ${.CURDIR:T} |