自己总结的 Makefile 小模板

all:commtest
CFLAGS=-fPIC -g -Wall
ARIA_INCLUDE=-I/usr/local/Aria/include
ARIA_LINK=-L/usr/local/Aria/lib -lAria -lpthread -ldl -lrt

%: %.cpp
    $(CXX) $(CFLAGS) $(ARIA_INCLUDE) $< -o $@ $(ARIA_LINK)
.PHONY:clean
clean:
    rm -f commtest
all:test
CFLAGS=-Wall
OPENCV_INCLUDE=-I/usr/local/include/opencv
%:%.cpp
     g++ `pkg-config opencv --libs` $(OPENCV_INCLUDE) $< -o $@
.PHONY:clean
clean:
    rm -f test

你可能感兴趣的:(模板,makefile)