Module Name: src Committed By: rillig Date: Sat Oct 3 17:30:54 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: hanoi-include.exp hanoi-include.mk Log Message: make(1): add test demonstrating the Towers of Hanoi puzzle It's not the primary task of make to handle procedure calls with parameters, combined with lexical scoping, therefore the code does not look as straight-forward or clean as in other programming languages. It feels more like squeezing a programming problem from the imperative world into the world of declarative dependencies. A more idiomatic way of implementing this puzzle should be as a dependency graph since that's both the natural structure of the puzzle and the primary domain of make. Something like having a main target "hanoi-5" that depends on intermediate targets of the form "move-1.2.3.4.5-_._._._._-_._._._._", each representing a single configuration of the stacks. These targets could be generated dynamically. A benefit of this implementation would be that the puzzle could be resumed from an arbitrary configuration, just just from the initial configuration. To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/hanoi-include.exp \ src/usr.bin/make/unit-tests/hanoi-include.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.