Skip to content

Instantly share code, notes, and snippets.

@mtavkhelidze
Last active November 1, 2016 08:58
Show Gist options
  • Save mtavkhelidze/40881de5463645116e16b537a5a3f5a2 to your computer and use it in GitHub Desktop.
Save mtavkhelidze/40881de5463645116e16b537a5a3f5a2 to your computer and use it in GitHub Desktop.
# Generic Makefile with deps for C++
CXX = g++
CXXFLAGS = -std=c++14 -Wall -Wextra -Werror -pedantic-errors \
-Wno-unused-const-variable -Wno-missing-braces \
-Wfatal-errors -MMD -O0 -g
SRC = $(wildcard *.cpp)
BIN = $(patsubst %.cpp,%.bin,$(SRC))
OBJ = $(SRC:.cpp=.o)
DEPS = $(SRC:.cpp=.d)
all: $(BIN)
%.bin: %.o
$(CXX) -o $@ $<
clean:
rm -fr $(BIN) $(OBJ) $(DEPS) *.dSYM
-include $(DEPS)
.PHONY: all clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment