diff options
author | Ron Yorston <rmy@pobox.com> | 2022-11-03 15:49:11 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-11-03 15:52:48 +0000 |
commit | 5f64589b84a7349316a04cdbe607a5824459b731 (patch) | |
tree | dae9145ccae5e67012ab172789f9bcb099db40dd /testsuite | |
parent | 0aceca8673c1d9a8bc34faa460389768efa08eb7 (diff) | |
download | busybox-w32-5f64589b84a7349316a04cdbe607a5824459b731.tar.gz busybox-w32-5f64589b84a7349316a04cdbe607a5824459b731.tar.bz2 busybox-w32-5f64589b84a7349316a04cdbe607a5824459b731.zip |
make: fixes to inference rules
Austin Group defect report 875 clarifies some aspects of inference
rules. The crux of the issue is related to chained inference rules
so it doesn't affect POSIX mode. The test makefile looks like this:
.SUFFIXES: .a .b .c
.a.c:
@echo .a.c
.b.c:
@echo .b.c
test.c: test.b
test.a:
test.b:
The correct output is deemed to be '.a.c'. Additional complications
are:
- whether or not the prerequisite files are present;
- the use of the suffixes '.a' and '.c' may result in the builtin
inference rule '.c.a' being considered.
In favourable circumstances pdpmake managed to give the correct
result, in unfavourable it reported circular dependencies or
segfaulted.
Changes to fix these issues are:
- When prerequisites are being recursively built the standard says:
'Upon recursion, each prerequisite shall become a target itself.'
Follow this requirement.
- At the end of make() the target being built should have its time
(as represented by n_tim in struct name) updated when any action
has been taken.
- When dyndep() is looking for prerequisites it should:
* skip candidates that are in the process of being built;
* consider whether an explicit candidate is a target, not whether
it has any commands associated with it.
pdpmake now behaves similarly to GNU make when presented with
makefiles like the above. bmake gives the incorrect output '.b.c'.
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/make.tests | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests index f52770438..7bb736ade 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -397,6 +397,45 @@ target: | |||
397 | : hash # hash | 397 | : hash # hash |
398 | ' | 398 | ' |
399 | 399 | ||
400 | # Austin Group defect report 875 clarifies certain aspects of the | ||
401 | # behaviour of inference rules. Study of this resulted in a number | ||
402 | # of changes to pdpmake. Since the issue at hand involves the use | ||
403 | # of chained inference rules it doesn't affect POSIX mode. | ||
404 | mkdir make.tempdir && cd make.tempdir || exit 1 | ||
405 | touch test.j test.k | ||
406 | testing "make proper handling of inference rules 1" \ | ||
407 | "make -f -" \ | ||
408 | ".j.l\n" "" ' | ||
409 | .SUFFIXES: .j .k .l | ||
410 | .j.l: | ||
411 | @echo .j.l | ||
412 | .k.l: | ||
413 | @echo .k.l | ||
414 | test.l: test.k | ||
415 | test.j: | ||
416 | test.k: | ||
417 | ' | ||
418 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | ||
419 | |||
420 | # The actual test in the above-mentioned defect report was actually | ||
421 | # more demanding. It used the suffixes '.a .b .c'. This results in | ||
422 | # the built-in '.c.a' inference rule being introduced into the mix. | ||
423 | mkdir make.tempdir && cd make.tempdir || exit 1 | ||
424 | touch test.a test.b | ||
425 | testing "make proper handling of inference rules 2" \ | ||
426 | "make -f -" \ | ||
427 | ".a.c\n" "" ' | ||
428 | .SUFFIXES: .a .b .c | ||
429 | .a.c: | ||
430 | @echo .a.c | ||
431 | .b.c: | ||
432 | @echo .b.c | ||
433 | test.c: test.b | ||
434 | test.a: | ||
435 | test.b: | ||
436 | ' | ||
437 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | ||
438 | |||
400 | # Skip duplicate entries in $? and $^ | 439 | # Skip duplicate entries in $? and $^ |
401 | mkdir make.tempdir && cd make.tempdir || exit 1 | 440 | mkdir make.tempdir && cd make.tempdir || exit 1 |
402 | touch -t 202206171200 file1 file3 | 441 | touch -t 202206171200 file1 file3 |