有没有验证 makefile 的实用程序?
我想验证我手写的 makefile,以确保它们在各种平台上按预期工作。是否有一个实用程序可以用来警告我可能妨碍的特质?
I'd like to validate my hand-written makefiles, to make sure they work as intended on a variety of platforms. Is there a utility I can use to warn me of idiosyncrasies that might get in the way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知还没有。
最好的办法是遵守“早点移植;经常移植”的老规则。尝试尽快在其他平台上构建您的应用程序,并在有机会时重新构建。这将消除代码中的可移植性错误,并验证 Makefile 作为副作用。
也就是说,明智的做法是尽可能限制自己使用保守的 Makefile 功能。您可能想查看 POSIX make 手册页(尽管我会建议您使用
%.foo: %.bar
规则而不是名义上标准的.bar.foo:
规则),以及 可移植 make 编程 部分充满了很好的建议。哦,你知道 autoconf 是一件好事,是吗?
Not as far as I'm aware of.
The best thing to do is respect the old rule "port early; port often". Try building your application on other platforms as soon as possible, and re-do it whenever you have the opportunity. That'll shake out portability bugs in your code, and validate the Makefile as a side-effect.
That said, it's wise to limit yourself to conservative Makefile features as much as possible. You might want to look at the POSIX make manpage (though I'd advise you to use the
%.foo: %.bar
rules rather the nominally standard.bar.foo:
rules), and the portable make programming section of the autoconf manual is full of good advice.Oh, and you know that autoconf is a Good Thing, yes?
对不起,兄弟,但是……不确定是否有任何单一代码可以使用任何地方的代码,这是 Unix 最强和最弱的点之一……操作系统本身有很多不同的风格以及实现Make 实用程序——GNU 只是其中之一,开放的Solaris 形式也是如此(微小的差异),但它们确实共享许多共同的功能,
GNU Make 的某些功能只有在您使用GNU 调用Makefile 描述符时才可用。 make ,对于其他操作系统变体也是如此以及 make 实用程序.. 具有这样的约束
“在您希望它工作的所有可能的系统中进行彻底的测试是我想到的唯一解决方案”
sorry bro but .... not sure if there could be any single code use eveywhere code, this is one of the strongest and the weakest points of Unix .... there are so many different flavours of the OS itself and the implementations of Make Utility -- GNU is just one of them and so is the open solaris form (small differences), but they do share a host of common features
there are features of GNU Make that are available only if you invoke your makefile descriptor with a GNU make , its same for other OS varients of make utility as well .. with constraints like these
"a thorough testing in all the possible systems you want it to work is the only solution that comes to my mind"