Sqlite3通过Makefile编译成动态链接库

TARGET_LIB:=libsqlite3.so

LIBS  	:= -lpthread -ldl
CFLAGS  := -g -Wall -shared -fPIC -I. $(LIBS)
CC		:= mipsel-openwrt-linux-gcc #交叉编译下的编译路径
STRIP	:= mipsel-openwrt-linux-strip
OBJ		:= sqlite3.o

all: $(TARGET_LIB)

$(TARGET_LIB): $(OBJ)
	@echo -e "\033[32mBuilding $(TARGET_LIB) ...\033[0m"
	$(CC) $(CFLAGS) -o $(TARGET_LIB) $(OBJ)
	$(STRIP) $(TARGET_LIB)

install:
	cp $(TARGET_LIB) ../../lib/
	cp sqlite3.h ../../include/
	
clean:
	@echo -e "\033[32mCleaning $(TARGET_LIB) ...\033[0m"
	rm -rf *.o $(TARGET_LIB)


.PHONY: all clean install

你可能感兴趣的:(linux,makefile,动态库,sqlite3,交叉编译)