Programming/안드로이드
Android NDK - toolchain 사용 컴파일
파란크리스마스
2012. 5. 24. 15:17
728x90
출처
- http://stackoverflow.com/questions/9251747/record-rtsp-stream-with-ffmpeg-libavformat
- http://limga.tistory.com/3
- http://kaludin.egloos.com/2651893
- http://dranger.com/ffmpeg/tutorial01.html
- http://dc.csie.ntut.edu.tw/files/DC006lab.pdf
- http://www.cantgetnosleep.com/wordpress/?p=111
main.c 파일
#include <stdio.h> int main(int argc, char* argv[]) { printf("Hello Android NDK! \n"); return 0; }
Makefile 파일
TARGET = hello TOOLCHAIN = D:/Windows/cygwin/opt/android-8-toolchain CROSS = $(TOOLCHAIN)/bin/arm-linux-androideabi- INCDIR = $(TOOLCHAIN)/sysroot/usr/include LIBDIR = $(TOOLCHAIN)/sysroot/usr/lib CC = $(CROSS)gcc AR = $(CROSS)ar LD = $(CROSS)ld NM = $(CROSS)nm RANLIB = $(CROSS)ranlib STRIP = $(CROSS)strip INCLUDE = -I. -I$(INCDIR) CFLAGS = -Wall LDFLAGS = -nostdlib -Wl,--dynamic-linker,"//system/bin/linker" -L$(LIBDIR) -lc -lm -lstdc++ -ldl #LDFLAGS = -static -lc -lm -lstdc++ # crt CRTOBJ = $(LIBDIR)/crtbegin_dynamic.o # application file APPSOURCES = main.c APPOBJS = $(APPSOURCES:.c=.o) # define the rule .SUFFIXES:.c .o .c.o: @echo Compiling: $< $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< all: app app: $(APPOBJS) @echo Linking: $(TARGET) $(CC) -o $(TARGET) $(APPOBJS) $(CRTOBJ) $(LDFLAGS) $(STRIP) -s $(TARGET) clean: @rm -vf $(APPOBJS) $(TARGET)
테스트