OSDN Git Service

Android: add makefile and config.h
[android-x86/external-alsa-lib.git] / android / Android.mk
1 #
2 # Copyright (C) 2021 The Android-x86 Open Source Project
3 #
4 # Licensed under the GNU Lesser General Public License Version 2.1.
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.gnu.org/licenses/lgpl.html
9 #
10
11 LOCAL_PATH := $(dir $(call my-dir))
12 include $(CLEAR_VARS)
13
14 LOCAL_MODULE := libasound
15 LOCAL_MODULE_TAGS := optional
16 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
17
18 LOCAL_CFLAGS := -DPIC -Wno-absolute-value -Wno-address-of-packed-member \
19         -Wno-missing-braces -Wno-missing-field-initializers \
20         -Wno-pointer-arith -Wno-sign-compare -Wno-unused-function \
21         -Wno-unused-const-variable -Wno-unused-parameter -Wno-unused-variable \
22         -finline-limit=300 -finline-functions -fno-inline-functions-called-once
23
24 # list of files to be excluded
25 EXCLUDE_SRC_FILES := \
26         src/alisp/alisp_snd.c \
27         src/compat/hsearch_r.c \
28         src/control/control_shm.c \
29         src/pcm/pcm_d%.c \
30         src/pcm/pcm_ladspa.c \
31         src/pcm/pcm_shm.c \
32         src/pcm/scopes/level.c \
33
34 LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(call all-c-files-under,src))
35
36 intermediates := $(call local-generated-sources-dir)
37
38 GEN := $(intermediates)/alsa/asoundlib.h
39 $(GEN): $(LOCAL_PATH)configure.ac
40         $(hide) rm -rf $(dir $(@D)); mkdir -p $(@D)
41         ver=$$(sed -n "/^AC_INIT.* \([0-9.]*\))/s//\1/p" $<); vers=($${ver//./ }); \
42         echo -e "#define SND_LIB_MAJOR $${vers[0]}\n#define SND_LIB_MINOR $${vers[1]}\n#define SND_LIB_SUBMINOR $${vers[2]}\n#define SND_LIB_EXTRAVER 1000000" > $(@D)/version.h; \
43         echo -e "#define SND_LIB_VER(maj, min, sub) (((maj)<<16)|((min)<<8)|(sub))\n#define SND_LIB_VERSION SND_LIB_VER(SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR)" >> $(@D)/version.h; \
44         echo "#define SND_LIB_VERSION_STR \"$$ver\"" >> $(@D)/version.h
45         cat $(<D)/include/asoundlib-head.h > $@; \
46         sed -n "/.*\(#include <[ae].*.h>\).*/s//\1/p" $< >> $@; \
47         cat $(<D)/include/asoundlib-tail.h >> $@
48
49 LOCAL_GENERATED_SOURCES := $(GEN)
50
51 LOCAL_C_INCLUDES := $(LOCAL_PATH)include $(LOCAL_PATH)android $(dir $(GEN))
52 LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates) $(LOCAL_PATH)android
53 LOCAL_SHARED_LIBRARIES := libdl
54
55 include $(BUILD_SHARED_LIBRARY)