Skip to content

Instantly share code, notes, and snippets.

@hsavit1
Forked from zachwhaley/Makefile
Created April 2, 2016 21:55
Show Gist options
  • Save hsavit1/a2ca27f7b1cf8356de51260c3fcadac3 to your computer and use it in GitHub Desktop.
Save hsavit1/a2ca27f7b1cf8356de51260c3fcadac3 to your computer and use it in GitHub Desktop.
Simple C++ Makefile
CXXFLAGS = -g -Wall -Werror -std=c++11
LDLIBS =
PRGM = project
SRCS := $(wildcard *.cpp)
OBJS := $(SRCS:.cpp=.o)
DEPS := $(OBJS:.o=.d)
.PHONY: all clean
all: $(PRGM)
$(PRGM): $(OBJS)
$(CXX) $(OBJS) $(LDLIBS) -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
clean:
rm -rf $(OBJS) $(DEPS) $(PRGM)
-include $(DEPS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment