1ifeq ($(ANDROID_BUILD_LIBEDIT),true) # only maintainer needs this
2ifeq ($(HOST_OS),linux) # only build on linux hosts
3ifeq ($(HOST_ARCH),x86) # only build on x86 hosts
4
5LOCAL_PATH := $(call my-dir)
6PREBUILT_ROOT := prebuilts/libs/libedit
7PREBUILT_ARCH_ROOT := $(PREBUILT_ROOT)/$(HOST_OS)-$(HOST_ARCH)
8
9PREBUILT_CFLAGS="CFLAGS=-m32"
10PREBUILT_CXXFLAGS="CXXFLAGS=-m32"
11PREBUILT_LDFLAGS="LDFLAGS=-m32"
12
13HOST_STATIC_LIB_EXT := .a
14
15# Light wrapper rules around ./configure-based build.
16# Output goes to the prebuilts/libs/libedit directory.
17
18$(LOCAL_PATH)/lib/libedit.la: $(wildcard $(LOCAL_PATH)/src/*) $(LOCAL_PATH)/config.h
19	@echo making libedit for $(HOST_OS)-$(HOST_ARCH)
20	make -C $(LOCAL_PATH)
21
22$(PREBUILT_ARCH_ROOT)/lib/libedit.la: $(LOCAL_PATH)/lib/libedit.la
23	make -C $(LOCAL_PATH) all install
24
25$(LOCAL_PATH)/config.h: $(LOCAL_PATH)/config.h.in
26	$(hide) cd $(LOCAL_PATH) \
27  && ./configure \
28    --prefix=$(abspath $(PREBUILT_ROOT)) \
29    --exec-prefix=$(abspath $(PREBUILT_ARCH_ROOT)) \
30    --disable-shared \
31    $(PREBUILT_CFLAGS) $(PREBUILT_CXXFLAGS) $(PREBUILT_LDFLAGS) \
32  && make clean
33
34$(PREBUILT_ARCH_ROOT)/lib/libedit$(HOST_STATIC_LIB_EXT): \
35  $(PREBUILT_ARCH_ROOT)/lib/libedit.la
36
37endif # only build on x86 hosts
38endif # only build on linux hosts
39endif # only maintainer needs this
40