TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Good Makefiles (2018)

39 点作者 njn超过 6 年前

8 条评论

hoytech超过 6 年前
You shouldn&#x27;t hard-code gcc. make has an implicit CC variable for this: <a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;make&#x2F;manual&#x2F;html_node&#x2F;Implicit-Variables.html" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;make&#x2F;manual&#x2F;html_node&#x2F;Implicit-...</a><p>Your makefile will then work on systems without gcc, and it is also easier to override it, ie:<p><pre><code> make CC=clang</code></pre>
评论 #19072895 未加载
评论 #19059087 未加载
pletnes超过 6 年前
Make is a great tool. I mostly use it to remember repetitive tasks, like running python tests, not as a build system. Works even better for this. What annoys me deeply is that gnu make isn’t available on windows, e.g git bash.
评论 #19059134 未加载
Trufa超过 6 年前
I really don&#x27;t know the first thing about C or makefiles o anything related, but I was browsing the code out of general curiosity and I have a question.<p>Would this code benefit from better variable names or is it just that I don&#x27;t know the domain and this is good understandable code? I&#x27;m honestly curious.<p>This happens a lot with C code examples here.
评论 #19059965 未加载
评论 #19059126 未加载
评论 #19059135 未加载
dang超过 6 年前
There&#x27;s a larger discussion on this topic at <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19052830" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19052830</a>.
oso2k超过 6 年前
For lots of things, and especially if you stick to the Unix Philosophy or Suckless Philosophy, this Makefile is all you need. I personally add ‘install’, ‘uninstall’, ‘clean’, and ‘superclean’ targets to my projects but this is a really great start.
jdc超过 6 年前
I understand there&#x27;s lots of build systems out there with better scripting languages, but is there anything else that can challenge make for simplicity and portability (although I guess you could export Makefiles)?
评论 #19059064 未加载
Kenji超过 6 年前
Unfortunately, the reality is never as simple as that. Your makefile will grow like a tumour once your project grows: Specific dependencies, OS and compiler related flags and switches, special folder structures, etc etc.
damota超过 6 年前
It&#x27;s a terrible Makefile