Advanced debug flags

Some debug flags are generally only useful for debugging the high level rulebase or tmake internals. These flags are documented here for completeness.

j    Parallel (job-based) builds
$ tmake -dj
    Cc           test-api.o
   12ms [j] Adding job 33383 for test-api.o
    Cc           api.o
   15ms [j] Adding job 33385 for api.o
   15ms [j] libapi.a has 1 outstanding jobs - waiting
   15ms [j] test-api has 2 outstanding jobs - waiting
   16ms [j] all has 1 outstanding jobs - waiting
   16ms [j] Waiting for all to complete...
   49ms [j] Job 33385 building api.o has finished with CHILDSTATUS(0), needed by libapi.a
   50ms [j] Status of libapi.a changed from waiting => unknown
   51ms [j] test-api.o is still running
    Ar           libapi.a
   52ms [j] Adding job 33403 for libapi.a
   53ms [j] test-api has 2 outstanding jobs - waiting
   53ms [j] all has 1 outstanding jobs - waiting
   53ms [j] Waiting for all to complete...
   84ms [j] Job 33383 building test-api.o has finished with CHILDSTATUS(0), needed by test-api
   85ms [j] libapi.a is still running
   85ms [j] test-api has 1 outstanding jobs - waiting
   85ms [j] all has 1 outstanding jobs - waiting
   85ms [j] Waiting for all to complete...
  143ms [j] Job 33403 building libapi.a has finished with CHILDSTATUS(0), needed by test-api
  144ms [j] Status of test-api changed from waiting => unknown
    Link         test-api
  145ms [j] Adding job 33424 for test-api
  146ms [j] all has 1 outstanding jobs - waiting
  146ms [j] Waiting for all to complete...
  257ms [j] Job 33424 building test-api has finished with CHILDSTATUS(0), needed by all
  257ms [j] Status of all changed from waiting => unknown
Built 4 of 5 target(s) in 0.26 seconds
  258ms [j] All jobs have finished

Miscellanous debugging

m    Miscellaneous (locating and parsing of files)
$ tmake -dm
    1ms [m] Project top found at /private/tmp/tmakedocs/debug-flags-advanced/api
    1ms [m] Loading /Users/steveb/.tmakerc
    1ms [m] Setting --build=objdir
    7ms [m] Setting maxjobs=16
    8ms [m] process-build-spec .
   12ms [m] Found 5 target(s)
   12ms [h m] Using md5 module for hashing

Locating sources and targets

l    Locating sources and targets
$ tmake -dl
   10ms [l] build.spec:10: find-project-bin: test-api is a local target
   10ms [l] build.spec:10: find-project-bin returning test-api objdir/test-api

ifconfig expressions

c    Configuration expressions via ifconfig
$ cat build.spec
Lib --publish api api.c
ifconfig TESTING
Executable --test test-api test-api.c
$ tmake -dc
    9ms [c] ifconfig: expr='TESTING' tclexpr='[config-is-defined? TESTING]'
    9ms [c] Expression is false
    Clean        removing 2 orphan target(s)
$ tmake TESTING=1 -dc
    8ms [c] ifconfig: expr='TESTING' tclexpr='[config-is-defined? TESTING]'
    8ms [c] Expression is true, so executing 
    Cc           test-api.o
    Link         test-api
Built 2 of 5 target(s) in 0.11 seconds

Cache and orphan handling

C    Cache handling
$ tmake -dC clean all
    6ms [C] Loaded cache, .makecache in 0ms
    Clean        removing 2 orphan target(s)
   10ms [C] test-api.o test-api
   10ms [C] discarded orphan targets, marking cache dirty
    Clean        .trash
    Clean        .
    Cc           api.o
    Ar           libapi.a
Built 2 of 3 target(s) in 0.07 seconds
   65ms [C] Wrote cache, .makecache in 0ms
$ tmake --showcache
.makecache updated 4 times

File timestamp
-------------------------------------
                              api.o  15:35:55.364 22-Aug-2022
                           libapi.a  15:35:55.405 22-Aug-2022

Commands used to build targets and warnings
-------------------------------------------
api.o:
	run  gcc -Iobjdir/publish/include -I. -Iobjdir   -c api.c -o objdir/api.o

libapi.a:
	file delete objdir/libapi.a
	run ar cr objdir/libapi.a {*}[expand-objects objdir/api.o]
	run ranlib objdir/libapi.a

Source file hashing

h    Hashing
$ cat project.spec
UseHashes on
$ tmake -dh
    8ms [h m] Using md5 module for hashing
    8ms [h] Using hashes for file comparison
    8ms [h] md5sum api.c => md5:984c9cb8c5b2c7143a74547722034cea
    9ms [h] md5sum api.h => md5:f4f5fac7b6f6e39818036d9fbe05f98d
    Cc           api.o
    Ar           libapi.a
Built 2 of 3 target(s) in 0.07 seconds
$ touch api.h
$ tmake -dh
    8ms [h m] Using md5 module for hashing
    8ms [h] Using hashes for file comparison
    9ms [h] md5sum api.h => md5:f4f5fac7b6f6e39818036d9fbe05f98d

Timing

T    Timing (add --delta for delta times)

The -dT debug flag is useful for timing both the build system operations and the build commands. Normally tmake will include a millisecond timestamp on each debug message. With '-dT' a message is printed at significant points to help determine the time spend in each. For example as each .spec files is parsed.

$ tmake --force -dT
    3ms [T] Parsed /Volumes/src/tmake/rulebase.default
    4ms [T] Parsed rulebase
    4ms [T] Initialised rulebase
    4ms [T] Parsed project.spec
    9ms [T] Parsed build.spec
   10ms [T] Parsing phase complete
   10ms [T] All Load targets are up-to-date
   10ms [b T] Building target all
    Cc           api.o
   28ms [T] Built api.o in 15ms
    Ar           libapi.a
   66ms [T] Built libapi.a in 36ms
Built 2 of 3 target(s) in 0.07 seconds
   67ms [T] Time spent hashing sources: 0ms
   68ms [T] Done

With the --delta flag, the millisecond times in the first column represent the time since the previous message.

$ tmake --force -dT --delta
    2ms [T] Parsed /Volumes/src/tmake/rulebase.default
    1ms [T] Parsed rulebase
    0ms [T] Initialised rulebase
    0ms [T] Parsed project.spec
    4ms [T] Parsed build.spec
    0ms [T] Parsing phase complete
    1ms [T] All Load targets are up-to-date
    0ms [b T] Building target all
    Cc           api.o
   15ms [T] Built api.o in 13ms
    Ar           libapi.a
   48ms [T] Built libapi.a in 46ms
Built 2 of 3 target(s) in 0.07 seconds
    1ms [T] Time spent hashing sources: 0ms
    0ms [T] Done

The results of the search are