本文主要是介绍交叉编译Linux SDK —— Makefile,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
CC = /home/aston/flp/dicpen_rk3326_linux/buildroot/output/rockchip_rk3326_64/host/bin/aarch64-linux-gcc
CXX = /home/aston/flp/dicpen_rk3326_linux/buildroot/output/rockchip_rk3326_64/host/bin/aarch64-linux-g++
TLINCLUDE += -I ./include
target = test
objects = a.o b.o c.o d.o e.o
CFLAGS = $(TLINCLUDE) -fPIC
TLLIBS = -L ./lib
obj = ./
**#测试demo**
all: $(target).o a.o b.o c.o d.o e.o
$(CXX) $^ $(TLLIBS) -lcurl -lssl -lcrypto -ldl -lsqlcipher -o $(target)
all: $(objects)
$(CC) $^ $(CFLAGS) $(TLLIBS) -lcurl -lssl -lcrypto -ldl -lsqlcipher -lpthread -o $(target)
$(target).o: $(target).c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
a.o: a.c
$(CC) $(CFLAGS) -c $< -o $@
b.o: b.c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
c.o: c.c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
d.o: d.c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
e.o: e.cpp
$(CXX) $(CFLAGS) -c $< -o $@
clean:
rm -rf *.o
rm -rf $(obj)*.o
rm -rf $(objects)
**#so文件**
all: $(objects)
$(CC) $^ $(CFLAGS) $(TLLIBS) -lcurl -shared -lssl -lcrypto -ldl -lsqlcipher -lpthread -o libxxx.so
a.o: a.c
$(CC) $(CFLAGS) -c $< -o $@
b.o: b.c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
c.o: c.c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
d.o: d.c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
e.o: e.cpp
$(CXX) $(CFLAGS) -c $< -o $@
clean:
rm -rf *.o
rm -rf $(obj)*.o
rm -rf $(objects)
**#调用so库**
all: $(target).o
$(CC) $^ $(CFLAGS) $(TLLIBS) -lcurl -lssl -lcrypto -ldl -lsqlcipher -lpthread -lxxx -o $(target)
$(target).o: $(target).c
$(CC) $(CFLAGS) -c $< -o $(obj)$@
clean:
rm -rf *.o
rm -rf $(obj)*.o
rm -rf test
这篇关于交叉编译Linux SDK —— Makefile的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!