Created
May 22, 2014 11:48
-
-
Save clckwrkbdgr/5adf430a8925ed7d194a to your computer and use it in GitHub Desktop.
Simple makefile template for C++ project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BIN = wted | |
LIBS = -lchthon2 | |
SOURCES = $(wildcard *.cpp) | |
OBJ = $(addprefix tmp/,$(SOURCES:.cpp=.o)) | |
#WARNINGS = -pedantic -Werror -Wall -Wextra -Wformat=2 -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wuninitialized -Wunused -Wfloat-equal -Wundef -Wno-endif-labels -Wshadow -Wcast-qual -Wcast-align -Wconversion -Wsign-conversion -Wlogical-op -Wmissing-declarations -Wno-multichar -Wredundant-decls -Wunreachable-code -Winline -Winvalid-pch -Wvla -Wdouble-promotion -Wzero-as-null-pointer-constant -Wuseless-cast -Wvarargs -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=format | |
CXXFLAGS = -MD -MP -std=c++0x $(WARNINGS) | |
all: $(BIN) | |
run: $(BIN) | |
./$(BIN) | |
$(BIN): $(OBJ) | |
$(CXX) $(LIBS) -o $@ $^ | |
tmp/%.o: %.cpp | |
@echo Compiling $<... | |
@$(CXX) $(CXXFLAGS) -c $< -o $@ | |
.PHONY: clean Makefile | |
clean: | |
$(RM) -rf tmp/* $(BIN) | |
$(shell mkdir -p tmp) | |
-include $(OBJ:%.o=%.d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment