写一份拷贝放这,供参考。
CC=g++
CFLAGS=-g -c
DFLAGS=-lpthread
SRC=${shell ls *.cpp}
OBJ=${SRC:%.cpp=%.o}
BIN=test
.PHONY: ${BIN} ${OBJ} clean
${BIN}: ${OBJ}
${CC} ${DFLAGS} -o ${BIN} ${OBJ}
${OBJ}:%.o:%.cpp
${CC} ${CFLAGS} $< -o $@
clean:
rm -fr ${BIN} ${OBJ}