1. build binary file to host; out/host/linux-x86/bin/xxx
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PREBUILT_EXECUTABLES := aaa
include $(BUILD_HOST_PREBUILT)
2. build prebuilt APK to system/app
include $(CLEAR_VARS)
LOCAL_MODULE := install_flash_player
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
3. build multiple prebuilt lib to system/lib
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PREBUILT_LIBS := libflashplayer.so \
libysshared.so
LOCAL_SHARED_LIBRARIES := libflashplayer \
libysshared
include $(BUILD_MULTI_PREBUILT)
4. build prebuilt binary file to system/bin
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := bbb
LOCAL_MODULE := bbb
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_TAGS := optional
include $(BUILD_PREBUILT)
prebuilt_files :=
$(call add-prebuilt-files, EXECUTABLES, $(prebuilt_files))
5. build .jar
LOCAL_PATH:= $(call my-dir)
#MAKE_JAR
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_MODULE := selfthread
LOCAL_MODULE_TAGS := optional
#need these jar built first, used in code base: core, ext, framework
LOCAL_JAVA_LIBRARIES := core ext framework
include $(BUILD_JAVA_LIBRARY)
#MAKE_XML
include $(CLEAR_VARS)
LOCAL_MODULE := selfthreadxml.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
6. execute shell script in Android make file
#one shell call shell command once, if you don't want exit shell, use ";"
#use "``", in some environment it will shoe missing separator
#example $(shell `pwd`)
PWD := $(shell pwd)/vendor/company/anymote-protocol/java
$(shell `echo $(PWD)`)
$(shell `cd $(PWD);\
make;\
cd -`)
#or in one line
$(shell `cd $(PWD);make;cd -`)
#if use target, type $mm target, but default won't execute it, example
#$mm anymote
anymote:
cd vendor/company/anymote-protocol/java;\
echo `pwd`;\
make;\
cd -
7. make order, for example, run anymote.mk, polo.mk first
LOCAL_PATH:= $(call my-dir)
include $(call all-makefiles-under, $(LOCAL_PATH))
include $(ANDROID_BUILD_TOP)/vendor/company/anymote-protocol/java/anymote.mk
include $(ANDROID_BUILD_TOP)/vendor/company/google-tv-pairing-protocol/java/polo.mk
8. what is different with all-subdir-makefiles and all-makefiles-under
all-subdir-makefiles: 表示“當前目錄下沒有需要編譯的文件,請向子目錄深入”,是告訴編譯器繼續向目錄深處遞迴的一種寫法。
all-makefiles-under: 為當前目錄下有文件需要編譯,而且在當前目錄下還有子目錄,子目錄中也有文件需要編譯,同樣也要包含告訴編譯器在編譯完當前目錄下的文件後,繼續向子目錄深入的語句。