OSDN Git Service

Fix building issues with pie-x86
[android-x86/external-koush-Superuser.git] / Android.mk
1 # Root AOSP source makefile
2 # su is built here, and 
3
4 my_path := $(call my-dir)
5
6 ifdef SUPERUSER_EMBEDDED
7 SUPERUSER_PACKAGE := com.android.settings
8 else
9 ifeq ($(SUPERUSER_PACKAGE),)
10 SUPERUSER_PACKAGE := com.thirdparty.superuser
11 endif
12 include $(my_path)/Superuser/Android.mk
13 endif
14
15
16 LOCAL_PATH := $(my_path)
17 include $(CLEAR_VARS)
18
19 LOCAL_MODULE := su
20 LOCAL_MODULE_TAGS := optional
21 LOCAL_FORCE_STATIC_EXECUTABLE := true
22 LOCAL_STATIC_LIBRARIES := libc libcutils
23 LOCAL_C_INCLUDES := external/sqlite/dist
24 LOCAL_SRC_FILES := Superuser/jni/su/su.c Superuser/jni/su/daemon.c Superuser/jni/su/activity.c Superuser/jni/su/db.c Superuser/jni/su/utils.c Superuser/jni/su/pts.c ../../sqlite/dist/sqlite3.c
25 LOCAL_CFLAGS := -DSQLITE_OMIT_LOAD_EXTENSION -DREQUESTOR=\"$(SUPERUSER_PACKAGE)\"
26
27 ifdef SUPERUSER_PACKAGE_PREFIX
28   LOCAL_CFLAGS += -DREQUESTOR_PREFIX=\"$(SUPERUSER_PACKAGE_PREFIX)\"
29 endif
30
31 ifdef SUPERUSER_EMBEDDED
32   LOCAL_CFLAGS += -DSUPERUSER_EMBEDDED
33 endif
34
35 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
36 include $(BUILD_EXECUTABLE)
37
38
39 SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,su)
40 $(SYMLINKS):
41         @echo "Symlink: $@ -> /system/xbin/su"
42         @mkdir -p $(dir $@)
43         @rm -rf $@
44         $(hide) ln -sf ../xbin/su $@
45
46 # We need this so that the installed files could be picked up based on the
47 # local module name
48 ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
49     $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
50
51 ifdef SUPERUSER_EMBEDDED
52
53 # make sure init.superuser.rc is imported from
54 # init.rc or similar
55
56 SUPERUSER_RC := $(TARGET_ROOT_OUT)/init.superuser.rc
57 $(SUPERUSER_RC): $(LOCAL_PATH)/init.superuser.rc | $(ACP)
58         $(copy-file-to-new-target)
59
60 SUPERUSER_MARKER := $(TARGET_OUT_ETC)/.has_su_daemon
61 $(SUPERUSER_MARKER): $(LOCAL_INSTALLED_MODULE)
62         @mkdir -p $(dir $@)
63         @rm -rf $@
64         $(hide) touch $@
65
66 ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
67     $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SUPERUSER_RC) $(SUPERUSER_MARKER)
68
69 endif