Android.mk revision 1d4637b3d94732a4eaa83b129054ee9245bed24e
1# Copyright (C) 2010 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17# build baksmali jar
18# ============================================================
19
20include $(CLEAR_VARS)
21
22LOCAL_MODULE := baksmalilib
23
24LOCAL_MODULE_TAGS := optional
25
26#LOCAL_MODULE_CLASS and LOCAL_IS_HOST_MODULE must be defined before calling $(local-intermediates-dir)
27LOCAL_MODULE_CLASS := JAVA_LIBRARIES
28LOCAL_IS_HOST_MODULE := true
29
30intermediates := $(call local-intermediates-dir,COMMON)
31
32LOCAL_SRC_FILES := \
33	$(call all-java-files-under, src/main/java) \
34	$(call all-java-files-under, ../dexlib2/src/main/java) \
35	$(call all-java-files-under, ../util/src/main/java)
36
37LOCAL_JAR_MANIFEST := manifest.txt
38
39LOCAL_STATIC_JAVA_LIBRARIES := \
40	antlr-runtime \
41	commons-cli-1.2 \
42	guavalib
43
44#read in the version number
45BAKSMALI_VERSION := $(shell cat $(LOCAL_PATH)/../build.gradle | \
46    grep -o -e "^version = '\(.*\)'" | grep -o -e "[0-9.]\+")
47
48BAKSMALI_VERSION := $(BAKSMALI_VERSION)-aosp
49
50#create a new baksmali.properties file using the correct version
51$(intermediates)/resources/baksmali.properties:
52	$(hide) mkdir -p $(dir $@)
53	$(hide) echo "application.version=$(BAKSMALI_VERSION)" > $@
54
55LOCAL_JAVA_RESOURCE_FILES := $(intermediates)/resources/baksmali.properties
56
57include $(BUILD_HOST_JAVA_LIBRARY)
58
59
60
61# copy baksmali script
62# ============================================================
63
64include $(CLEAR_VARS)
65LOCAL_IS_HOST_MODULE := true
66LOCAL_MODULE_CLASS := EXECUTABLES
67LOCAL_MODULE_TAGS := optional
68LOCAL_MODULE := baksmali
69
70include $(BUILD_SYSTEM)/base_rules.mk
71
72$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/baksmalilib.jar
73$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/../scripts/baksmali | $(ACP)
74	@echo "Copy: $(PRIVATE_MODULE) ($@)"
75	$(copy-file-to-new-target)
76	$(hide) chmod 755 $@