The day before yesterday, I completed the ndk development environment and made JNI
Development and testing. Because ndk development is not used in the actual project, I don't know what to do next. Think of the
The interaction program of command is compiled in the android source code using Android. mk. I always wanted to write the make file and compile it independently from the android source code.
C/C ++.
That's the beginning! The cross compiler uses the ndk.
Paste makefile first.
View plain
Copy to clipboard
Print
?
- Cc =/work/tool/android-ndk-r5/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/ARM-Eabi-gcc
- Pre-Path =/work/tool/android-ndk-r5/platforms/Android-8/arch-arm/usr
- Lib = $ (pre-path)/lib
- Ic = $ (pre-path)/include
- Extra_objs: = $ (pre-path)/lib/crtend_android.o $ (pre-path)/lib/crtbegin_static.o
- Ldflags + =-nostdlib
- Ldflags + =-LC-LDL-bdynamic-wl,-dynamic-linker,/system/bin/linker
- Shard: shard. o
- $ (CC) $ (ldflags) $ (extra_objs)-g-O0-wall-STD = c99-I $ (IC)-L $ (LIB)-O shard. o
- Shard. O: shard. c
- $ (CC)-I $ (IC)-L $ (LIB)-C shard. c
- . Phony: clean
- Clean:
- Rm shard. o
Cc =/work/tool/android-ndk-r5/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/ARM-Eabi-GCC <br/> pre-Path =/work/tool/android-ndk-r5/platforms /Android-8/arch-arm/usr <br/> lib =$ (pre-path) /lib <br/> Ic = $ (pre-path)/include <br/> extra_objs: = $ (pre-path)/lib/crtend_android.o $ (pre-path) /lib/crtbegin_static.o <br/> ldflags + =-nostdlib <br/> ldflags + =-LC-LDL-bdynamic-wl,-dynamic-linker, /system/bin/linker <br/> shard: shard. O <br/> $ (CC) $ (ldflags) $ (extra_objs)-g-O0-wall-STD = c99-I $ (IC)-L $ (LIB) -O shard. O <br/> shard. o: shard. c <br/> $ (CC)-I $ (IC)-L $ (LIB)-C shard. c <br/>. phony: Clean <br/> clean: <br/> RM shard. O
C file is very simple
View plain
Copy to clipboard
Print
?
- # Include <string. h>
- # Include <stdio. h>
- Static
Char
* S_string =
"I'm Hui '/N' my mailbox lzh20044178@163.com"
;
- Int
Main ()
- {
- Printf ("% S/N"
, S_string );
- Return
0;
- }
# Include <string. h> <br/> # include <stdio. h> <br/> static char * s_string = "I'm Hui '/N' my mailbox lzh20044178@163.com"; <br/> int main () <br/>{< br/> printf ("% s/n", s_string); <br/> return 0; <br/>}
For more information about makefile parameters, see
Http://blog.csdn.net/lzh20044178/archive/2011/02/16/6188515.aspx
Of
2.3 Study Hard
How to Write makefile e-books
Http://pipi.googlecode.com/files/How%20to%20Write%20makefile.pdf
Run:
Makefile files are very powerful. continue learning.