1 LOCAL_PATH := $(call my-dir) 2 3 include $(CLEAR_VARS) 4 LOCAL_MODULE := static-executable 5 LOCAL_SRC_FILES := main.cxx 6 LOCAL_CFLAGS += -fexceptions 7 8 # Note that by default ndk-build system doesn't support static executable, 9 # but option "-static" can instruct gcc to link with proper crt*o files to 10 # generate static executable. 11 LOCAL_LDFLAGS += -static 12 13 # Be aware that -Wl,--eh-frame-hdr is also needed for "-static" (at least for 14 # x86 and mips which use eh frames) since crt files are now in C, and the trick 15 # in the previous *S file to iterate all eh frames and record ranges is gone 16 LOCAL_LDFLAGS += -Wl,--eh-frame-hdr 17 18 include $(BUILD_EXECUTABLE) 19 20