Android.mk宏定义demo【转】
本文转载自:http://blog.csdn.net/u010164190/article/details/72783963
1.Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := binder_demo_show
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := test.cpp
TARGET_BUILD_VARINT := userdebug #宏定义为userdebug
ifneq ( ,$(filter userdebug eng, $(TARGET_BUILD_VARINT))) #filter过滤掉eng
#ifeq ( userdebug ,$(filter userdebug eng, $(TARGET_BUILD_VARINT)))#与此等价
LOCAL_CFLAGS += -DDEBUG
endif
#LOCAL_CFLAGS += -DDEBUG=1 和 LOCAL_CFLAGS += -DDEBUG=0 和LOCAL_CFLAGS += -DDEBUG效果都是真
LOCAL_SHARED_LIBRARIES := libcutils
include $(BUILD_EXECUTABLE)
2.test.cpp
#define LOG_TAG "binder_demo"
#include <stdlib.h>
#include <utils/Log.h>
using namespace android;
int main() {
#ifdef DEBUG
ALOGE("Android.mk is define DEBUG");
#else
ALOGE("Android.mk is not define DEBUG");
#endif
return 0;
}