分享一个Makefile模板
LINK = @echo linking $@ && arm-linux-gnueabihf-g++ GCC = @echo compiling $@ && arm-linux-gnueabihf-g++ GC = @echo compiling $@ && arm-linux-gnueabihf-gcc AR = @echo generating static library $@ && ar crv FLAGS = -g -DDEBUG -W -Wall -fPIC GCCFLAGS = DEFINES = HEADER = -I./ -I/usr/arm/include LIBS = -L./ -L/usr/arm/lib LINKFLAGS = LIBS += -pthread -lcrypto -lssl -lcurl -lqiniu -lm SOURCE_FILES :=\ main.cpp\ app/qiniu/qiniu.cpp\ PROJECTNAME = FireDevice.out TARGET = main all: $(SOURCE_FILES) $(LINK) $(FLAGS) $(LINKFLAGS) -o ${PROJECTNAME} $^ $(LIBS) ${HEADER} clean: rm -rf *.o ${PROJECTNAME}