Import bmake-20160512

Interesting changes (from ChangeLog):
o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS
  this is useful for gcov builds.
o propagate errors from filemon(4).
o meta.c: apply realpath() before matching against metaIgnorePaths
o allow makefile to set .MAKE.JOBS
This commit is contained in:
Simon J. Gerraty 2016-05-20 16:19:56 +00:00
parent b7ff84ad75
commit e917534a84
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=300309
svn path=/vendor/NetBSD/bmake/20160512/; revision=300310; tag=vendor/NetBSD/bmake/20160512
44 changed files with 557 additions and 339 deletions

View File

@ -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

View File

@ -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

10
arch.c
View File

@ -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;
}

View File

@ -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:

View File

@ -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

View File

@ -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

12
job.c
View File

@ -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
@ -1056,7 +1056,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

44
main.c
View File

@ -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
@ -1151,14 +1151,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))

7
make.1
View File

@ -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:

84
meta.c
View File

@ -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);
}
/*

6
meta.h
View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,72 +21,92 @@ __${.PARSEFILE}__:
_OBJDIR?= ${.OBJDIR}
_CURDIR?= ${.CURDIR}
# DPLIBS helps us ensure we keep DPADD and LDADD in sync
DPLIBS+= ${DPLIBS_LAST}
DPADD+= ${DPLIBS}
.for __lib in ${DPLIBS:T:R}
LDADD+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
.endfor
# DPADD can contain things other than libs
__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}}@}
.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}
# 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
# 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}
LDADD += ${__dpadd_libdirs:M-L${OBJTOP}/*}
LDADD += ${__dpadd_libdirs:N-L${OBJTOP}/*}
.if ${.CURDIR} == ${SRCTOP}
.if ${_CURDIR} == ${SRCTOP}
RELDIR=.
RELTOP=.
.else
RELDIR?= ${.CURDIR:S,${SRCTOP}/,,}
.if ${RELDIR} == ${.CURDIR}
RELDIR?= ${.OBJDIR:S,${OBJTOP}/,,}
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:N-*}
.for __lib in ${DPLIBS:T:R}
.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*}
# some libs have dependencies...
# DPLIBS_* allows bsd.libnames.mk to flag libs which must be included
# in DPADD for a given library.
# 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}
.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.
# 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}
LDADD += ${__dpadd_libdirs:M-L${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
.if !make(dpadd)
.ifdef LIB
# Each lib is its own src_lib, we want to include it in SRC_LIBS
@ -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

View File

@ -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>

View File

@ -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}'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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}

View File

@ -37,7 +37,7 @@
"""
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 @@ def parse_path(self, path, cwd, op=None, w=[]):
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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 \

12
parse.c
View File

@ -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);

8
str.c
View File

@ -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);