C++ Makefile简单编写

TARGET = main.out

CXXFLAGS += -std=gnu++11
CC = g++
#主函数文件
# CXX_FILES := ./main.cpp

#cpp文件
SRC_DIRS := $(wildcard *.cpp  ./plugin/*.cpp)
SRC_DIRS += $(wildcard *.cpp  ./*.cpp)

# INC_DIRS := -I ./plugin
INC_DIRS := -I ./include

LIBS += -lstdc++
# LIBS += -ldl -lpthread


$(TARGET): $(SRC_DIRS) 
	$(info target: $@)
	$(info all: $^)
	$(info first: $<)
	$(info SRC_DIRS_all: $(SRC_DIRS))
	$(CC) -o $@ $^ $(INC_DIRS) $(CXXFLAGS) $(LIBS)


.PHONY:clean
clean:
	rm -rf $(TARGET)

你可能感兴趣的:(C++,c++,开发语言)