Android.mk 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Google Android makefile for curl and libcurl
  2. #
  3. # Place the curl source (including this makefile) into external/curl/ in the
  4. # Android source tree. Then build them with 'make curl' or just 'make libcurl'
  5. # from the Android root. Tested with Android 1.5
  6. #
  7. # Note: you must first create a curl_config.h file by running configure in the
  8. # Android environment. The only way I've found to do this is tricky. Perform a
  9. # normal Android build with libcurl in the source tree, providing the target
  10. # "showcommands" to make. The build will eventually fail (because curl_config.h
  11. # doesn't exist yet), but the compiler commands used to build curl will be
  12. # shown. Now, from the external/curl/ directory, run curl's normal configure
  13. # command with flags that match what Android itself uses. This will mean
  14. # putting the compiler directory into the PATH, putting the -I, -isystem and
  15. # -D options into CPPFLAGS, putting the -m, -f, -O and -nostdlib options into
  16. # CFLAGS, and putting the -Wl, -L and -l options into LIBS, along with the path
  17. # to the files libgcc.a, crtbegin_dynamic.o, and ccrtend_android.o. Remember
  18. # that the paths must be absolute since you will not be running configure from
  19. # the same directory as the Android make. The normal cross-compiler options
  20. # must also be set.
  21. #
  22. # The end result will be a configure command that looks something like this
  23. # (the environment variable A is set to the Android root path):
  24. #
  25. # A=`realpath ../..` && \
  26. # PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/bin:$PATH" \
  27. # ./configure --host=arm-linux CC=arm-eabi-gcc \
  28. # CPPFLAGS="-I $A/system/core/include ..." \
  29. # CFLAGS="-fno-exceptions -Wno-multichar ..." \
  30. # LIB="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/lib/gcc/arm-eabi/X\
  31. # /interwork/libgcc.a ..." \
  32. #
  33. # Dan Fandrich
  34. # September 2009
  35. LOCAL_PATH:= $(call my-dir)
  36. common_CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wno-system-headers -DHAVE_CONFIG_H
  37. #########################
  38. # Build the libcurl library
  39. include $(CLEAR_VARS)
  40. include $(LOCAL_PATH)/lib/Makefile.inc
  41. CURL_HEADERS := \
  42. curlbuild.h \
  43. curl.h \
  44. curlrules.h \
  45. curlver.h \
  46. easy.h \
  47. mprintf.h \
  48. multi.h \
  49. stdcheaders.h \
  50. typecheck-gcc.h \
  51. types.h
  52. LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES))
  53. LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/
  54. LOCAL_CFLAGS += $(common_CFLAGS)
  55. LOCAL_COPY_HEADERS_TO := libcurl/curl
  56. LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS))
  57. LOCAL_MODULE:= libcurl
  58. include $(BUILD_STATIC_LIBRARY)
  59. #########################
  60. # Build the curl binary
  61. include $(CLEAR_VARS)
  62. include $(LOCAL_PATH)/src/Makefile.inc
  63. LOCAL_SRC_FILES := $(addprefix src/,$(CURL_SOURCES))
  64. LOCAL_MODULE := curl
  65. LOCAL_STATIC_LIBRARIES := libcurl
  66. LOCAL_SYSTEM_SHARED_LIBRARIES := libc
  67. LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/lib
  68. # This will also need to include $(CURLX_ONES) in order to correctly build
  69. # a dynamic library
  70. LOCAL_CFLAGS += $(common_CFLAGS)
  71. include $(BUILD_EXECUTABLE)