Skip to content

Instantly share code, notes, and snippets.

@cdrini
Last active August 29, 2015 14:15
Show Gist options
  • Save cdrini/d1b6bce4a7bef8feafd5 to your computer and use it in GitHub Desktop.
Save cdrini/d1b6bce4a7bef8feafd5 to your computer and use it in GitHub Desktop.
General C++ Makefile (based on CS246 teachings)
CXX = g++
CXXFLAGS = -std=c++11 -Wall -MMD -g
#Wall: Shows all warnings
#MMD: Creates dependency files
#g: Necessary when using gdb for debugging
OBJECTS = main.o
DEPENDS = ${OBJECTS:.o=.d}
EXEC = exec
${EXEC}: ${OBJECTS}
${CXX} ${CXXFLAGS} ${OBJECTS} -o ${EXEC}
-include ${DEPENDS}
.PHONY: clean
clean:
rm ${OBJECTS} ${DEPENDS} ${EXEC}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment