Linux系統(tǒng)下多線程程序編譯makefile文件
在Linux下,編譯一個(gè)多線程的程序命令為:
本文引用地址:http://cafeforensic.com/article/201609/305140.htmgcc -lpthread -o file file.c
在Linux下,用交叉編譯器編譯一個(gè)在uclinux下運(yùn)行的多線程程序,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:
評(píng)論