Skip to content

Instantly share code, notes, and snippets.

@nkoneko
Created February 20, 2014 19:51
Show Gist options
  • Save nkoneko/9121825 to your computer and use it in GitHub Desktop.
Save nkoneko/9121825 to your computer and use it in GitHub Desktop.
CXX = g++
CFLAGS = -std=c++0x -Wall
LDFLAGS = -Llib -lboost_system -lboost_filesystem
LIBS =
INCLUDE = -Iinclude
TARGET = ./bin/$(shell basename `readlink -f .`)
SRCDIR = ./src
OBJDIR = ./build
SOURCES = $(wildcard $(SRCDIR)/*.cpp)
OBJECTS = $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SOURCES))
.PHONY: all
all: clean $(TARGET)
$(TARGET): $(OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
$(CXX) $(CFLAGS) $(INCLUDE) -o $@ -c $<
.PHONY: clean
clean:
rm -rf $(OBJDIR)
rm -f $(TARGET)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment