Home | History | Annotate | Download | only in build
      1 # Copyright (C) 2008 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 
     16 # definitions shared by host_executable.make and host_static_library.make
     17 #
     18 
     19 # the directory where we're going to place our object files
     20 LOCAL_OBJS_DIR  := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE))
     21 LOCAL_OBJECTS   :=
     22 $(call local-host-define,CC)
     23 $(call local-host-define,LD)
     24 LOCAL_C_SOURCES := $(filter  %.c,$(LOCAL_SRC_FILES))
     25 LOCAL_GENERATED_C_SOURCES := $(filter %.c,$(LOCAL_GENERATED_SOURCES))
     26 LOCAL_GENERATED_CXX_SOURCES := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES))
     27 LOCAL_CXX_SOURCES := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
     28 LOCAL_OBJC_SOURCES := $(filter %.m,$(LOCAL_SRC_FILES))
     29 
     30 LOCAL_CFLAGS := $(strip $(patsubst %,-I%,$(LOCAL_C_INCLUDES)) $(LOCAL_CFLAGS))
     31 
     32 # HACK ATTACK: For the Darwin x86 build, we need to add
     33 # '-read_only_relocs suppress' to the linker command to avoid errors.
     34 ifeq ($(HOST_OS)-$(LOCAL_MODULE_BITS),darwin-32)
     35   LOCAL_LDLIBS += -Wl,-read_only_relocs,suppress
     36 endif
     37 
     38 $(foreach src,$(LOCAL_C_SOURCES), \
     39     $(eval $(call compile-c-source,$(src))) \
     40 )
     41 
     42 $(foreach src,$(LOCAL_GENERATED_C_SOURCES), \
     43     $(eval $(call compile-generated-c-source,$(src))) \
     44 )
     45 
     46 $(foreach src,$(LOCAL_GENERATED_CXX_SOURCES), \
     47     $(eval $(call compile-generated-cxx-source,$(src))) \
     48 )
     49 
     50 $(foreach src,$(LOCAL_CXX_SOURCES), \
     51     $(eval $(call compile-cxx-source,$(src))) \
     52 )
     53 
     54 $(foreach src,$(LOCAL_OBJC_SOURCES), \
     55     $(eval $(call compile-objc-source,$(src))) \
     56 )
     57 
     58 # Ensure that we build all generated sources before the objects
     59 $(LOCAL_OBJECTS): | $(LOCAL_GENERATED_SOURCES) $(LOCAL_ADDITIONAL_DEPENDENCIES)
     60 
     61 CLEAN_OBJS_DIRS += $(LOCAL_OBJS_DIR)
     62