求makefile写法 生成动态库的

dhh123456789 2013-05-31 11:49:43
这是我的makefile


CC := mipsel-linux-gcc
LD := ld
CFLAGS :=
LDFLAGS := -shared -fpic
SOURCE := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(SOURCE))
TARGET_LIB := qrencode.so

all:$(OBJS)
echo $(OBJS)
$(LD) $(LDFLAGS) -o $(TARGET_LIB) $(OBJS)

%.o:%.c
@echo Compiling $< ...
$(CC) -c $(CFLAGS) $< -o $*.o

.PHONY: clean

clean:
rm *.so *.o -rf


我make之后
Compiling bitstream.c ...
mipsel-linux-gcc -c bitstream.c -o bitstream.o
Compiling mask.c ...
mipsel-linux-gcc -c mask.c -o mask.o
Compiling mmask.c ...
mipsel-linux-gcc -c mmask.c -o mmask.o
Compiling mqrspec.c ...
mipsel-linux-gcc -c mqrspec.c -o mqrspec.o
Compiling qrencode.c ...
mipsel-linux-gcc -c qrencode.c -o qrencode.o
Compiling qrinput.c ...
mipsel-linux-gcc -c qrinput.c -o qrinput.o
Compiling qrspec.c ...
mipsel-linux-gcc -c qrspec.c -o qrspec.o
Compiling rscode.c ...
mipsel-linux-gcc -c rscode.c -o rscode.o
Compiling split.c ...
mipsel-linux-gcc -c split.c -o split.o
echo bitstream.o mask.o mmask.o mqrspec.o qrencode.o qrinput.o qrspec.o rscode.o split.o
bitstream.o mask.o mmask.o mqrspec.o qrencode.o qrinput.o qrspec.o rscode.o split.o
ld -shared -fpic -o qrencode.so bitstream.o mask.o mmask.o mqrspec.o qrencode.o qrinput.o qrspec.o rscode.o split.o
ld: bitstream.o: Relocations in generic ELF (EM: 8)
ld: bitstream.o: Relocations in generic ELF (EM: 8)
bitstream.o: could not read symbols: File in wrong format


我用的是交叉编译 不懂什么原因 我猜测是 我的代码 用到了另外个 系统动态库。 所以不行 我该怎么做呢。
...全文
300 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2013-05-31
  • 打赏
  • 举报
回复
搜“跟我一起写makefile”?

69,381

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧