How to run shell commands in Android.mk file?

5,178 views
Skip to first unread message

Uma Sankar

unread,
Jun 9, 2010, 7:33:17 AM6/9/10
to android-porting
Hi All,

I would like to run some shell commands after building my module
can I make Android.mk to run shell script ?

For example,
I need to copy data.txt file in to LOCAL_MODULE_PATH after build the
application. By using the Android.mk file application(server) is able
to generated at specified folder but I don't know how to make a entry
in Android.mk file to copy the data.txt file into specified path. My
Android.mk is given below.

ifneq ($(TARGET_SIMULATOR),true)
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_SRC_FILES:= thserv.c readln.c writened.c
LOCAL_CFLAGS += -D_LINUX
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
LOCAL_STATIC_LIBRARIES := libcutils libc
LOCAL_SHARED_LIBRARIES := libutils
LOCAL_MODULE := server
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_EXECUTABLES_UNSTRIPPED)
LOCAL_LDLIBS := -lpthread -lrt
include $(BUILD_EXECUTABLE)

endif # TARGET_SIMULATOR != true

my data.txt is present where my source code is present.
Any idea how data.txt copy to destination folder after compilation of
application?

Thanks

Deva R

unread,
Jun 9, 2010, 8:44:57 AM6/9/10
to tammana....@gmail.com, android-porting

bridgette

unread,
Jun 9, 2010, 10:37:43 AM6/9/10
to android-porting
might try the mm command

how I have used it is as follows:

$ cd <to the specific directory of your Android.mk>
$ source $ANDROID_HOME/build/envsetup.sh
$ mm TARGET_PRODUCT=<target> (or you can leave blank if using the
emulator)

then open the adb shell and cd to where they are and run them.

hopefully that might help...

p.s
I tried replying to your message on the android-ndk group but it seems
that I was banned when I replied...if anyone knows how I can get that
resolved please let me know. Thanks.
Reply all
Reply to author
Forward
0 new messages