Home | History | Annotate | Download | only in combo
      1 #
      2 # Copyright (C) 2006 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 # Configuration for Darwin (Mac OS X) on x86.
     18 # Included by combo/select.mk
     19 
     20 # We build everything in 32-bit, because some host tools are
     21 # 32-bit-only anyway (emulator, acc), and because it gives us
     22 # more consistency between the host tools and the target.
     23 HOST_GLOBAL_CFLAGS += -m32
     24 HOST_GLOBAL_LDFLAGS += -m32
     25 
     26 # Use the Mac OSX SDK 10.5 if the build host is 10.6
     27 build_mac_version := $(shell sw_vers -productVersion)
     28 ifneq ($(filter 10.6.%, $(build_mac_version)),)
     29 sdk_105_root := /Developer/SDKs/MacOSX10.5.sdk
     30 ifeq ($(wildcard $(sdk_105_root)),)
     31 $(warning *****************************************************)
     32 $(warning * You are building on Mac OSX 10.6.)
     33 $(warning * Can not find SDK 10.5 at $(sdk_105_root))
     34 $(warning *****************************************************)
     35 $(error Stop.)
     36 endif
     37 
     38 HOST_GLOBAL_CFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
     39 HOST_GLOBAL_LDFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
     40 endif # build_mac_version is 10.6
     41 
     42 HOST_GLOBAL_CFLAGS += -fPIC
     43 HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
     44 
     45 HOST_CC := $(CC)
     46 HOST_CXX := $(CXX)
     47 HOST_AR := $(AR)
     48 
     49 HOST_SHLIB_SUFFIX := .dylib
     50 HOST_JNILIB_SUFFIX := .jnilib
     51 
     52 HOST_GLOBAL_CFLAGS += \
     53 	-include $(call select-android-config-h,darwin-x86)
     54 HOST_RUN_RANLIB_AFTER_COPYING := true
     55 HOST_GLOBAL_ARFLAGS := cqs
     56 
     57 HOST_CUSTOM_LD_COMMAND := true
     58 
     59 define transform-host-o-to-shared-lib-inner
     60     $(HOST_CXX) \
     61         -dynamiclib -single_module -read_only_relocs suppress \
     62         $(HOST_GLOBAL_LD_DIRS) \
     63         $(HOST_GLOBAL_LDFLAGS) \
     64         $(PRIVATE_ALL_OBJECTS) \
     65         $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
     66         $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
     67         $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
     68         $(PRIVATE_LDLIBS) \
     69         -o $@ \
     70         $(PRIVATE_LDFLAGS) \
     71         $(HOST_LIBGCC)
     72 endef
     73 
     74 define transform-host-o-to-executable-inner
     75 $(HOST_CXX) \
     76         -o $@ \
     77         -Wl,-dynamic -headerpad_max_install_names \
     78         $(HOST_GLOBAL_LD_DIRS) \
     79         $(HOST_GLOBAL_LDFLAGS) \
     80         $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
     81         $(PRIVATE_ALL_OBJECTS) \
     82         $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
     83         $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
     84         $(PRIVATE_LDFLAGS) \
     85         $(PRIVATE_LDLIBS) \
     86         $(HOST_LIBGCC)
     87 endef
     88 
     89 # $(1): The file to check
     90 define get-file-size
     91 stat -f "%z" $(1)
     92 endef
     93