1 include $(CLEAR_VARS) 2 3 LOCAL_MODULE_TAGS:= 4 LOCAL_MODULE:=libext$(libext_suffix) 5 6 # LOCAL_MODULE_CLASS must be defined before calling $(local-generated-sources-dir) 7 # 8 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 9 MY_gen := $(call local-generated-sources-dir) 10 11 # LOCAL_PATH needed because of dirty #include "blabla.c" 12 LOCAL_C_INCLUDES:= \ 13 $(LOCAL_PATH)/../include/ \ 14 $(LOCAL_PATH)/.. \ 15 $(MY_gen) \ 16 $(LOCAL_PATH) 17 18 LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1 19 # The $* does not work as expected. It ends up empty. Even with SECONDEXPANSION. 20 # LOCAL_CFLAGS+=-D_INIT=lib$*_init 21 LOCAL_CFLAGS+=-DXTABLES_INTERNAL 22 LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6 23 # Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__ 24 LOCAL_CFLAGS+=-D__ANDROID__ 25 LOCAL_CFLAGS += $(MY_warnings) 26 27 MY_GEN_INITEXT:= $(MY_gen)/initext.c 28 $(MY_GEN_INITEXT): MY_initext_func := $(addprefix $(libext_prefix)_,$(libext_build_mod)) 29 $(MY_GEN_INITEXT): MY_suffix := $(libext_suffix) 30 $(MY_GEN_INITEXT): 31 @mkdir -p $(dir $@) 32 @( \ 33 echo "" >$@; \ 34 for i in $(MY_initext_func); do \ 35 echo "extern void lib$${i}_init(void);" >>$@; \ 36 done; \ 37 echo "void init_extensions$(MY_suffix)(void);" >>$@; \ 38 echo "void init_extensions$(MY_suffix)(void)" >>$@; \ 39 echo "{" >>$@; \ 40 for i in $(MY_initext_func); do \ 41 echo " ""lib$${i}_init();" >>$@; \ 42 done; \ 43 echo "}" >>$@; \ 44 ); 45 46 MY_lib_sources:= \ 47 $(patsubst %,$(LOCAL_PATH)/lib$(libext_prefix)_%.c,$(libext_build_mod)) 48 49 MY_gen_lib_sources:= $(patsubst $(LOCAL_PATH)/%,${MY_gen}/%,${MY_lib_sources}) 50 51 ${MY_gen_lib_sources}: PRIVATE_PATH := $(LOCAL_PATH) 52 ${MY_gen_lib_sources}: PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/filter_init $(PRIVATE_PATH)/$(notdir $@) > $@ 53 ${MY_gen_lib_sources}: PRIVATE_MODULE := $(LOCAL_MODULE) 54 ${MY_gen_lib_sources}: PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES) 55 ${MY_gen_lib_sources}: ${MY_gen}/% : $(LOCAL_PATH)/% $(LOCAL_PATH)/filter_init 56 $(transform-generated-source) 57 58 $(MY_GEN_INITEXT): $(MY_gen_lib_sources) 59 60 LOCAL_GENERATED_SOURCES:= $(MY_GEN_INITEXT) $(MY_gen_lib_sources) 61 62 include $(BUILD_STATIC_LIBRARY) 63