3 ms·
Cool! I also have an experimental (GNU) makefile auditor called "make-audit", available here: https://github.com/david-a-wheeler/make-audit https://github.com/
by dwheeler 4y ago
Cool!
I also have an experimental (GNU) makefile auditor called "make-audit", available here: https://github.com/david-a-wheeler/make-audit https://github.com/david-a-wheeler/make-audit
Per its README: "It will report when an execution of make reads or changes files in ways that are inconsistent with its Makefile. It requires an "auditor" tool named pmaudit in your PATH. It also requires GNU make to be installed and run as make."
Note that these tools are looking for different things and taking different approaches. My make-audit tool is a dynamic analysis tool - you run make and it watches what is done. This "checkmake" tool appears to use static analysis to check against various rules (e.g., there should be an "all"), which is fine but it's a different kind of check.
Sadly, my make-audit tool is also rather experimental. As I say in its README, "This is an extremely early version. Much needs fixing." For example:
* This doesn't properly handle grouped targets or empty commands. It should handle makefiles with their own SHELL and .ONESHELL values.
* I don't think it handles multi-line make commands exactly correctly (it's close but not quite right).
* Lots more options are needed.
* It needs a better internal test suite.
Still, make-audit does do some useful things, and it'd be awesome if others would be willing to work with me to make it reliably useful.
- dwheeler 4y agoQuick self-reply: My make-audit tool only reports a few errors, but they are very general and apply to all rules. This is probably the best way to compare the tools. Here are the make-audit reports: * Error: Target TARGET : unreported prerequisites: SET : The make recipe for creating TARGET is reading from the prerequisites in SET, but the makefile fails to report them as dependencies. You may want to add SET to the prerequisites of TARGET. * Error: Target TARGET : claimed but unused prerequisites: SET : The make recipe for creating TARGET claims that it depends on SET, but the items in SET were never read. You may want to remove SET from the prerequisites of TARGET. * Error: Target TARGET : unreported target: SET The make recipe for updating TARGET also modifies the files in SET but this is not reported. The easy solution is to use GNU make's grouped targets feature that it added in version 4.3, e.g., TARGET SET &: PREREQUISITES. There are alternative solutions. * Error: Target TARGET : unmodified reported target: SET The make recipe for updating TARGET does not appear to actually write to TARGET. You may need to add a missing command to actually modify TARGET.