建立一个makefile依存/继承树 [英] Build a makefile dependency / inheritance tree

查看:146
本文介绍了建立一个makefile依存/继承树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

道歉,如果我不好解释这个还是要问的东西出血明显,但我是新来的Linux内核和还挺在深结束...

Apologies if I explain this badly or am asking something bleeding obvious but I'm new to the Linux kernel and kinda in at the deep end...

我们有一个嵌入式的Linux系统,它包含上百种的的东西的,含子编译规则最文件夹,请,make.config或一些变化文件夹的(非常糟糕记录)SDK到达...的含有主的makefile和放大器的根文件夹;编译规则这意味着你可以从根文件夹,输入make sysall,并建立整个包。

We have an embedded-linux system which arrives with a (very badly documented) SDK containing hundreds of folders of stuff, most folders containing a rules.make, make, make.config or some variation of... and the root folder containing a "master" makefile & rules.make which mean that you can, from the root folder, type "make sysall" and it builds the entire package.

到目前为止好,而是试图调试它是一个有点问题,如文档会这样说的:

So far so good, but trying to debug it is a bit of an issue as the documentation will say something like:

为了让内核输出调试消息,只定义#outputdebugmessagesplz

确定,但一些这些东西在大师让/规则文件中定义的,其中的一些在孩子的定义做出/规则/配置文件,有些是在.h文件...,当然这是远更好,从顶make.config把这些东西开/关,而不是修改个人.h文件,然后不必记住再次将其关闭。

OK, but some of these things are defined in the "master" make/rules file, some of these are defined in the child make/rules/config files, some are in .h files... and of course it's far nicer to turn these things on/off from the "top" make.config rather than modifying individual .h files and then having to remember to turn them off again.

所以,我认为这将是一个有用的东西递归构建树,从主开始制造它确实文件,并按照一切,这被定义或重新定义,等一切......但不似乎是这样做的一个简单的方法?

So I thought it would be a useful thing to recursively build a tree, starting from the master "make" file and following everything it does, everything that gets defined or re-defined, etc... but there doesn't seem to be a simple way of doing that?

我认为我缺少一个做,这里的选项,吐出这个信息出来,或者makefile文件/配置的使用,这将只是工作?

I assume I am missing a "make" option here that spits this info out, or a usage of the makefile/config that will just work?

推荐答案

您的情况并不少见。在嵌入式系统的开发,您可能会遇到以特定的方式解决问题许多自定义系统。随着人们对你的问题做了评论,有没有简单的方法来生成你的Makefile结构/框架依赖关系图。但也有一些事情你可以试试,我会尝试根据您的情况为基础我的建议。既然你说:

Your situation is not uncommon. When developing for embedded systems, you might encounter many custom systems that solve a problem in a specific way. As people already commented on your question, there's no easy way to generate a dependency graph for your makefile structure/framework. But there are some things you can try, and I'll try to base my suggestions based on your situation. Since you've said:

进出口新的Linux内核和还挺在深结束...

我们有一个嵌入式的Linux系统,以到达(非常糟糕
  包含数百个东西夹文件)SDK

您可以尝试以下操作:


  • 如果您的SDK是由第三方供应商提供,尝试联系他们,并获得一定的支撑。

  • SDK通常是提供了一个抽象的几个组件协同工作而不他们每个人到底是如何工作的深刻理解。尝试找出你的问题,就像如果你想定制的只有的内核配置,你会发现你的SDK的Linux内核文件夹中(假设你的SDK是由一组了这些东西,库文件夹中,应用程序和东西,其中一人可能是内核之一),并运行源$ C ​​$ C 的make menuconfig 。这将打开一个基于ncurses的配置界面,你可以浏览并选择内核选项。

  • 当人们已经指出的那样,你可以尝试运行的让-n 并检查输出。你也可以尝试运行的让-p |少并检查输出,但我不建议这样做,因为它只会打印数据库(规则和变量值),从读取makefile文件的结果。你将不得不分析此输出找出你在它想要的东西。

  • If your SDK is provided by a third-party vendor, try contacting them and get some support.
  • SDK's usually provide an abstraction to work with several components without a deep understanding of how each one of them really works. Try to pinpoint your problem, like if you want to customize only the kernel configuration, you could find the linux kernel folder on your SDK (assuming your SDK is composed of a set of folders with things like libraries, source code of applications and stuff, one of them might be the kernel one) and run make menuconfig. This will open a ncurses-based configuration GUI that you can navigate and choose kernel options.
  • As people already pointed out, you can try to run make -n and check the output. You could also try to run make -p | less and inspect the output, but I don't recommend this since it will only print the data base (rules and variable values) that results from reading the makefiles. You would have to parse this output to find out what you want in it.

基本上,你应该尝试找出你想定制,看看这如何与您互动的SDK什么。如果它的内核,那么只有用工作,它会给你一个起点。 Linux内核都有自己的Makefile构建系统,名为的kbuild 。你可以找到它在内核的文档文件夹中更多信息。

Basically, you should try to pinpoint what you want to customize and see how this interacts with your SDK. If it's the kernel, then working only with it will give you a starting point. The linux kernel has its own makefile-build system, named kbuild. You can find more information about it at the kernel's Documentation folder.

除此之外,试图理解的makefile工作将如何帮助你,如果你有一个复杂的Makefile结构控制几个组件。以下是很好的资源,了解makefile文件:

Besides that, trying to understand how makefiles work will help you if you have a complex makefile structure controlling several components. The following are good resources to learn about makefiles:

GNU让

O'Reilly的开放图书的与GNU管理项目进行

此外,试图建立自己的工具之前,您可以检查是否有一个开源项目,你想要做什么。在谷歌快速搜索给了我这样的:

Also, before trying to build your own tool, you can check if there's an open source project that does what you want. A quick search on google gave me this:

  • makegrapher

此外,检查这个问题并的这个。你可能会从人,你这样做,有同样的问题找到有用的信息。

Also, check this question and this one. You might find useful information from people that had the same problems as you did.

希望它帮助!

这篇关于建立一个makefile依存/继承树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆