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 	threads.c \
     50 	sched_policy.c \
     51 	iosched_policy.c \
     52 	str_parms.c
     53 
     54 commonHostSources := \
     55         ashmem-host.c
     56 
     57 # some files must not be compiled when building against Mingw
     58 # they correspond to features not used by our host development tools
     59 # which are also hard or even impossible to port to native Win32
     60 WINDOWS_HOST_ONLY :=
     61 ifeq ($(HOST_OS),windows)
     62     ifeq ($(strip $(USE_CYGWIN)),)
     63         WINDOWS_HOST_ONLY := 1
     64     endif
     65 endif
     66 # USE_MINGW is defined when we build against Mingw on Linux
     67 ifneq ($(strip $(USE_MINGW)),)
     68     WINDOWS_HOST_ONLY := 1
     69 endif
     70 
     71 ifeq ($(WINDOWS_HOST_ONLY),1)
     72     commonSources += \
     73         uio.c
     74 else
     75     commonSources += \
     76         abort_socket.c \
     77         mspace.c \
     78         selector.c \
     79         tztime.c \
     80         zygote.c
     81 
     82     commonHostSources += \
     83         tzstrftime.c
     84 endif
     85 
     86 
     87 # Static library for host
     88 # ========================================================
     89 LOCAL_MODULE := libcutils
     90 LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
     91 LOCAL_LDLIBS := -lpthread
     92 LOCAL_STATIC_LIBRARIES := liblog
     93 LOCAL_CFLAGS += $(hostSmpFlag)
     94 include $(BUILD_HOST_STATIC_LIBRARY)
     95 
     96 
     97 # Shared and static library for target
     98 # ========================================================
     99 include $(CLEAR_VARS)
    100 LOCAL_MODULE := libcutils
    101 LOCAL_SRC_FILES := $(commonSources) ashmem-dev.c mq.c android_reboot.c partition_utils.c uevent.c qtaguid.c klog.c
    102 
    103 ifeq ($(TARGET_ARCH),arm)
    104 LOCAL_SRC_FILES += arch-arm/memset32.S
    105 else  # !arm
    106 ifeq ($(TARGET_ARCH),sh)
    107 LOCAL_SRC_FILES += memory.c atomic-android-sh.c
    108 else  # !sh
    109 ifeq ($(TARGET_ARCH_VARIANT),x86-atom)
    110 LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
    111 LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c
    112 else # !x86-atom
    113 LOCAL_SRC_FILES += memory.c
    114 endif # !x86-atom
    115 endif # !sh
    116 endif # !arm
    117 
    118 LOCAL_C_INCLUDES := $(KERNEL_HEADERS)
    119 LOCAL_STATIC_LIBRARIES := liblog
    120 LOCAL_CFLAGS += $(targetSmpFlag)
    121 include $(BUILD_STATIC_LIBRARY)
    122 
    123 include $(CLEAR_VARS)
    124 LOCAL_MODULE := libcutils
    125 LOCAL_WHOLE_STATIC_LIBRARIES := libcutils
    126 LOCAL_SHARED_LIBRARIES := liblog
    127 LOCAL_CFLAGS += $(targetSmpFlag)
    128 include $(BUILD_SHARED_LIBRARY)
    129 
    130 include $(CLEAR_VARS)
    131 LOCAL_MODULE := tst_str_parms
    132 LOCAL_CFLAGS += -DTEST_STR_PARMS
    133 LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c
    134 LOCAL_SHARED_LIBRARIES := liblog
    135 LOCAL_MODULE_TAGS := optional
    136 include $(BUILD_EXECUTABLE)
    137