0

我正在编写一个用于在 Android 中编译 jni 代码的 make 文件。我希望能够递归地编译驻留在特定文件夹下的所有 cpp 文件。

我怎样才能做到这一点?我尝试使用通配符命令,但没有得到我需要的结果。

4

1 回答 1

0

Android make 系统有一个 gmake 宏来处理这个问题。请参阅doc\ANDROID-MK.htmlNDK 中的文档。这是一个摘录:

all-subdir-makefiles
  Returns a list of Android.mk located in all sub-directories of
  the current 'my-dir' path. For example, consider the following
  hierarchy:

    sources/foo/Android.mk
    sources/foo/lib1/Android.mk
    sources/foo/lib2/Android.mk

  If sources/foo/Android.mk contains the single line:

    include $(call all-subdir-makefiles)

  Then it will include automatically sources/foo/lib1/Android.mk and
  sources/foo/lib2/Android.mk

  This function can be used to provide deep-nested source directory
  hierarchies to the build system. Note that by default, the NDK
  will only look for files in sources/*/Android.mk
于 2012-08-15T00:16:01.060 回答