系统相关
首页 > 系统相关> > 交叉编译Linux SDK —— Makefile

交叉编译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

标签:obj,target,CC,Makefile,rf,CFLAGS,Linux,rm,SDK
来源: https://blog.csdn.net/qq_38958704/article/details/120223885