Home | History | Annotate | Download | only in smali
      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 
     15 LOCAL_PATH := $(call my-dir)
     16 
     17 # build smali jar
     18 # ============================================================
     19 
     20 include $(CLEAR_VARS)
     21 
     22 LOCAL_MODULE := smalilib
     23 
     24 LOCAL_MODULE_TAGS := optional
     25 
     26 #LOCAL_MODULE_CLASS and LOCAL_IS_HOST_MODULE must be defined before calling $(local-intermediates-dir)
     27 LOCAL_MODULE_CLASS := JAVA_LIBRARIES
     28 LOCAL_IS_HOST_MODULE := true
     29 
     30 intermediates := $(call local-intermediates-dir,COMMON)
     31 
     32 GEN := $(addprefix $(intermediates)/, \
     33 			smaliParser.java \
     34 			smaliTreeWalker.java \
     35         )
     36 
     37 LOCAL_SRC_FILES := \
     38 	$(call all-java-files-under, src/main/java) \
     39 	$(call all-java-files-under, ../util/src/main/java)
     40 
     41 LOCAL_JAR_MANIFEST := manifest.txt
     42 
     43 LOCAL_STATIC_JAVA_LIBRARIES := \
     44 	antlr-runtime \
     45 	dexlib2 \
     46 	jcommander-host
     47 
     48 #create a new smali.properties file using the correct version
     49 $(intermediates)/resources/smali.properties: $(LOCAL_PATH)/../build.gradle
     50 	$(hide) mkdir -p $(dir $@)
     51 	$(hide) echo "application.version=$$(grep -o -e "^version = '\(.*\)'" $< | grep -o -e "[0-9.]\+")-aosp" >$@
     52 
     53 LOCAL_JAVA_RESOURCE_FILES := $(intermediates)/resources/smali.properties
     54 
     55 include $(BUILD_HOST_JAVA_LIBRARY)
     56 
     57 
     58 
     59 # copy smali script
     60 # ============================================================
     61 
     62 include $(CLEAR_VARS)
     63 LOCAL_IS_HOST_MODULE := true
     64 LOCAL_MODULE_CLASS := EXECUTABLES
     65 LOCAL_MODULE := smali
     66 LOCAL_SRC_FILES := ../scripts/smali
     67 LOCAL_REQUIRED_MODULES := smalilib
     68 include $(BUILD_PREBUILT)
     69