head 1.17; access; symbols netbsd-11-0-RC4:1.15 netbsd-11-0-RC3:1.15 netbsd-11-0-RC2:1.15 netbsd-11-0-RC1:1.15 perseant-exfatfs-base-20250801:1.15 netbsd-11:1.15.0.2 netbsd-11-base:1.15 netbsd-10-1-RELEASE:1.8 perseant-exfatfs-base-20240630:1.12 perseant-exfatfs:1.12.0.2 perseant-exfatfs-base:1.12 netbsd-10-0-RELEASE:1.8 netbsd-10-0-RC6:1.8 netbsd-10-0-RC5:1.8 netbsd-10-0-RC4:1.8 netbsd-10-0-RC3:1.8 netbsd-10-0-RC2:1.8 netbsd-10-0-RC1:1.8 netbsd-10:1.8.0.2 netbsd-10-base:1.8 cjep_sun2x-base1:1.6 cjep_sun2x:1.6.0.4 cjep_sun2x-base:1.6 cjep_staticlib_x-base1:1.6 cjep_staticlib_x:1.6.0.2 cjep_staticlib_x-base:1.6; locks; strict; comment @# @; 1.17 date 2026.03.13.04.22.03; author sjg; state Exp; branches; next 1.16; commitid klvChJ27MpmDHLxG; 1.16 date 2026.03.03.20.03.00; author rillig; state Exp; branches; next 1.15; commitid eb161CwdC912ezwG; 1.15 date 2025.05.07.19.49.00; author rillig; state Exp; branches; next 1.14; commitid BkOyy3VNNjF9N0UF; 1.14 date 2024.10.31.09.12.13; author rillig; state Exp; branches; next 1.13; commitid aM2UKIai5pq5gNvF; 1.13 date 2024.07.04.20.18.40; author rillig; state Exp; branches; next 1.12; commitid 75IS4XOhTa8VOygF; 1.12 date 2024.05.25.22.08.35; author rillig; state Exp; branches 1.12.2.1; next 1.11; commitid LOtUdBMhNPcLIqbF; 1.11 date 2024.05.07.18.26.22; author sjg; state Exp; branches; next 1.10; commitid LDYVIE53A0Eu469F; 1.10 date 2023.09.09.16.41.04; author sjg; state Exp; branches; next 1.9; commitid ppldu6kxLGTEe7EE; 1.9 date 2023.01.24.00.24.02; author sjg; state Exp; branches; next 1.8; commitid K9mmKTtcY1MQ9JaE; 1.8 date 2022.03.26.14.34.07; author rillig; state Exp; branches; next 1.7; commitid bA2GMsf46REOCJxD; 1.7 date 2021.12.28.15.49.00; author rillig; state Exp; branches; next 1.6; commitid WwIakaoa8jRuNqmD; 1.6 date 2021.04.04.10.13.09; author rillig; state Exp; branches; next 1.5; commitid LFRaK8edkdJ2DXNC; 1.5 date 2021.02.02.17.56.31; author rillig; state Exp; branches; next 1.4; commitid 3Fj2ADDTi69g8aGC; 1.4 date 2020.12.07.00.53.30; author rillig; state Exp; branches; next 1.3; commitid gdHtmNFghgo1SJyC; 1.3 date 2020.12.04.14.28.50; author rillig; state Exp; branches; next 1.2; commitid hWGssFm1GcCvUqyC; 1.2 date 2020.11.25.00.50.44; author sjg; state Exp; branches; next 1.1; commitid yLOxzqAb6hspHcxC; 1.1 date 2020.11.22.20.36.17; author rillig; state Exp; branches; next ; commitid Ru2GViyMtJNVlVwC; 1.12.2.1 date 2025.08.02.05.58.37; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.17 log @make: ensure .MAKE.SAVE_DOLLARS is set. This makes it possible for macros to be set so as to work correctly whether .MAKE.SAVE_DOLLARS is "yes" (NetBSD) or "no" (bmake). @ text @Parsing suff-main-several.mk:8: .1.2 .1.3 .1.4: ParseDependency(.1.2 .1.3 .1.4:) Setting main node to ".1.2" Parsing suff-main-several.mk:9: : Making ${.TARGET} from ${.IMPSRC}. Parsing suff-main-several.mk:14: next-main: ParseDependency(next-main:) Parsing suff-main-several.mk:15: : Making ${.TARGET} Parsing suff-main-several.mk:19: .SUFFIXES: .1 .2 .3 .4 ParseDependency(.SUFFIXES: .1 .2 .3 .4) Adding suffix ".1" Adding suffix ".2" Setting main node from ".1.2" back to null defining transformation from `.1' to `.2' inserting ".1" (1) at end of list inserting ".2" (2) at end of list Setting main node to ".1.3" Adding suffix ".3" Setting main node from ".1.3" back to null defining transformation from `.1' to `.3' inserting ".1" (1) at end of list inserting ".3" (3) at end of list Setting main node to ".1.4" Adding suffix ".4" Setting main node from ".1.4" back to null defining transformation from `.1' to `.4' inserting ".1" (1) at end of list inserting ".4" (4) at end of list Setting main node to "next-main" Parsing suff-main-several.mk:24: .SUFFIXES: ParseDependency(.SUFFIXES:) Clearing all suffixes Parsing suff-main-several.mk:32: .SUFFIXES: .4 .3 .2 .1 ParseDependency(.SUFFIXES: .4 .3 .2 .1) Adding suffix ".4" Adding suffix ".3" Adding suffix ".2" Adding suffix ".1" Parsing suff-main-several.mk:33: .SUFFIXES: ParseDependency(.SUFFIXES:) Clearing all suffixes Parsing suff-main-several.mk:34: .SUFFIXES: .1 .2 .3 .4 ParseDependency(.SUFFIXES: .1 .2 .3 .4) Adding suffix ".1" Adding suffix ".2" Adding suffix ".3" Adding suffix ".4" Parsing suff-main-several.mk:35: .SUFFIXES: ParseDependency(.SUFFIXES:) Clearing all suffixes Parsing suff-main-several.mk:36: .SUFFIXES: .4 .3 .2 .1 ParseDependency(.SUFFIXES: .4 .3 .2 .1) Adding suffix ".4" Adding suffix ".3" Adding suffix ".2" Adding suffix ".1" Parsing suff-main-several.mk:38: suff-main-several.1: ParseDependency(suff-main-several.1:) Parsing suff-main-several.mk:39: : Making ${.TARGET} out of nothing. Parsing suff-main-several.mk:40: next-main: suff-main-several.{2,3,4} ParseDependency(next-main: suff-main-several.{2,3,4}) Target "next-main" depends on "suff-main-several.{2,3,4}" # next-main, unmade, type OP_DEPENDS|OP_HAS_COMMANDS, flags none # suff-main-several.{2,3,4}, unmade, type none, flags none Parsing suff-main-several.mk:42: .MAKEFLAGS: -d0 -dg1 ParseDependency(.MAKEFLAGS: -d0 -dg1) #*** Begin input graph for pass 1 in : # .1.2, unmade, type OP_TRANSFORM, flags none # .1.3, unmade, type OP_TRANSFORM, flags none # .1.4, unmade, type OP_TRANSFORM, flags none # next-main, unmade, type OP_DEPENDS|OP_HAS_COMMANDS, flags none # suff-main-several.1, unmade, type OP_DEPENDS|OP_HAS_COMMANDS, flags none # suff-main-several.{2,3,4}, unmade, type none, flags none # # Files that are only sources: # .1.2 [.1.2] # .1.3 [.1.3] # .1.4 [.1.4] # suff-main-several.{2,3,4} [suff-main-several.{2,3,4}] #*** Global Variables: .ALLTARGETS = .1.2 .1.3 .1.4 next-main suff-main-several.1 suff-main-several.{2,3,4} .CURDIR = .INCLUDES = # (empty) .LIBS = # (empty) .MAKE =
.MAKE.DEPENDFILE =
.MAKE.GID =
.MAKE.JOBS.C =
.MAKE.LEVEL =
.MAKE.LEVEL.ENV = MAKELEVEL .MAKE.MAKEFILES =
.MAKE.MAKEFILE_PREFERENCE =
.MAKE.OS =
.MAKE.PID =
.MAKE.PPID =
.MAKE.SAVE_DOLLARS =
.MAKE.UID =
.MAKEFLAGS = -r -k -d mps -d 0 -d g1 .MAKEOVERRIDES = # (empty) .OBJDIR = .PATH = . .TARGETS = # (empty) .newline = # (ends with space) MACHINE =
MACHINE_ARCH =
MAKE =
MFLAGS = -r -k -d mps -d 0 -d g1 #*** Command-line Variables: #*** Directory Cache: # Stats: 0 hits 2 misses 0 near misses 0 losers (0%) # refs hits directory # 1 0 # 1 0 . # 2 0 #*** Suffixes: # ".4" (num 1, ref 1) # To: # From: # Search Path: # ".3" (num 2, ref 1) # To: # From: # Search Path: # ".2" (num 3, ref 1) # To: # From: # Search Path: # ".1" (num 4, ref 1) # To: # From: # Search Path: #*** Transformations: #*** End input graph for pass 1 in : make: don't know how to make suff-main-several.2 (continuing) make: don't know how to make suff-main-several.3 (continuing) make: don't know how to make suff-main-several.4 (continuing) `next-main' not remade because of errors. Stop. make: stopped making "next-main" in unit-tests exit status 1 @ 1.16 log @tests/make: remove filemon path from expected debug output That variable is not essential for the test, and it differs between the standard configuration and the c90-stdbool configuration from test-variants.mk. @ text @d97 1 @ 1.15 log @make: add end marker for -dg1, -dg2 and -dg3 debug log The marker helps distinguish the output from sub-makes from the output of the primary make. @ text @a94 1 .MAKE.PATH_FILEMON =
@ 1.14 log @make: in the debug log, always qualify line number with filename Previously, to find out the filename corresponding to a line number from a 'Parsing' line, it was necessary to find the preceding 'SetFilenameVars' line, which was unnecessarily time-consuming and distracting. The 'filename:line' format matches the one used in PrintStackTrace, and it differs from the one used in PrintLocation, as the former format is more common in other tools. Most of the affected unit tests only use the 'Parsing' lines to give additional context to their debug log, so no structural changes there. @ text @d66 1 a66 1 #*** Input graph: d137 1 @ 1.13 log @make: on error, print the targets to be made This helps to understand situations with several nested sub-makes in varying directories. @ text @d1 1 a1 1 Parsing line 8: .1.2 .1.3 .1.4: d4 2 a5 2 Parsing line 9: : Making ${.TARGET} from ${.IMPSRC}. Parsing line 14: next-main: d7 2 a8 2 Parsing line 15: : Making ${.TARGET} Parsing line 19: .SUFFIXES: .1 .2 .3 .4 d29 1 a29 1 Parsing line 24: .SUFFIXES: d32 1 a32 1 Parsing line 32: .SUFFIXES: .4 .3 .2 .1 d38 1 a38 1 Parsing line 33: .SUFFIXES: d41 1 a41 1 Parsing line 34: .SUFFIXES: .1 .2 .3 .4 d47 1 a47 1 Parsing line 35: .SUFFIXES: d50 1 a50 1 Parsing line 36: .SUFFIXES: .4 .3 .2 .1 d56 1 a56 1 Parsing line 38: suff-main-several.1: d58 2 a59 2 Parsing line 39: : Making ${.TARGET} out of nothing. Parsing line 40: next-main: suff-main-several.{2,3,4} d64 1 a64 1 Parsing line 42: .MAKEFLAGS: -d0 -dg1 @ 1.12 log @make: use fewer technical terms in debug message for dependency @ text @d143 1 a143 1 make: stopped in unit-tests @ 1.12.2.1 log @Sync with HEAD @ text @d1 1 a1 1 Parsing suff-main-several.mk:8: .1.2 .1.3 .1.4: d4 2 a5 2 Parsing suff-main-several.mk:9: : Making ${.TARGET} from ${.IMPSRC}. Parsing suff-main-several.mk:14: next-main: d7 2 a8 2 Parsing suff-main-several.mk:15: : Making ${.TARGET} Parsing suff-main-several.mk:19: .SUFFIXES: .1 .2 .3 .4 d29 1 a29 1 Parsing suff-main-several.mk:24: .SUFFIXES: d32 1 a32 1 Parsing suff-main-several.mk:32: .SUFFIXES: .4 .3 .2 .1 d38 1 a38 1 Parsing suff-main-several.mk:33: .SUFFIXES: d41 1 a41 1 Parsing suff-main-several.mk:34: .SUFFIXES: .1 .2 .3 .4 d47 1 a47 1 Parsing suff-main-several.mk:35: .SUFFIXES: d50 1 a50 1 Parsing suff-main-several.mk:36: .SUFFIXES: .4 .3 .2 .1 d56 1 a56 1 Parsing suff-main-several.mk:38: suff-main-several.1: d58 2 a59 2 Parsing suff-main-several.mk:39: : Making ${.TARGET} out of nothing. Parsing suff-main-several.mk:40: next-main: suff-main-several.{2,3,4} d64 1 a64 1 Parsing suff-main-several.mk:42: .MAKEFLAGS: -d0 -dg1 d66 1 a66 1 #*** Begin input graph for pass 1 in : a136 1 #*** End input graph for pass 1 in : d143 1 a143 1 make: stopped making "next-main" in unit-tests @ 1.11 log @make: all command line overrides go in .MAKEOVERRIDES Not all variables that start with '.' are internals, and unless they are explicitly flagged as internal should go into .MAKEOVERRIDES Update varname-dot-makeoverrides to check this. Also avoid using SCOPE_CMDLINE when ReadOnly will do. @ text @d61 1 a61 1 # LinkSource: added child next-main - suff-main-several.{2,3,4} @ 1.10 log @Add .MAKE.JOBS.C to indicate wether -jC is supported @ text @d91 1 a110 1 .MAKE.LEVEL.ENV = MAKELEVEL @ 1.9 log @make: .SYSPATH: to add dirs to sysIncPath .SYSPATH: with no sources will clear sysIncPath otherwise sources are added Reviewed by: rillig @ text @d89 1 @ 1.8 log @make: avoid trailing whitespace in debug log for variables Since trailing whitespace is invisible, describe the variable value in words to make it visible. @ text @d116 1 a116 1 # 1 0 @ 1.7 log @make: make debug logging a bit more human-friendly The previous log format "ParseReadLine (%d): '%s'" focused on the implementation, it was not immediately obvious to a casual reader that the number in parentheses was the line number. Additionally, having both a colon and quotes in a log message is uncommon. The quotes have been added in parse.c 1.127 from 2007-01-01. The new log format "Parsing line %d: %s" is meant to be easier readable by humans. The quotes are not needed since ParseReadLine always strips trailing whitespace, leaving no room for ambiguities. The other log messages follow common punctuation rules, which makes the beginning of the line equally unambiguous. Before var.c 1.911 from 2021-04-05, variable assignments were logged with the format "%s:%s = %s", without a space after the colon. @ text @d84 2 a85 2 .INCLUDES = .LIBS = d98 1 a98 1 .MAKEOVERRIDES = d101 1 a101 1 .TARGETS = d103 1 a103 1 @ 1.6 log @make: remove filler word 'Do' from function names for parsing No functional change, except for debug logging. @ text @d1 1 a1 1 ParseReadLine (8): '.1.2 .1.3 .1.4:' d4 2 a5 2 ParseReadLine (9): ' : Making ${.TARGET} from ${.IMPSRC}.' ParseReadLine (14): 'next-main:' d7 2 a8 2 ParseReadLine (15): ' : Making ${.TARGET}' ParseReadLine (19): '.SUFFIXES: .1 .2 .3 .4' d29 1 a29 1 ParseReadLine (24): '.SUFFIXES:' d32 1 a32 1 ParseReadLine (32): '.SUFFIXES: .4 .3 .2 .1' d38 1 a38 1 ParseReadLine (33): '.SUFFIXES:' d41 1 a41 1 ParseReadLine (34): '.SUFFIXES: .1 .2 .3 .4' d47 1 a47 1 ParseReadLine (35): '.SUFFIXES:' d50 1 a50 1 ParseReadLine (36): '.SUFFIXES: .4 .3 .2 .1' d56 1 a56 1 ParseReadLine (38): 'suff-main-several.1:' d58 2 a59 2 ParseReadLine (39): ' : Making ${.TARGET} out of nothing.' ParseReadLine (40): 'next-main: suff-main-several.{2,3,4}' d64 1 a64 1 ParseReadLine (42): '.MAKEFLAGS: -d0 -dg1' @ 1.5 log @make: remove overengineered Enum_ValueToString For printing the status of a GNode, there was already made_name (now renamed to GNodeMade_Name), which prints user-friendly text instead of the bare enum constant names. To do this change confidently, I first had to demonstrate that the output really affects something other than just the word "UNMADE". There had not been a test for that case before, and the test immediately discovered a bug in the -dg2 and -dg3 options. This bug is one of the oldest in make, dating back to at least 1993. @ text @d2 1 a2 1 ParseDoDependency(.1.2 .1.3 .1.4:) d6 1 a6 1 ParseDoDependency(next-main:) d9 1 a9 1 ParseDoDependency(.SUFFIXES: .1 .2 .3 .4) d30 1 a30 1 ParseDoDependency(.SUFFIXES:) d33 1 a33 1 ParseDoDependency(.SUFFIXES: .4 .3 .2 .1) d39 1 a39 1 ParseDoDependency(.SUFFIXES:) d42 1 a42 1 ParseDoDependency(.SUFFIXES: .1 .2 .3 .4) d48 1 a48 1 ParseDoDependency(.SUFFIXES:) d51 1 a51 1 ParseDoDependency(.SUFFIXES: .4 .3 .2 .1) d57 1 a57 1 ParseDoDependency(suff-main-several.1:) d60 1 a60 1 ParseDoDependency(next-main: suff-main-several.{2,3,4}) d65 1 a65 1 ParseDoDependency(.MAKEFLAGS: -d0 -dg1) @ 1.4 log @make(1): fix exit status in -k mode if a dependency fails Whether in -k mode or not, the exit status tells whether all requested targets were made or not. If a dependency could not be made, the main target was not made as well, therefore the exit status must be nonzero in such a case. This part of the code lacked proper unit tests until today. The unit test deptgt-end-fail.mk is compatible with make>=2003 at least, allowing to compare the output over time. In 2003, in the ok-ok-ok-ok case, "Making all from all-dep." was printed twice in a row, for whatever reason ... (40 minutes later) ... If I had just made the two commands for 'all' and '.END' more distinguishable. Back in 2003, the local variables for .END had not been initialized, instead the .END node was run with the local variables of the last preceding node. In this case, that node was 'all', therefore ${.TARGET} had obviously expanded to 'all'. Somewhere in 2004, the shell commands were no longer run with the -e flag, which resulted in the "exit status $?" line to be printed in cases that had stopped early before. Somewhere in 2005, the local variables for the .END node had been fixed. The variable ${.TARGET} now had the value '.END', just as expected. In addition, the dependencies for the .END node were made, although without getting their proper local variables. This resulted in the output "Making out of nothing" instead of the expected "Making end-dep out of nothing". Still in 2005, in the test case "all=ok all-dep=ok end=ok end-dep=ERR", the error code of the failed 'end-dep' was first reported as "*** Error code 1 (continuing)". To compensate for this improvement, a new bug had been introduced. The test case "all=ok all-dep=ok end=ERR end-dep=ERR" had properly exited with status 1 on 2005-01-01, but on 2006-01-01 it exited with status 0, thereby ignoring errors in the .END node. Somewhere in 2008, some of the error messages (but not all) were directed to stderr instead of stdout. The actual output stayed the same though. Somewhere in 2011, the dependency of the .END node got its own local variables, and ${.TARGET} now expanded to 'end-dep', as expected. Somewhere in 2016, the two empty lines between the "*** Error code 1 (continuing)" and the "Stop." got compressed into a single empty line. On 2020-12-07 (that is, today), the exit status 1 has been restored in the error cases, after it had been wrong for at least 14 years. @ text @d62 2 a63 2 # next-main, made UNMADE, type OP_DEPENDS|OP_HAS_COMMANDS, flags none # suff-main-several.{2,3,4}, made UNMADE, type none, flags none d67 6 a72 6 # .1.2, made UNMADE, type OP_TRANSFORM, flags none # .1.3, made UNMADE, type OP_TRANSFORM, flags none # .1.4, made UNMADE, type OP_TRANSFORM, flags none # next-main, made UNMADE, type OP_DEPENDS|OP_HAS_COMMANDS, flags none # suff-main-several.1, made UNMADE, type OP_DEPENDS|OP_HAS_COMMANDS, flags none # suff-main-several.{2,3,4}, made UNMADE, type none, flags none @ 1.3 log @make(1): use fixed format for debug output of the directory cache The previous output format had a %-20s conversion specifier. This produced different output depending on the length of the pathname, which was too difficult to normalize. By moving the directory name to the end, it is no longer necessary to fill up any space, and the numbers are always aligned properly. As a result, 3 of the unit tests no longer need any special postprocessing of their output. @ text @d140 4 a143 1 exit status 0 @ 1.2 log @Add .MAKE.UID and .MAKE.GID @ text @d111 7 @ 1.1 log @make(1): add another unit test for suffix handling @ text @d88 1 d96 1 @