objects = test1.o
CFLAGS = -Werror '-std=c++11'
%.o : %.cpp
g++ ${CFLAGS} -c -o test1.o test1.cpp
test1:${objects}
g++ ${CFLAGS} -o test1 test1.o
.PHONY : clean
clean:
rm *.o
或者
g++ -std=c++11 -c -o test1.o test1.cpp
g++ -std=c++11 -o test1 test1.o