1# Copyright © 2010, 2013 2# Thorsten Glaser <t.glaser@tarent.de> 3# This file is provided under the same terms as mksh. 4 5LOCAL_PATH := $(call my-dir) 6 7 8# /system/etc/mkshrc 9 10include $(CLEAR_VARS) 11 12LOCAL_MODULE := mkshrc 13LOCAL_MODULE_CLASS := ETC 14LOCAL_MODULE_PATH := $(TARGET_OUT)/etc 15LOCAL_SRC_FILES := $(LOCAL_MODULE) 16include $(BUILD_PREBUILT) 17 18 19# /system/bin/sh 20 21include $(CLEAR_VARS) 22 23LOCAL_MODULE := sh 24LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk 25 26# mksh source files 27MKSH_SRC_FILES := \ 28 src/lalloc.c src/edit.c src/eval.c src/exec.c \ 29 src/expr.c src/funcs.c src/histrap.c src/jobs.c \ 30 src/lex.c src/main.c src/misc.c src/shf.c \ 31 src/syn.c src/tree.c src/var.c 32 33MKSH_INCLUDES := $(LOCAL_PATH)/src 34 35MKSH_CFLAGS += \ 36 -Wno-deprecated-declarations \ 37 -fno-asynchronous-unwind-tables \ 38 -fno-strict-aliasing \ 39 -fstack-protector -fwrapv \ 40 41# ...and CPPFLAGS. 42MKSH_CFLAGS += \ 43 -DDEBUG_LEAKS -DMKSH_ASSUME_UTF8 \ 44 -DMKSH_DONT_EMIT_IDSTRING \ 45 -DMKSH_BUILDSH \ 46 -D_GNU_SOURCE -DSETUID_CAN_FAIL_WITH_EAGAIN \ 47 -DHAVE_ATTRIBUTE_BOUNDED=0 -DHAVE_ATTRIBUTE_FORMAT=1 \ 48 -DHAVE_ATTRIBUTE_NORETURN=1 \ 49 -DHAVE_ATTRIBUTE_PURE=1 \ 50 -DHAVE_ATTRIBUTE_UNUSED=1 \ 51 -DHAVE_ATTRIBUTE_USED=1 -DHAVE_SYS_TIME_H=1 -DHAVE_TIME_H=1 \ 52 -DHAVE_BOTH_TIME_H=1 -DHAVE_SYS_BSDTYPES_H=0 \ 53 -DHAVE_SYS_FILE_H=1 -DHAVE_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\ 76 -DHAVE_PERSISTENT_HISTORY=0 -DMKSH_BUILD_R=551 77 78LOCAL_SRC_FILES := $(MKSH_SRC_FILES) 79 80LOCAL_SYSTEM_SHARED_LIBRARIES := libc 81 82LOCAL_C_INCLUDES := $(MKSH_INCLUDES) 83 84# Additional flags first... 85LOCAL_CFLAGS += \ 86 -DMKSH_DEFAULT_PROFILEDIR=\"/system/etc\" \ 87 -DMKSHRC_PATH=\"/system/etc/mkshrc\" \ 88 -DMKSH_DEFAULT_EXECSHELL=\"/system/bin/sh\" \ 89 -DMKSH_DEFAULT_TMPDIR=\"/data/local\" \ 90 91LOCAL_CFLAGS += $(MKSH_CFLAGS) 92 93include $(BUILD_EXECUTABLE) 94 95# /vendor/etc/mkshrc 96include $(CLEAR_VARS) 97 98LOCAL_MODULE := mkshrc_vendor 99LOCAL_MODULE_STEM := mkshrc 100LOCAL_MODULE_CLASS := ETC 101LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC) 102LOCAL_SRC_FILES := $(LOCAL_MODULE) 103include $(BUILD_PREBUILT) 104 105# /vendor/bin/sh 106include $(CLEAR_VARS) 107 108LOCAL_MODULE := sh_vendor 109LOCAL_MODULE_STEM := sh 110LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk 111LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) 112 113# mksh source files 114LOCAL_SRC_FILES := $(MKSH_SRC_FILES) 115 116LOCAL_C_INCLUDES := $(MKSH_INCLUDES) 117 118# Additional flags first... 119LOCAL_CFLAGS += \ 120 -DMKSH_DEFAULT_PROFILEDIR=\"/vendor/etc\" \ 121 -DMKSHRC_PATH=\"/vendor/etc/mkshrc\" \ 122 -DMKSH_DEFAULT_EXECSHELL=\"/vendor/bin/sh\" \ 123 -DMKSH_DEFPATH_OVERRIDE=\"/vendor/bin:/vendor/xbin\" \ 124 125LOCAL_CFLAGS += $(MKSH_CFLAGS) 126 127include $(BUILD_EXECUTABLE) 128 129MKSH_SRC_FILES:= 130MKSH_CFLAGS:= 131MKSH_INCLUDES:= 132