Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android.mk - How to assemble and link ARM assembler files

I have some *.cpp source files and some *.s ARM assembler files I want to assemble and link in my Android.mk file (by running ndk-build script).

My Android.mk file looks like this:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE    := libTestJNI
LOCAL_SRC_FILES := Test.cpp TestAS_gas4.s 
LOCAL_CFLAGS := -DHAVE_CONFIG_H -DFPM_ARM -ffast-math -O3 -DOPT_ARM
LOCAL_LDLIBS    += -llog
include $(BUILD_SHARED_LIBRARY)

Unfortunately the *.s file is not recognized. ndk-build says:

Gdbserver      : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup       : libs/armeabi/gdb.setup
make: *** No rule to make target `/cygdrive/c/projects/TestAS_gas4.s', needed by `/cygdrive/c/projects/obj/local/armeabi/objs-debug/libTestJNI/TestAS_gas4.o'.  Stop.

In a "normal" makefile I would have to assemble by using "as" in a rule. How is it done in the Android.mk files?

/Kim

like image 960
Kim Avatar asked Jan 13 '11 14:01

Kim


People also ask

Where do I put Android MK files?

The Android.mk file resides in a subdirectory of your project's jni/ directory, and describes your sources and shared libraries to the build system. It is really a tiny GNU makefile fragment that the build system parses once or more.

What is Ndk_project_path?

NDK_PROJECT_PATH - the location of your project NDK_APPLICATION_MK - the path of the Application.mk file APP_BUILD_SCRIPT - the path to the Android.mk file. These are needed to override the default values of the build script, which expects things to be in the jni folder.

What is NDK build?

The Native Development Kit (NDK) is a set of tools that allows you to use C and C++ code with Android and provides platform libraries you can use to manage native activities.


1 Answers

This is embarrasing but the problem was that the *.s files where located in a subfolder. The "No rule to make target" error is a very poor error description in this case.

/Kim

like image 163
Kim Avatar answered Sep 23 '22 13:09

Kim