如何让makefile支持多线程
1个回答
展开全部
在Linux下编译个多线程命令为:
gcc -lpthread -o file file.c
在Linux下用交叉编译器编译个在uc下运行多线程makefile文件如下:
CFLAGS = -Wall -Os -D -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
gcc -lpthread -o file file.c
在Linux下用交叉编译器编译个在uc下运行多线程makefile文件如下:
CFLAGS = -Wall -Os -D -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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询