Skip to content

Instantly share code, notes, and snippets.

@harry830622
Created January 4, 2017 14:27
Show Gist options
  • Save harry830622/56f2e4faab7147703f7c7cecd45d1f78 to your computer and use it in GitHub Desktop.
Save harry830622/56f2e4faab7147703f7c7cecd45d1f78 to your computer and use it in GitHub Desktop.
Makefile template
EXE = mp
CXX = clang++
CXXFLAGS = -std=c++11 -O2 -Wall
CPPS := $(wildcard src/*.cpp)
OBJS := $(addprefix obj/,$(notdir $(CPPS:.cpp=.o)))
.PHONY: all clean
all: obj $(EXE)
obj:
mkdir $@
$(EXE): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^
obj/%.o: src/%.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $^
clean:
rm $(EXE) $(OBJS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment