NDK:Android.mk / GNU制作Android、NDK、GNU、mk

由网友(凌晨一点半的思绪)分享简介:该Android.mk我的NDK项目包含几百从中我建立了十几静态库和最后一个单一的共享库cpp文件。我的大部分开发经验,到目前为止是在Windows上,所以我不是很熟悉Linux,GNU制作,等等。The Android.mk for my NDK project contains several hundred C...

该Android.mk我的NDK项目包含几百从中我建立了十几静态库和最后一个单一的共享库cpp文件。我的大部分开发经验,到目前为止是在Windows上,所以我不是很熟悉Linux,GNU制作,等等。

The Android.mk for my NDK project contains several hundred CPP files from which I build about a dozen static libs and finally a single shared lib. Most of my developing experience so far is on Windows, so I'm not very familiar with Linux, GNU Make, and the like.

当我添加一个新的CPP文件Android.mk(即到LOCAL_SRC_FILES),发行NDK的构建重建我的所有文件,显然是因为Android.mk改变,它是指所有的CPP文件。有没有办法避免这种情况?假设我为每个静态库一个单独的文件,而每个这样的文件将是lib中的CPP文件添加到LOCAL_SRC_FILES和Android.mk包括在内。如果这一结果在重建只有那些包含文件的lib被修改?其实,这是我第一次尝试,但我去了严重错误的地方,不得不重新开始作为构建将不再得逞(这就是为什么我在重试前要求)。

When I add a new CPP file to Android.mk (i.e. to LOCAL_SRC_FILES), issuing ndk-build rebuilds all of my files, apparently because Android.mk changed, and it refers to all of the CPP files. Is there a way to avoid this? Let's assume I make a separate file for each static lib, and each such file would add that lib's CPP files to LOCAL_SRC_FILES and be included by Android.mk. Should that result in rebuilding only the lib whose included file is modified? This was actually my first attempt, but I went seriously wrong somewhere, and had to start over as the build would no longer succeed (which is why I'm asking before trying again).

假设上述做法是合理的,如何包括文件涉及到的变量的作用域/寿命中设置的,包括/包含的文件?

Assuming the above approach is reasonable, how does including a file relate to the scope/lifetime of variables set in the including/included files?

不过希望有人能回答这个...

Still hoping someone can answer this...

推荐答案

首先尝试将您的项目分割成多个android.mk文件,而不是只是一个的。这将限制重新编译每次更改其中的一个时间步长。那就试试这个 NDK的构建-o< your_android.mk> 。例如:

Firstly try to split your project into multiple android.mk files, instead of just one. It would limit the recompilation step each time you change one of them. Then try this ndk-build -o <your_android.mk>. For instance:

ndk-build -o jni/Android.mk

参考:How以prevent Android原生项目改变Android.mk后完全重建?

阅读全文

相关推荐

最新文章