I'm trying to understand the Android.mk better. I'm using a library to build a project right now and my Android.mk looks like this:
LOCAL_PATH := $(call my-dir)
SUPERPOWERED_PATH := ../../../../superpowered/Superpowered
include $(CLEAR_VARS)
LOCAL_MODULE := Superpowered
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_SRC_FILES := $(SUPERPOWERED_PATH)/libSuperpoweredARM.a
else
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_SRC_FILES := $(SUPERPOWERED_PATH)/libSuperpoweredARM64.a
else
LOCAL_SRC_FILES := $(SUPERPOWERED_PATH)/libSuperpoweredX86.a
endif
endif
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := SuperpoweredExample
LOCAL_SRC_FILES := \
SuperpoweredExample.cpp \
$(SUPERPOWERED_PATH)/SuperpoweredAndroidAudioIO.cpp
LOCAL_C_INCLUDES += $(SUPERPOWERED_PATH)
LOCAL_LDLIBS := -llog -landroid -lOpenSLES
LOCAL_STATIC_LIBRARIES := Superpowered
LOCAL_CFLAGS = -O3
include $(BUILD_SHARED_LIBRARY)
My question is about the include $(CLEAR_VARS)
line between include $(PREBUILT_STATIC_LIBRARY)
and LOCAL_MODULE := SuperpoweredExample
From reading http://android.mk My understanding of CLEAR_VARS is that is clears all of the LOCAL_ variables on the execution space for MAKE parsing. So how am I able to point at the Superpowered module later in the file. It seems to me like this should no longer be possible.
My thinking is that the MAKE parser does its parsing, and then maintains some "Module" space after each module is declared and parsed, which is separate from the actual parsing space. Thats a complete guess though, and I've had some difficulty finding a resource that covers whats happening in the background.