下雪了

【Linux】一个简单的makefile模板

CXX = g++
CXXFLAGS = -std=c++17 -Wall -g

HEADERS = -I./include
SRC = ./src
LIBS = -lSDL -lSDL_draw -lSDL_image -lSDL_gfx
OBJS = $(wildcard $(SRC)/*.cpp )


TARGER = main

all:$(TARGER)

main: $(OBJS)
$(CXX) $(CXXFLAGS) $(HEADERS) $(OBJS) -o $(TARGER) $(LIBS)

clean:
rm -rf $(TARGER)

配合一下文件目录结构使用

-projectName

–include

—xxx.h

–src

—xxx.cpp

–makefile


Add Your Comment

* Indicates Required Field

Your email address will not be published.

*