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