LOCAL_SRC_FILES

Linux 下:

BuildUtility.mk

###########################################################
## Debugging; prints a variable list to stdout
###########################################################

# $(1): variable name list, not variable values
define print-vars-ex
$(foreach var,$(1), \
  $(info $(var):) \
  $(foreach word,$($(var)), \
    $(info $(space)$(space)$(word)) \
   ) \
 )
endef

###########################################################
## Evaluates to true if the string contains the word true,
## and empty otherwise
## $(1): a var to test
###########################################################

define true-or-empty-ex
$(filter true, $(1))
endef

###########################################################
## Find all of the c files under the named directories.
## Meant to be used like:
##    SRC_FILES := $(call all-c-files-under-ex,src tests)
###########################################################

define all-c-files-under-ex
$(patsubst ./%,%, \
  $(shell cd $(LOCAL_PATH) ; \
          find -L $(1) -name "*.c" -and -not -name ".*") \
 )
endef

###########################################################
## Find all of the c files from here.  Meant to be used like:
##    SRC_FILES := $(call all-subdir-c-files-ex)
###########################################################

define all-subdir-c-files-ex
$(call all-c-files-under-ex,.)
endef

###########################################################
## Find all of the cpp files under the named directories.
## Meant to be used like:
##    SRC_FILES := $(call all-cpp-files-under-ex,src tests)
###########################################################

define all-cpp-files-under-ex
$(patsubst ./%,%, \
  $(shell cd $(LOCAL_PATH) ; \
          find -L $(1) -name "*.cpp" -and -not -name ".*") \
 )
endef

###########################################################
## Find all of the cpp files from here.  Meant to be used like:
##    SRC_FILES := $(call all-subdir-cpp-files)
###########################################################

define all-subdir-cpp-files-ex
$(call all-cpp-files-under-ex,.)
endef

###########################################################
## Find all of the java files under the named directories.
## Meant to be used like:
##    SRC_FILES := $(call all-java-files-under-ex,src tests)
###########################################################

define all-java-files-under-ex
$(patsubst ./%,%, \
  $(shell cd $(LOCAL_PATH) ; \
          find -L $(1) -name "*.java" -and -not -name ".*") \
 )
endef

###########################################################
## Find all of the java files from here.  Meant to be used like:
##    SRC_FILES := $(call all-subdir-java-files-ex)
###########################################################

define all-subdir-java-files-ex
$(call all-java-files-under-ex,.)
endef

在 Android.mk 中,加入这句(BuildUtility.mk 放在Android.mk同目录下)

include $(CLEAR_VARS)
include $(LOCAL_PATH)/BuildUtility.mk

Windows 下:

在 Android.mk 中,加入

ALL_CPP_LIST := $(wildcard $(LOCAL_PATH)/*.cpp)
ALL_CPP_LIST += $(wildcard $(LOCAL_PATH)/src/*.cpp)
LOCAL_SRC_FILES := $(ALL_CPP_LIST:$(LOCAL_PATH)/%=%)

Windows 中没有完全实现自己包含 *.cpp 要自己加目录,如上面的 "src"。


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值