首页 > 代码库 > [转]编写 android.mk 中 LOCAL_C_INCLUDES 的技巧
[转]编写 android.mk 中 LOCAL_C_INCLUDES 的技巧
看原文请移步:编写 android.mk 中 LOCAL_C_INCLUDES 的技巧
在编写android.mk
的过程中,免不了要修改LOCAL_C_INCLUDES
来设置头文件的include目录, 一般写成这样
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes $(LOCAL_PATH)/../../Classes/game $(LOCAL_PATH)/../../Classes/logic $(LOCAL_PATH)/../../Classes/view
有一个目录就要写一行, 实在繁琐, 有没有写法可以把源码目录下的所有子目录都引入呢, 看下面
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../ClassesLOCAL_C_INCLUDES += $(shell ls -FR $(LOCAL_C_INCLUDES) | grep $(LOCAL_PATH)/$ )LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES:$(LOCAL_PATH)/%:=$(LOCAL_PATH)/%)
即可把$(LOCAL_PATH)/../../Classes
目录和子目录全部包含进来
还有一种写法, 就是使用sed
命令, 效果是一样的, 我对sed
不是很熟悉, 简单写了一下
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes LOCAL_C_INCLUDES += $(shell ls -FR $(LOCAL_C_INCLUDES) | grep $(LOCAL_PATH)/$ | sed "s/:/ /g" )
这两行和上面三行的结果是一样的
[转]编写 android.mk 中 LOCAL_C_INCLUDES 的技巧
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。