在 Android.mk 中使用 Make 的“通配符"功能 [英] Using Make's 'wildcard' function in Android.mk
问题描述
我在使用 Make 的 wildcard
函数时遇到问题 在我的 Android.mk 构建文件中.
I'm having a problem using Make's wildcard
function in my Android.mk build file.
我的其他 makefile 使用类似这样的一行来指定此文件夹中的所有 .c 文件":
My other makefiles use a line like this one to specify "All .c files in this folder":
CFILES := $(wildcard *.c)
在我的 Android.mk 文件中,我尝试了这个:
In my Android.mk file I tried this:
LOCAL_SRC_FILES := $(wildcard *.c)
但是,这与根本不包含任何文件具有相同的效果.
However, this has the same affect as not including any files at all.
如果我手动包含文件,则构建将按预期工作.
If I include the files manually the build works as I'd expect.
我想知道在评估此语句时,当前工作目录是否不是我的项目路径?如果是这样,我可以使用 $(call my-dir)
和通配符函数的组合来获取我想要的列表吗?
I'm wondering if maybe the current working directory isn't my project path at the time this statement is evaluated? If so, can I use a combination of $(call my-dir)
and the wildcard function to get the list I want?
推荐答案
这是我过去使用的方法:
Here's what I've used in the past for doing this:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mylibrary
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.c)
include $(BUILD_STATIC_LIBRARY)
'my-dir'是构建系统提供的宏,返回包含Android.mk文件的目录路径.
'my-dir' is a macro provided by the build system and returns the path of the directory containing the Android.mk file.
这篇关于在 Android.mk 中使用 Make 的“通配符"功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!