Use .MAKE.LEVEL to track recursion.
The first instance of make will have .MAKE.LEVEL 0, which
can be handy for excluding rules which should not apply
in a sub-make.
gmake and freebsd's make have a similar mechanism, but each
uses a different variable to track it. Since we cannot be
compatible with both, we allow the makefiles to cope if they want
by handling the export of .MAKE.LEVEL+1 in Var_Set().
executable. Remove this so that different compiles can be binary
compared. rcsid's for all files are already embedded in the executable
so versions can be easily distinguished. (I didn't catch this on
previous passes because I did my builds on the same day.)
Note: there's a special rule for main.o in Makefile with a purpose I
can't actually discern -- I think it isn't needed, and I've flagged it
with a comment.
Saves having to malloc/free a fixed size structure.
Buf_Init() now takes ptr to Buffer to initialiase.
Change Buf_Destroy() to return ptr to string when not freed.
Remove large number of casts to (Byte) and (Byte *) - 'Byte' is 'char' here.
Buf_AddByte[s] guarantees that the data is 0 termininated, so never add '\0'.
Keep 'count' not 'left' and 'inPtr', code is simplier with only one update.
Fix fallou, no functional change.
is enabled but debugging output is not directed to stdout, then make
stdout line buffered.
Previously, the code to make debug output unbuffered applied only if
debugging to a file, not if debugging to stdout or stderr. Making
stdout line buffered when debugging was suggested by Steven Bellovin.
bmake_malloc and friends. Implement them via macros for the native case
and provide fallback implementations otherwise. Avoid polluting the
namespace by not defining enomem globally. Don't bother to provide
strdup and strndup, they were only used for the estrdup and estrndup
comapt code.
This addresses the presence of emalloc in system libraries on A/UX and
resulted strange issues as reported by Timothy E. Larson.
Commons up the code for reading files and buffers, and allows a further
change where we don't copy the data out of the buffer when generating 'lines.
This will speed up makefile parsing (esp .if clauses).
- Only test 'printVars' once.
Has side effect of not trying to find the 'main' target for '-V varname'.
- Only reap the single child process in Cmd_Exec(),
I think this is for 'xx != cmd' so probobably no other children should exist.
- Don't read and parse .depend if '-r' and '-V varname' are set.
I suspect that .depend shouldn't affect the output of any -V command...
This gives a considerable speedup in the processing of .WAIT and .ORDER.
Both .WAIT and .ORDER stop both the commands of the node, and its dependant
nodes being built until the LH nodes are complete.
.WAIT only applies to the dependency line on which it appears, whereas
.ORDER applies globally between the two nodes.
In both cases dependant nodes can be built because other targets need them.
make now processes the target list left to right, scheduling child nodes
as they are needed to make other nodes (instead of attempting to generate
a bottom-up dependency graph at the start). This means that 'make -j1'
will tend to build in the same order as a non-parallel make.
Note that:
all: x y
x: a .WAIT b
y: b .WAIT a
does not generate a dependency loop.
But
x: y
.ORDER y x
does (unless something elswhere causes 'y' to be built).
replace the %d with getpid().
Allows the trace files for different make process is a big recursive make
to be written to different files - and have a slight chance of being useful.
(Almost all the debug output went there, but some went to stderr.)
Split the parsing of -d (debug flags) out into its own routine.
Allow the output filename to be changed by specifying -dF<file> to create
a log file, or -dF+<file> to append to it. <file> may be stdout or stderr.
Also change so that -d-<flags> acts on <flags> locally but doesn't copy
them to MAKEFLAGS so they aren't inherited by child makes.
I'm not 100% happy with the command line syntax for the above, so they are
currently undocumented.
entries, so allocate at startup.
Use an 'int jobPipe[2]' within the job structure, and create pipes directly
into it. Common up the code that creates all the pipes - making them all
non-block on the read side in the process.
Call Job_CatchChildren() directly from Job_CatchOutput() so that it only
gets called when a child actually exits.
NB: Something causes a 'pregnant pause' if (for example) you call 'nbmake obj'
in src/tools. Introduced between netbsd 3 and 4.