# -MT specifies the dependency target (path qualified obj file name)ĭEP_FLAGS = -MT -MMD -MP -MF $ =.d ) STD_FLAGS = -std =c++14 -pthread -fno-rtti WARN_FLAGS = -Wall -Werror CXXFLAGS = $(STD_FLAGS) $(DEP_FLAGS) $(WARN_FLAGS) LDFLAGS = $(STD_FLAGS) $(WARN_FLAGS) # Things to buildīIN_TARGET = $(BIN_DIR)/ $(TARGET) CPP_FILES := $( wildcard $(SRC_DIR)/ *.cpp ) OBJ_FILES := $ (CPP_FILES: $(SRC_DIR)/%.cpp = $(INT_DIR)/%.o ) DEP_FILES := $ (CPP_FILES: $(SRC_DIR)/%.cpp = $(INT_DIR)/%.d ) # Rules on how to build # -MP creates phony targets for headers (deals with deleted headers after # -MF specifies where to create the dependency file name # -MMD creates dependency list, but ignores system includes SUFFIXES : # Cancel source control implicit rules (otherwise visible in 'make -d') Sample # Delete the default suffixes (otherwise visible in 'make -d') It handles incremental builds (using compiler generated dependency files).It uses a separate tmp/build folder for the build artefacts like object files.It assumes the source code are all the cpp files in the src folder. It builds a single executable into a bin folder.This is a sample makefile I’m using when I create a C++ toy project that only 09 June 2016 Starter C++ Project makefileĮxample of initial makefile for a simple C++ toy project Introduction
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |