gcc -lpthread -o file file.c
在Linux下,用交叉编译器编译一个在uclinux下运行的多线程程序,makefile文件如下:
引用:CFLAGS = -Wall -Os -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED
LDFLAGS =-Wl,-elf2flt
LOCAL_LIBS = /usr/local/arm-elf/lib/libpthread.a
CC = arm-elf-gcc
LD = arm-elf-gcc
TARGT = test
OBJ = $(TARGT).o
SRC = $(TARGT).c
all: $(TARGT)
%.o:%.c
$(CC) $(CFLAGS) -c $< -o $@
$(TARGT) :$(OBJ) $(LOCAL_LIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LOCAL_LIBS) $(LDLIBS)
clean:
-rm -f $(EXEC) *.elf *.gdb *.o
litanhua 于 2008-04-07 12:15:56发表:
很好,很强大!
zha2530 于 2008-04-07 09:35:27发表:
学习了。谢谢楼主