一个Makefile
CC = g++ CCFLAGS = -O3 -DNDEBUG INC = -I ../../include SRC = $(wildcard *.cpp) OBJ = $(patsubst %.cpp,%.o, $(SRC)) .PHONY: all clean all: $(OBJ) lib .cpp.o: $(CC) $(CCFLAGS) -c -o $@ $< $(INC) lib: ar rcs libbob.a *.o clean: rm -rf libbob.a *.o