Home | History | Annotate | only in /src/usr.bin/mkdep
History log of /src/usr.bin/mkdep
RevisionDateAuthorComments
 1.17 12-Apr-2009  lukem fix -Wcast-qual & -Wsign-compare issues
 1.16 13-Feb-2009  uebayasi Comment out CFLAGS+=-g.
 1.15 30-Oct-2006  christos branches: 1.15.24; 1.15.26;
kill crypto/rmd160.h and crypto/sha2.h, and instead make symlinks to
/usr/include from /usr/include/sys. This makes all the one way hash
header handling identical.
 1.14 10-Nov-2003  dsl Add the following options with a view to using 'cc -MD' to automatically
create dependency files:
-d process xxx.d files to generate .depend (don't run ${CC})
-o add .OPTIONAL: <headers> to output file
-q don't print warnins for missing files (with -d)
-s suf list of suffixes to replace ".o"
The -s suf should allow all the 'afterdepend' stuff to be killed.
(christos thought this might be a good idea...)
 1.13 18-May-2003  lukem Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
 1.12 14-Jun-2002  simonb Split out the findcc() function that tries to determine the path to
the C compiler so other programs can use it.
 1.11 14-Aug-2001  tv Add hooks to allow toolchain bits to be reachover-built at the top level.
 1.10 25-Jan-1999  tron Build and install "mkdep.c".
 1.9 27-Mar-1997  mycroft Set SCRIPTSNAME correctly.
 1.8 24-Mar-1997  christos - Makefile cleanups
 1.7 18-Oct-1996  thorpej Use ${INSTALL}.
 1.6 23-Dec-1994  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.5 22-Dec-1994  cgd specify man pages the new way.
 1.4 21-Feb-1994  mycroft Everyone uses GCC now.
 1.3 15-Feb-1994  pk Sparc uses gcc too...
 1.2 31-Jul-1993  mycroft Add RCS indentifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 23-Dec-1994  jtc imported from 44lite
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.15.26.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.15.24.1 08-Dec-2010  riz Pull up following revision(s) (requested by uwe in ticket #1490):
usr.bin/mkdep/Makefile: revision 1.16
sbin/dump_lfs/Makefile: revision 1.10
usr.sbin/services_mkdb/Makefile: revision 1.5
sbin/ifconfig/Makefile: revision 1.40
usr.sbin/racoonctl/Makefile: revision 1.3
sbin/sysctl/Makefile: revision 1.18
Comment out CFLAGS+=-g.
Disable debug.
 1.10 20-Aug-2021  rillig mkdep: avoid memory allocation in findcc

This change takes the idea of handling strings as pairs in the form
(start, len) by Robert Elz from
https://mail-index.netbsd.org/source-changes-d/2021/08/20/msg013427.html
and expands it by avoiding one more memory allocation, for iterating the
PATH environment variable.

No functional change.
 1.9 20-Aug-2021  rillig mkdep: make argument of findcc const

Previously, findcc modified its argument string, even though it had been
declared as 'const char *'. This triggered a lint warning that "strchr
effectively discards 'const char *' from argument", in fact, this code
caused the lint check to be implemented in the first place.

The first attempt at fixing it by removing the 'const' from the
parameter type was a bad idea since it made the API of that function
more complicated.

Revert back to making the parameter a 'const char *' and duplicate that
string internally as necessary. Add a few more tests for absolute
pathnames since these had been missing before. There are no tests yet
for snprintf with too long strings, but the current change does not
modify that part of the code.
 1.8 19-Aug-2021  rillig mkdep: fix prototype of findcc

A function that modifies a string argument must not declare that
argument as 'const char *', even if all callers (mkdep and lint) always
pass it a modifiable string.

No functional change.
 1.7 11-Aug-2021  rillig mkdep: document possible undefined behavior

If findcc is called with a constant string, as its prototype suggests,
the process crashes with a segmentation fault. Luckily, neither mkdep
nor lint do that, but the function prototype is nevertheless confusing.
 1.6 04-Sep-2011  joerg ANSIfy + static + __dead
 1.5 12-Apr-2009  lukem fix -Wcast-qual & -Wsign-compare issues
 1.4 21-Jul-2008  lukem branches: 1.4.6;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.3 28-Apr-2008  martin branches: 1.3.2;
Remove clause 3 and 4 from TNF licenses
 1.2 27-Oct-2003  lukem branches: 1.2.32;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 14-Jun-2002  simonb Split out the findcc() function that tries to determine the path to
the C compiler so other programs can use it.
 1.2.32.1 18-May-2008  yamt sync with head.
 1.3.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.3 20-Aug-2021  rillig mkdep: make argument of findcc const

Previously, findcc modified its argument string, even though it had been
declared as 'const char *'. This triggered a lint warning that "strchr
effectively discards 'const char *' from argument", in fact, this code
caused the lint check to be implemented in the first place.

The first attempt at fixing it by removing the 'const' from the
parameter type was a bad idea since it made the API of that function
more complicated.

Revert back to making the parameter a 'const char *' and duplicate that
string internally as necessary. Add a few more tests for absolute
pathnames since these had been missing before. There are no tests yet
for snprintf with too long strings, but the current change does not
modify that part of the code.
 1.2 19-Aug-2021  rillig mkdep: fix prototype of findcc

A function that modifies a string argument must not declare that
argument as 'const char *', even if all callers (mkdep and lint) always
pass it a modifiable string.

No functional change.
 1.1 14-Jun-2002  simonb Split out the findcc() function that tries to determine the path to
the C compiler so other programs can use it.
 1.18 05-Mar-2013  christos add -i and -v
 1.17 26-Aug-2012  jmmv branches: 1.17.2;
Add a new "-P prefix" option to mkdep(1).

This option prepends the string given in prefix to every target
filename. This is useful for programs that have source files in
multiple subdirectories and a single Makefile that references all of
them explicitly (without using the VPATH functionality because there
can be files with the same name in each subdirectory).
 1.16 30-Jun-2011  wiz branches: 1.16.2;
dependant -> dependent
 1.15 15-Oct-2010  dholland Per PR 19359 note that mkdep doesn't handle all make metacharacters
correctly; in particular, filenames containing '#' cause trouble,
although '$' seems to be ok. Bump date.
 1.14 12-Dec-2005  wiz Sort options.
 1.13 12-Dec-2005  dsl Add a -D option that acts like -d, but reads the filenames (whitespace
separated) from stdin.
Useful (eg in Makefile.kern.inc) to avoid breaking the systems command
line limit.
 1.12 19-Oct-2005  ross Edit -s text.
 1.11 10-Nov-2003  dsl Add the following options with a view to using 'cc -MD' to automatically
create dependency files:
-d process xxx.d files to generate .depend (don't run ${CC})
-o add .OPTIONAL: <headers> to output file
-q don't print warnins for missing files (with -d)
-s suf list of suffixes to replace ".o"
The -s suf should allow all the 'afterdepend' stuff to be killed.
(christos thought this might be a good idea...)
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.9 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.8 01-Dec-2001  wiz Sort sections.
 1.7 01-Dec-2001  wiz Whitespace cleanup.
 1.6 22-Mar-1999  garbled More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages. Many more to
come.
 1.5 28-Jan-1999  tron Because neither the original shell script nor the new C program can
handle multiple argument sets don't use them in the manual page.
 1.4 19-Oct-1997  lukem fix up .Nm usage
 1.3 23-Dec-1994  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.2 01-Aug-1993  mycroft Add RCS indentifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 23-Dec-1994  jtc imported from 44lite
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.16.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.2.1 30-Oct-2012  yamt sync with head
 1.17.2.1 23-Jun-2013  tls resync from head
 1.5 11-Jun-2003  tron Remove old, unused and unsafe shell scripts as suggested by Jeremy C. Reed
on "current-users".
 1.4 06-Jan-2003  wiz writable, not writeable.
 1.3 31-Mar-1998  perry remove /usr/ucb from PATHs, per Jim Bernard (pr 5236)
 1.2 23-Dec-1994  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 23-Dec-1994  jtc imported from 44lite
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.47 20-Aug-2021  rillig mkdep: make argument of findcc const

Previously, findcc modified its argument string, even though it had been
declared as 'const char *'. This triggered a lint warning that "strchr
effectively discards 'const char *' from argument", in fact, this code
caused the lint check to be implemented in the first place.

The first attempt at fixing it by removing the 'const' from the
parameter type was a bad idea since it made the API of that function
more complicated.

Revert back to making the parameter a 'const char *' and duplicate that
string internally as necessary. Add a few more tests for absolute
pathnames since these had been missing before. There are no tests yet
for snprintf with too long strings, but the current change does not
modify that part of the code.
 1.46 20-Aug-2021  rillig mkdep: fix string constness in call to findcc
 1.45 23-May-2018  joerg deconst -> __UNCONST to avoid null pointer arithmetic
 1.44 16-Jun-2015  christos branches: 1.44.14;
fix some error handling.
 1.43 05-Mar-2013  christos Conditionally include the depend files.
 1.42 05-Mar-2013  christos add -i and -v
 1.41 26-Aug-2012  jmmv branches: 1.41.2;
Add a new "-P prefix" option to mkdep(1).

This option prepends the string given in prefix to every target
filename. This is useful for programs that have source files in
multiple subdirectories and a single Makefile that references all of
them explicitly (without using the VPATH functionality because there
can be files with the same name in each subdirectory).
 1.40 04-Sep-2011  joerg branches: 1.40.2;
ANSIfy + static + __dead
 1.39 30-Jun-2011  wiz dependant -> dependent
 1.38 31-May-2011  enami Don't touch before the mmap'ed region.
 1.37 30-May-2011  christos Handle the empty suffix properly. Convert suffix list to a list from an
array and don't have limits in the suffix length. Also don't require that
suffixes have a single dot.
 1.36 17-Apr-2011  christos Recognize --sysroot but don't document it or do anything about it for now.
 1.35 26-May-2010  christos fix empty suffix case.
 1.34 26-May-2010  christos PR/43364: Nicolas Joly: mkdep(1) wrong target names when suffix list miss .o
 1.33 12-Apr-2009  lukem fix -Wcast-qual & -Wsign-compare issues
 1.32 21-Jul-2008  lukem branches: 1.32.6;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.31 28-Apr-2008  martin branches: 1.31.2;
Remove clause 3 and 4 from TNF licenses
 1.30 25-Sep-2007  lukem branches: 1.30.6;
remove unnecessary #include
 1.29 15-Oct-2006  christos branches: 1.29.8;
- make a variable volatile, that gcc warns vfork will clobber.
- don't blindly walk before the beginning of the buffer because of a
corrupt dependency file. In this case the first character of the
dependency file was a :
 1.28 20-Mar-2006  christos make this compile again.
 1.27 20-Mar-2006  elad plug leaks, coverity cids 92, 93.
 1.26 12-Dec-2005  wiz Sort options.
 1.25 12-Dec-2005  dsl Add a -D option that acts like -d, but reads the filenames (whitespace
separated) from stdin.
Useful (eg in Makefile.kern.inc) to avoid breaking the systems command
line limit.
 1.24 07-Jun-2005  he Initialize a couple of local variables to appease -Wuninitialized.
Marked with XXXGCC for sun2 (found while compiling for it).

Reviewed by lukem.
 1.23 13-Jul-2004  wiz Sync usage with man page. From Kouichirou Hiratsuka in PR 26224.
 1.22 26-Jan-2004  dsl Redo code that expands the 'xxx.o' to 'xxx.o xxx.so xxx.po xxx.ln' so that
is doesn't care which of the wanted suffixes are in the input file.
Needed for my autodepend code where you don't know which compilation ran last.
 1.21 07-Dec-2003  dsl Only emit each filename once in a single .OPTIONAL line when -o is given.
(Saves several MB for kernel .depend files.)
 1.20 11-Nov-2003  dsl Don't rely on mmap giving a NUL terminated buffer.
Let '--' be used to separate options to mkdep from those to cc.
 1.19 10-Nov-2003  dsl Fix continuation line handling.
 1.18 10-Nov-2003  dsl Add the following options with a view to using 'cc -MD' to automatically
create dependency files:
-d process xxx.d files to generate .depend (don't run ${CC})
-o add .OPTIONAL: <headers> to output file
-q don't print warnins for missing files (with -d)
-s suf list of suffixes to replace ".o"
The -s suf should allow all the 'afterdepend' stuff to be killed.
(christos thought this might be a good idea...)
 1.17 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.16 28-Mar-2003  msaitoh catch SIGPIPE, too.
 1.15 19-Jan-2003  elric Backing this out until it works.
 1.14 18-Jan-2003  jmmv When an unknown option is found, ignore it, as it may be cc related (i.e.,
-D and -I options).
 1.13 18-Jan-2003  jmmv Use getopt(3) instead of specific code to parse options.
Reviewed by jdolecek.
 1.12 16-Jan-2003  msaitoh catch SIGINT, SIGHUP, SIGQUIT and SIGTERM to clear a temporary file.
 1.11 14-Jun-2002  simonb Split out the findcc() function that tries to determine the path to
the C compiler so other programs can use it.
 1.10 31-Jan-2002  tv branches: 1.10.2;
Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.9 21-Jan-2002  tv Add hooks for cross-hosting on non-NetBSD platforms.
 1.8 22-Mar-2001  cgd a couple of tiny whitespace cleanups
 1.7 22-Mar-2001  cgd get closer to KNF.
 1.6 22-Mar-2001  cgd convert uses of hard-coded string "mkdep" to use getprogname().
 1.5 21-Feb-2001  cgd call setprogname(argv[0]) at start of main()
 1.4 21-Jul-1999  kleink branches: 1.4.8;
Rather than hardcoding _PATH_TMP (and relying on const string concatenation),
try TMPDIR (if set in the environment).
 1.3 31-Mar-1999  kleink * Make usage string reflect reality,
* declare internal utility functions static,
* remove unneeded workarounds for bogus -Wuninitialized reports,
* delint.
 1.2 18-Mar-1999  sommerfe Do something sane if we have CC='cc -pipe' set
 1.1 25-Jan-1999  tron branches: 1.1.1;
Initial revision
 1.1.1.1 25-Jan-1999  tron New C program to replace old "mkdep" script. Speeds up "make depend"
by at least 5 percent.
 1.4.8.2 25-Jun-2003  itojun usr.bin/mkdep/mkdep.c 1.16

catch SIGPIPE too, so that we do not leave temporary files behind.
[msaitoh, ticket #49]
 1.4.8.1 15-Mar-2003  he Pull up revision 1.12 (requested by msaitoh in ticket #19):
Catch SIGINT, SIGHUP, SIGQUIT and SIGTREM and clear a temporary
file.
 1.10.2.2 30-Jun-2003  grant Pull up revision 1.16 (requested by msaitoh in ticket #1339):

catch SIGPIPE, too.
 1.10.2.1 27-Jan-2003  jmc Pullup revisions 1.11-1.12 (with hand patching)
(requested by masanobu in ticket #1111)
Catch SIGINT, SIGHUP, SIGQUIT and SIGTERM to clear a temporary file.
 1.29.8.1 06-Nov-2007  matt sync with HEAD
 1.30.6.1 18-May-2008  yamt sync with head.
 1.31.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.40.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.40.2.1 30-Oct-2012  yamt sync with head
 1.41.2.1 23-Jun-2013  tls resync from head
 1.44.14.1 25-Jun-2018  pgoyette Sync with HEAD
 1.16 11-Jun-2003  tron Remove old, unused and unsafe shell scripts as suggested by Jeremy C. Reed
on "current-users".
 1.15 28-Jan-1999  tron Fix usage messages in case we are going to revive one of these.
 1.14 09-Apr-1998  fair per PR#4304 no need to set PATH (especially after testing it!)
 1.13 31-Mar-1998  perry remove /usr/ucb from PATHs, per Jim Bernard (pr 5236)
 1.12 22-Jul-1997  cgd quote ${CC} so that multi-word values work right (for some defn of "right")
 1.11 21-Jul-1997  cgd fix a couple of bogons in the changes to the sed regexps in my previous
commit. ("Works Great!!" "More Testing!!!")
 1.10 20-Jul-1997  cgd find the compiler more correctly: if user has set 'CC' use it but expand
it to a full path using the user's path, before setting the path used by
the script. If it can't be found, try using the standard path used by the
script to find it (/bin:/usr/bin:/usr/ucb), and if it still can't be
found, exit. If user hasn't set CC, try to use cc, again searched for
via their path, then via the standard path.
Also, clean up regexps used to post-process ${CC} -M output, so that
they work on a wider variety of compilers.
 1.9 23-Dec-1994  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.8 19-Sep-1994  mycroft Use `gcc', not `cpp', for depending.
 1.7 16-Aug-1993  mycroft Call `cpp', not `gcc'.
 1.6 17-Jul-1993  cgd do c++ dependencies the right way...
 1.5 16-Jun-1993  mycroft Use $@ rather than $*.
 1.4 16-Jun-1993  mycroft Oops. Need some quotes now that $SED has spaces in it.
 1.3 16-Jun-1993  mycroft Make the sed expression a tad stricter so we don't lose depending hack.
 1.2 16-Jun-1993  sef Deal properly with single-module programs. Also, use "$@", not $*!
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 23-Dec-1994  jtc imported from 44lite
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5 11-Jun-2003  tron Remove old, unused and unsafe shell scripts as suggested by Jeremy C. Reed
on "current-users".
 1.4 06-Jan-2003  wiz writable, not writeable.
 1.3 31-Mar-1998  perry remove /usr/ucb from PATHs, per Jim Bernard (pr 5236)
 1.2 23-Dec-1994  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 23-Dec-1994  jtc imported from 44lite
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7 11-Jun-2003  tron Remove old, unused and unsafe shell scripts as suggested by Jeremy C. Reed
on "current-users".
 1.6 28-Jan-1999  tron Fix usage messages in case we are going to revive one of these.
 1.5 09-Apr-1998  fair per PR#4304 no need to set PATH (especially after testing it!)
 1.4 31-Mar-1998  perry remove /usr/ucb from PATHs, per Jim Bernard (pr 5236)
 1.3 23-Dec-1994  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.2 21-Feb-1994  mycroft Same .o fix as mkdep.gcc.sh; not currently relevant as we use GCC.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 23-Dec-1994  jtc imported from 44lite
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.4 11-Jun-2003  tron Remove old, unused and unsafe shell scripts as suggested by Jeremy C. Reed
on "current-users".
 1.3 06-Jan-2003  wiz writable, not writeable.
 1.2 23-Dec-1994  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 23-Dec-1994  jtc imported from 44lite
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources

RSS XML Feed