OSDN Git Service

Disable su binary version checking
[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 := eng debug 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 ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
47
48 # We need this so that the installed files could be picked up based on the
49 # local module name
50 ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
51     $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
52
53 ifdef SUPERUSER_EMBEDDED
54
55 # make sure init.superuser.rc is imported from
56 # init.rc or similar
57
58 SUPERUSER_RC := $(TARGET_ROOT_OUT)/init.superuser.rc
59 $(SUPERUSER_RC): $(LOCAL_PATH)/init.superuser.rc | $(ACP)
60         $(copy-file-to-new-target)
61
62 SUPERUSER_MARKER := $(TARGET_OUT_ETC)/.has_su_daemon
63 $(SUPERUSER_MARKER): $(LOCAL_INSTALLED_MODULE)
64         @mkdir -p $(dir $@)
65         @rm -rf $@
66         $(hide) touch $@
67
68 ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
69     $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SUPERUSER_RC) $(SUPERUSER_MARKER)
70
71 endif