Home | History | Annotate | Download | only in make
History log of /src/usr.bin/make/dir.h
RevisionDateAuthorComments
 1.49  07-Jul-2024  rillig make: only generate code for cleanup functions in CLEANUP mode
 1.48  19-May-2024  sjg branches: 1.48.2;
make: use separate function to include makefiles.

Have Dir_FindFile and Dir_FindInclude call FindFile with a
bool flag to indicate whether .CURDIR should be be searched at all.
 1.47  24-Jan-2023  sjg make: .SYSPATH: to add dirs to sysIncPath

.SYSPATH: with no sources will clear sysIncPath
otherwise sources are added

Reviewed by: rillig
 1.46  15-Dec-2021  rillig make: remove redundant comments for multiple-inclusion guards
 1.45  15-Dec-2021  rillig make: mark several functions whose result must be used

Suggested by sjg, to catch more bugs like the memory leak in cond.c
1.303 from 2021-12-13.

No binary change.
 1.44  03-Apr-2021  rillig make: use C99 bool type instead of defining its own

No functional change.
 1.43  05-Feb-2021  rillig make: add const to SearchPath_Print
 1.42  23-Jan-2021  rillig make(1): rename Dir_AddDir, reorder parameters of SearchPath_ToFlags
 1.41  23-Jan-2021  rillig make(1): rename Dir_Expand to SearchPath_Expand

The main subject of this function is the search path. In this search
path the pattern is expanded.
 1.40  01-Dec-2020  rillig make(1): remove Dir_InitDir

The function name had been too ambiguous since it didn't mention the
particular directory that was initialized. Instead of that function,
Dir_InitCur is called directly from main_Init.

The pseudo CachedDir entry ".DOTLAST" is initialized at the very
beginning. The observable behavior is unchanged since this a
memory-only object with no connection to the file system.
 1.39  29-Nov-2020  rillig make(1): use space instead of tab for preprocessor directives
 1.38  29-Nov-2020  rillig make(1): unexport CachedDir internals
 1.37  28-Nov-2020  rillig make(1): replace Dir_Destroy with SearchPath_Free

The function Dir_Destroy is an implementation detail of the cached
directories, and it should not be exported to the other modules. The
search paths, on the other hand, are the high-level API that may be used
by the other modules, as the concept of search paths is documented in
the manual page.
 1.36  28-Nov-2020  rillig make(1): rename some Dir functions to SearchPath

These functions have the search path as their main subject.
 1.35  23-Nov-2020  rillig make(1): migrate CachedDir.files from HashTable to HashSet
 1.34  14-Nov-2020  rillig make(1): remove redundant struct make_stat

In the cache for stat(2) and lstat(2), only one of the two timestamps
was ever used. To prevent a result from stat(2) leaking into the cache
for lstat(2), there have been two completely separate caches all the
time. Using different fields in the struct was therefore unnecessary.

By removing the redundant field, the internal struct in the cache is the
same as the external struct. This makes one of them redundant, thus
struct make_stat has been renamed to cached_stat, which better describes
its purpose, and the internal struct cache_st has been removed.

Just as before, the cache prevents any direct access to its internal
data. When passing it to the caller, it is copied.

Just as before, the field names of struct cached_stat cannot correspond
to those from struct stat, since the latter are often defined as macros.
Therefore they are prefixed with cst instead of st.

The redundancy had been added on 2020-06-05.
 1.33  08-Nov-2020  rillig make(1): change return type of Dir_MTime to void

Only some callers actually needed the updated time, and because of the
many branches, it was difficult to see that the return value was indeed
gn->mtime all the time.
 1.32  25-Oct-2020  rillig make(1): replace Dir_CopyDir with Dir_CopyDirSearchPath

Callback functions for the Lst functions do not belong in the public API
of a module.
 1.31  19-Oct-2020  rillig make(1): clean up headers, no functional change
 1.30  18-Oct-2020  rillig make(1): remove underscore from Hash_Table and Hash_Entry

For consistency with the other type names, such as GNodeListNode.
 1.29  05-Oct-2020  rillig make(1): remove pathname limit for Dir_FindHereOrAbove

While trying to compile the code with GCC's -Wformat-truncation, the
snprintf calls felt quite complicated. The function Dir_FindHereOrAbove
is not in a bottleneck execution path, therefore it doesn't hurt to
dynamically allocate the memory instead of using size-limited stack
memory.
 1.28  05-Oct-2020  rillig make(1): make dir.c, for.c and hash.c ready for WARNS=6

Some types have changed from int to unsigned int, size_t or time_t.

The variable i in hash.c has been kept as int since it counts down to
-1, which generates efficient machine code, at least on x86_64.
 1.27  27-Sep-2020  rillig make(1): improve documentation of CachedDir and Dir_AddDir
 1.26  27-Sep-2020  rillig make(1): normalize whitespace in source code

There is no more space tab. Either only tabs or only spaces or tabs
followed by spaces, but not spaces followed by tabs.
 1.25  22-Sep-2020  rillig make(1): use fine-grained type names for lists and their nodes

This is only intended to help the human reader. There is no additional
type safety yet.
 1.24  22-Sep-2020  rillig make(1): rename type Path to CachedDir

The word "path" is commonly used either as an abbreviation for pathname
(a string consisting of several directory or file names) or as an
abbreviation for search path (a list of directory names used for
searching files), but not for a single directory.
 1.23  02-Sep-2020  rillig make(1): reduce number of stat fields returned by cached_stat

Only st_mtime and st_mode are actually filled, the remaining fields had
been set to zero. To prevent these from ever being accessed, a custom
struct make_stat replaces the previously used struct stat.

The fields in struct make_stat are intentionally named different from
the fields in struct stat because NetBSD and some other operating
systems define st_mtime as a macro, and that would not work in a field
declaration.
 1.22  01-Sep-2020  rillig make(1): improve variable names and data types in Dir_FindHereOrAbove
 1.21  01-Sep-2020  rillig make(1): make data types in Dir_HasWildcards more precise
 1.20  22-Aug-2020  rillig make(1): clean up headers

Remove redundant headers that are already included by "make.h".
Make <assert.h> available to all compilation units that use "make.h".
 1.19  22-Aug-2020  rillig make(1): split Dir_Init into two functions

There's just no point in having a function consisting of a big
if-then-else.
 1.18  31-May-2017  maya Don't prefix include guards by _, suggested by riastradh
 1.17  31-May-2017  maya The previous change might actually be less generic.
prepend by _MAKE, to be sure.
 1.16  31-May-2017  maya Use less generic include guards
 1.15  07-Apr-2012  christos Remove recheck hackery that caused extra stats, and explicitly ask for
recheck when needed. Before it used to be the case that we could only
use the cached entry once. Once the cached entry was used, we removed
it from the cache. Now it is kept forever.
 1.14  23-Jan-2009  dsl branches: 1.14.8;
Change 'ClientData' to 'void *' so that relevant parameters can
be made 'const void *'.
 1.13  15-Feb-2008  christos back all changes out until I fix it properly.
 1.12  14-Feb-2008  christos - use pid_t/size_t as appropriate instead of int.
- use %ld to print pids.
- fix a bit of lint.
- WARNS=4
 1.11  03-Feb-2004  chuck add parent directory search for make as discussed on tech-toolchain.
- new dir.c function: Dir_FindHereOrAbove:
Search for a path in the current directory and then all the directories
above it in turn until the path is found or we reach the root ("/").
- add hooks to use it in main.c for -m and syspath (compiled in
_PATH_DEFSYSPATH and $MAKESYSPATH).
- updated man page
 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  14-Jul-2003  christos Pass WARNS=3
 1.8  26-Nov-2002  sjg Whenever we update .PATH, set the variable ${.PATH} to reflect the
search list that will be used. Thus 'dot' and 'cur' will appear in
${.PATH} either at the start or end depending on .DOTLAST even though
they are not strictly in dirSearchPath.

When .CURDIR is assigned to - re-set the 'cur' Path.

Finally, when checking subdirs, look in 'dot' and 'cur' (first or last
depending on .DOTLAST) just as we do in other situations.
 1.7  15-Jun-2002  wiz Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.
 1.6  12-Nov-2001  tv Redo the hashtable for "." if .OBJDIR changes.
 1.5  08-May-1997  gwr Add the new .NOPATH feature which can be used to disable .PATH search
for particular targets, i.e. .depend, objects, etc. (from Christos).
 1.4  06-Nov-1996  christos - Merge in FreeBSD and Lite2 changes.
- Fix bug where a non-archive target with a .a suffix would always
be considered to be out of date, since it does not have a TOC.
 1.3  14-Jun-1995  christos branches: 1.3.6;
- $NetBSD$ rcsids
- Fixed so that .[A-Z]* targets that do not match keywords are ignored as
Posix mandates
- Added .PHONY target keyword
 1.2  06-Jun-1994  jtc Fixes from Christos Zoulas, who used purify, objectcenter and testcenter
to find memory leaks and illegal memory accesses.
 1.1  05-Mar-1994  cgd branches: 1.1.1;
fixes/improvements from Christos Zoulas <christos@deshaw.com>.
 1.1.1.1  28-Dec-1996  tls Import 4.4BSD-Lite2 sources onto CSRG branch (already merged at head)
 1.3.6.1  26-Jan-1997  rat Update make(1) from trunk, by request from Christos Zoulas. Fixes many bugs.
 1.14.8.1  17-Apr-2012  yamt sync with head
 1.48.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed