Home | History | Annotate | Download | only in libcutils
      1 #
      2 # Copyright (C) 2008 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 LOCAL_PATH := $(my-dir)
     17 include $(CLEAR_VARS)
     18 
     19 ifeq ($(TARGET_CPU_SMP),true)
     20     targetSmpFlag := -DANDROID_SMP=1
     21 else
     22     targetSmpFlag := -DANDROID_SMP=0
     23 endif
     24 hostSmpFlag := -DANDROID_SMP=0
     25 
     26 commonSources := \
     27 	hashmap.c \
     28 	atomic.c.arm \
     29 	native_handle.c \
     30 	socket_inaddr_any_server.c \
     31 	socket_local_client.c \
     32 	socket_local_server.c \
     33 	socket_loopback_client.c \
     34 	socket_loopback_server.c \
     35 	socket_network_client.c \
     36 	sockets.c \
     37 	config_utils.c \
     38 	cpu_info.c \
     39 	load_file.c \
     40 	list.c \
     41 	open_memstream.c \
     42 	strdup16to8.c \
     43 	strdup8to16.c \
     44 	record_stream.c \
     45 	process_name.c \
     46 	threads.c \
     47 	sched_policy.c \
     48 	iosched_policy.c \
     49 	str_parms.c \
     50 
     51 commonHostSources := \
     52         ashmem-host.c
     53 
     54 # some files must not be compiled when building against Mingw
     55 # they correspond to features not used by our host development tools
     56 # which are also hard or even impossible to port to native Win32
     57 WINDOWS_HOST_ONLY :=
     58 ifeq ($(HOST_OS),windows)
     59     ifeq ($(strip $(USE_CYGWIN)),)
     60         WINDOWS_HOST_ONLY := 1
     61     endif
     62 endif
     63 # USE_MINGW is defined when we build against Mingw on Linux
     64 ifneq ($(strip $(USE_MINGW)),)
     65     WINDOWS_HOST_ONLY := 1
     66 endif
     67 
     68 ifneq ($(WINDOWS_HOST_ONLY),1)
     69     commonSources += \
     70         fs.c \
     71         multiuser.c
     72 endif
     73 
     74 
     75 # Static library for host
     76 # ========================================================
     77 LOCAL_MODULE := libcutils
     78 LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
     79 LOCAL_LDLIBS := -lpthread
     80 LOCAL_STATIC_LIBRARIES := liblog
     81 LOCAL_CFLAGS += $(hostSmpFlag)
     82 include $(BUILD_HOST_STATIC_LIBRARY)
     83 
     84 
     85 # Static library for host, 64-bit
     86 # ========================================================
     87 include $(CLEAR_VARS)
     88 LOCAL_MODULE := lib64cutils
     89 LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
     90 LOCAL_LDLIBS := -lpthread
     91 LOCAL_STATIC_LIBRARIES := lib64log
     92 LOCAL_CFLAGS += $(hostSmpFlag) -m64
     93 include $(BUILD_HOST_STATIC_LIBRARY)
     94 
     95 
     96 # Shared and static library for target
     97 # ========================================================
     98 
     99 # This is needed in LOCAL_C_INCLUDES to access the C library's private
    100 # header named <bionic_time.h>
    101 #
    102 libcutils_c_includes := bionic/libc/private
    103 
    104 include $(CLEAR_VARS)
    105 LOCAL_MODULE := libcutils
    106 LOCAL_SRC_FILES := $(commonSources) \
    107         android_reboot.c \
    108         ashmem-dev.c \
    109         debugger.c \
    110         klog.c \
    111         partition_utils.c \
    112         properties.c \
    113         qtaguid.c \
    114         trace.c \
    115         uevent.c
    116 
    117 ifeq ($(TARGET_ARCH),arm)
    118 LOCAL_SRC_FILES += arch-arm/memset32.S
    119 else  # !arm
    120 ifeq ($(TARGET_ARCH_VARIANT),x86-atom)
    121 LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
    122 LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c
    123 else # !x86-atom
    124 ifeq ($(TARGET_ARCH),mips)
    125 LOCAL_SRC_FILES += arch-mips/android_memset.c
    126 else # !mips
    127 LOCAL_SRC_FILES += memory.c
    128 endif # !mips
    129 endif # !x86-atom
    130 endif # !arm
    131 
    132 LOCAL_C_INCLUDES := $(libcutils_c_includes) $(KERNEL_HEADERS)
    133 LOCAL_STATIC_LIBRARIES := liblog
    134 LOCAL_CFLAGS += $(targetSmpFlag)
    135 include $(BUILD_STATIC_LIBRARY)
    136 
    137 include $(CLEAR_VARS)
    138 LOCAL_MODULE := libcutils
    139 # TODO: remove liblog as whole static library, once we don't have prebuilt that requires
    140 # liblog symbols present in libcutils.
    141 LOCAL_WHOLE_STATIC_LIBRARIES := libcutils liblog
    142 LOCAL_SHARED_LIBRARIES := liblog
    143 LOCAL_CFLAGS += $(targetSmpFlag)
    144 LOCAL_C_INCLUDES := $(libcutils_c_includes)
    145 include $(BUILD_SHARED_LIBRARY)
    146 
    147 include $(CLEAR_VARS)
    148 LOCAL_MODULE := tst_str_parms
    149 LOCAL_CFLAGS += -DTEST_STR_PARMS
    150 LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c
    151 LOCAL_SHARED_LIBRARIES := liblog
    152 LOCAL_MODULE_TAGS := optional
    153 include $(BUILD_EXECUTABLE)
    154 
    155 include $(call all-makefiles-under,$(LOCAL_PATH))
    156