Home | History | Annotate | Download | only in libbcc
      1 #
      2 # Copyright (C) 2012 The Android Open Source Project
      3 #
      4 # Licensed under the Apache License, Version 2.0 (the "License");
      5 # you may not use this file except in compliance with the License.
      6 # You may obtain a copy of the License at
      7 #
      8 #      http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 #
     16 
     17 # NOTE: Following rules are extracted from base_rules.mk and binary.mk.
     18 # We must ensure that they are synchronized.
     19 
     20 LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
     21 ifdef LOCAL_IS_HOST_MODULE
     22   ifneq ($(LOCAL_IS_HOST_MODULE),true)
     23     $(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
     24   endif
     25   my_prefix:=HOST_
     26 else
     27   my_prefix:=TARGET_
     28 endif
     29 
     30 so_suffix := $($(my_prefix)SHLIB_SUFFIX)
     31 a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
     32 
     33 # Extract Depended Libraries
     34 LOCAL_LIBBCC_LIB_DEPS := \
     35   $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
     36     $(call intermediates-dir-for, \
     37       STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix)) \
     38   $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
     39     $(call intermediates-dir-for, \
     40       STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix)) \
     41   $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
     42     $(addsuffix $(so_suffix), $(LOCAL_SHARED_LIBRARIES))) \
     43 
     44 # Build Rules for Automatically Generated Build Information
     45 GEN := $(local-intermediates-dir)/BuildInfo.cpp
     46 
     47 gen_build_info := $(LOCAL_PATH)/tools/build/gen-build-info.py
     48 
     49 $(GEN): PRIVATE_PATH := $(LOCAL_PATH)
     50 $(GEN): PRIVATE_DEPS := $(LOCAL_LIBBCC_LIB_DEPS)
     51 $(GEN): PRIVATE_CUSTOM_TOOL = $(gen_build_info) $(PRIVATE_PATH) \
     52                               $(PRIVATE_DEPS) > $@
     53 $(GEN): $(gen_build_info) $(LOCAL_LIBBCC_LIB_DEPS) \
     54         $(wildcard $(LOCAL_PATH)/.git/COMMIT_EDITMSG)
     55 	$(transform-generated-source)
     56 
     57 LOCAL_GENERATED_SOURCES += $(GEN)
     58