TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Checkmake: Experimental Linter/Analyzer for Makefiles

89 pointsby harporoederalmost 3 years ago

8 comments

shepherdjerredalmost 3 years ago
Unfortunately Checkmake only has 4 rules[0]. It&#x27;s not a very useful tool unless you&#x27;re wanting a tool that complains that you don&#x27;t have an &#x27;all&#x27; and &#x27;test&#x27; target, or that your target is longer than 5 lines[1].<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;mrtazz&#x2F;checkmake&#x2F;tree&#x2F;main&#x2F;rules" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mrtazz&#x2F;checkmake&#x2F;tree&#x2F;main&#x2F;rules</a><p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;mrtazz&#x2F;checkmake&#x2F;blob&#x2F;main&#x2F;rules&#x2F;maxbodylength&#x2F;maxbodylength.go#L14" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mrtazz&#x2F;checkmake&#x2F;blob&#x2F;main&#x2F;rules&#x2F;maxbodyl...</a>
评论 #32467614 未加载
dwheeleralmost 3 years ago
Cool!<p>I also have an experimental (GNU) makefile auditor called &quot;make-audit&quot;, available here: <a href="https:&#x2F;&#x2F;github.com&#x2F;david-a-wheeler&#x2F;make-audit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;david-a-wheeler&#x2F;make-audit</a><p>Per its README: &quot;It will report when an execution of make reads or changes files in ways that are inconsistent with its Makefile. It requires an &quot;auditor&quot; tool named pmaudit in your PATH. It also requires GNU make to be installed and run as make.&quot;<p>Note that these tools are looking for different things and taking different approaches. My make-audit tool is a <i>dynamic</i> analysis tool - you run make and it watches what is done. This &quot;checkmake&quot; tool appears to use static analysis to check against various rules (e.g., there should be an &quot;all&quot;), which is fine but it&#x27;s a different kind of check.<p>Sadly, my make-audit tool is also rather experimental. As I say in its README, &quot;This is an <i>extremely</i> early version. Much needs fixing.&quot; For example:<p>* This doesn&#x27;t properly handle grouped targets or empty commands. It should handle makefiles with their own SHELL and .ONESHELL values.<p>* I don&#x27;t think it handles multi-line make commands exactly correctly (it&#x27;s close but not quite right).<p>* Lots more options are needed.<p>* It needs a better internal test suite.<p>Still, make-audit does do some useful things, and it&#x27;d be awesome if others would be willing to work with me to make it reliably useful.
评论 #32465928 未加载
Groxxalmost 3 years ago
Hmm. `--list-rules` doesn&#x27;t seem to work (in the docker version anyway), and I threw it at an absolutely awful Makefile (cyclic dependencies, variable spelling errors making them empty, several other clear problems) both before and after I rewrote the whole thing...<p>... and it&#x27;s only complaining about targets over 5 lines long (really? some of the CLI tools I&#x27;m running take 20+ lines of flags spread out for readability, I&#x27;m not going to shrink that) and one or two missing .PHONY markers (it&#x27;s correct about those). There&#x27;s one fewer missing .PHONY after my rewrite.<p>Given the list in the rules folder, kinda seems like it doesn&#x27;t check enough to be useful. As much as I would truly love a brutal make checker.
mgradowskialmost 3 years ago
Excellent name.
评论 #32462947 未加载
pabs3almost 3 years ago
I note the maintainer has asked for help with the project and called for additional maintainers, so if you use this or want it to improve, please get involved:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mrtazz&#x2F;checkmake&#x2F;issues&#x2F;44" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mrtazz&#x2F;checkmake&#x2F;issues&#x2F;44</a>
zvralmost 3 years ago
Nice idea, but...<p>This checks only 4 rules, not even correct.<p>It&#x27;s also implemented in Go, which is really unsuitable for a program with such a goal.
sixstringtheoryalmost 3 years ago
I wonder how hard it would be to modify shellcheck to work for Makefiles.
评论 #32466143 未加载
babyalmost 3 years ago
Do we still need makefiles :(? What’s the alternative?
评论 #32465258 未加载
评论 #32463940 未加载
评论 #32463829 未加载
评论 #32463335 未加载
评论 #32464831 未加载