Makefile一次编译多个独立.cpp文件和.h文件

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

猜你喜欢

转载自blog.csdn.net/weixin_44029550/article/details/109478456