summaryrefslogtreecommitdiffstats
path: root/sh/Android.mk
blob: dcd13d83a09578f21296e8f4133771b949c8971c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
	alias.c \
	arith.c \
	arith_lex.c \
	builtins.c \
	cd.c \
	error.c \
	eval.c \
	exec.c \
	expand.c \
	input.c \
	jobs.c \
	main.c \
	memalloc.c \
	miscbltin.c \
	mystring.c \
	nodes.c \
	options.c \
	parser.c \
	redir.c \
	show.c \
	syntax.c \
	trap.c \
	output.c \
	var.c \
	bltin/echo.c \
	init.c

LOCAL_MODULE:= ash
LOCAL_MODULE_TAGS:= shell_ash

LOCAL_CFLAGS += -DSHELL -DWITH_LINENOISE

LOCAL_STATIC_LIBRARIES := liblinenoise

LOCAL_C_INCLUDES += system/core/liblinenoise

make_ash_files: PRIVATE_SRC_FILES := $(SRC_FILES)
make_ash_files: PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
make_ash_files:
	p4 edit arith.c arith_lex.c arith.h builtins.h builtins.c 
	p4 edit init.c nodes.c nodes.h token.h 
	sh ./mktokens
	bison -o arith.c arith.y
	flex -o arith_lex.c arith_lex.l
	perl -ne 'print if ( /^\#\s*define\s+ARITH/ );' < arith.c > arith.h
	sh ./mkbuiltins shell.h builtins.def . -Wall -O2
	sh ./mknodes.sh nodetypes nodes.c.pat .
	sh ./mkinit.sh $(PRIVATE_SRC_FILES) 

include $(BUILD_EXECUTABLE)


# create /system/bin/sh symlink to $(TARGET_SHELL)
# not the optimal place for this, but a fitting one

OUTSYSTEMBINSH := $(TARGET_OUT)/bin/sh
LOCAL_MODULE := systembinsh
$(OUTSYSTEMBINSH): | $(TARGET_SHELL)
$(OUTSYSTEMBINSH): LOCAL_MODULE := $(LOCAL_MODULE)
$(OUTSYSTEMBINSH):
	@echo "Symlink: $@ -> $(TARGET_SHELL)"
	@rm -rf $@
	$(hide) ln -sf $(TARGET_SHELL) $@

ALL_DEFAULT_INSTALLED_MODULES += $(OUTSYSTEMBINSH)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(OUTSYSTEMBINSH)