Makefile 一次编译多个独立cpp文件
- src/
- headers/
- *.h
- *.cpp
- makefile
# makefile
CC = g++
CPPFLAG = -Wall -g -std=c++11
TARGET = $(patsubst %.cpp, %.out, $(wildcard *.cpp))
HEADER = $(wildcard headers/*.h)
%.out : %.cpp $(HEADER)
$(CC) $(CPPFLAG) $< -o $@
.PHONY : all clean
all : $(TARGET)
clean :
rm -f *.out