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
27LOCAL_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
33LOCAL_SYSTEM_SHARED_LIBRARIES := libc
34
35LOCAL_C_INCLUDES := $(LOCAL_PATH)/src
36
37# Additional flags first...
38LOCAL_CFLAGS += \
39    -DMKSH_DEFAULT_PROFILEDIR=\"/system/etc\" \
40    -DMKSHRC_PATH=\"/system/etc/mkshrc\" \
41    -DMKSH_DEFAULT_EXECSHELL=\"/system/bin/sh\" \
42    -DMKSH_DEFAULT_TMPDIR=\"/data/local\" \
43
44# ...then from Makefrag.inc: CFLAGS...
45LOCAL_CFLAGS += \
46    -Wno-deprecated-declarations \
47    -fno-asynchronous-unwind-tables \
48    -fno-strict-aliasing \
49    -fstack-protector -fwrapv \
50
51# ...and CPPFLAGS.
52LOCAL_CFLAGS += \
53    -DDEBUG_LEAKS -DMKSH_ASSUME_UTF8 -DMKSH_CONSERVATIVE_FDS \
54    -DMKSH_DONT_EMIT_IDSTRING -DMKSH_NOPWNAM -DMKSH_BUILDSH \
55    -D_GNU_SOURCE -DSETUID_CAN_FAIL_WITH_EAGAIN \
56    -DHAVE_ATTRIBUTE_BOUNDED=0 -DHAVE_ATTRIBUTE_FORMAT=1 \
57    -DHAVE_ATTRIBUTE_NORETURN=1 \
58    -DHAVE_ATTRIBUTE_PURE=1 \
59    -DHAVE_ATTRIBUTE_UNUSED=1 \
60    -DHAVE_ATTRIBUTE_USED=1 -DHAVE_SYS_TIME_H=1 -DHAVE_TIME_H=1 \
61    -DHAVE_BOTH_TIME_H=1 -DHAVE_SYS_BSDTYPES_H=0 \
62    -DHAVE_SYS_FILE_H=1 -DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_MMAN_H=1 \
63    -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_RESOURCE_H=1 \
64    -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SYSMACROS_H=1 \
65    -DHAVE_BSTRING_H=0 -DHAVE_GRP_H=1 -DHAVE_IO_H=0 -DHAVE_LIBGEN_H=1 \
66    -DHAVE_LIBUTIL_H=0 -DHAVE_PATHS_H=1 -DHAVE_STDINT_H=1 \
67    -DHAVE_STRINGS_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_ULIMIT_H=0 \
68    -DHAVE_VALUES_H=0 -DHAVE_CAN_INTTYPES=1 -DHAVE_CAN_UCBINTS=1 \
69    -DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 -DHAVE_RLIM_T=1 \
70    -DHAVE_SIG_T=1 -DHAVE_SYS_ERRLIST=0 -DHAVE_SYS_SIGNAME=1 \
71    -DHAVE_SYS_SIGLIST=1 -DHAVE_FLOCK=1 -DHAVE_LOCK_FCNTL=1 \
72    -DHAVE_GETRUSAGE=1 \
73    -DHAVE_GETSID=1 \
74    -DHAVE_GETTIMEOFDAY=1 \
75    -DHAVE_ISSETUGID=0 \
76    -DHAVE_KILLPG=1 \
77    -DHAVE_MEMMOVE=1 -DHAVE_MKNOD=0 -DHAVE_MMAP=1 -DHAVE_NICE=1 \
78    -DHAVE_REVOKE=0 -DHAVE_SETLOCALE_CTYPE=0 \
79    -DHAVE_LANGINFO_CODESET=0 -DHAVE_SELECT=1 -DHAVE_SETRESUGID=1 \
80    -DHAVE_SETGROUPS=1 -DHAVE_STRERROR=1 -DHAVE_STRSIGNAL=0 \
81    -DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
82    -DHAVE_SYS_ERRLIST_DECL=0 -DHAVE_SYS_SIGLIST_DECL=1 \
83    -DHAVE_PERSISTENT_HISTORY=0 -DMKSH_BUILD_R=521
84
85include $(BUILD_EXECUTABLE)
86