Skip to content

Instantly share code, notes, and snippets.

@keuv-grvl
Last active January 27, 2017 14:55
Show Gist options
  • Save keuv-grvl/92f0e22e769dec533a8e69344777cc7c to your computer and use it in GitHub Desktop.
Save keuv-grvl/92f0e22e769dec533a8e69344777cc7c to your computer and use it in GitHub Desktop.
makefile for MaxBin 2.2.1 (with help from @Celforyon)
# usage: make -f maxbin.makefile
# Config
DEBUG := 0
BUILDDIR := build
# End config
CXX := g++
CXXFLAGS := -MMD -Wall -Wextra -ansi -pedantic -std=c++11
LDFLAGS := -lpthread
INC := -I.
SOURCES := $(wildcard *.cpp)
OBJECTS := $(SOURCES:%.cpp=$(BUILDDIR)/%.o)
EXECUTABLE := MaxBin
ifneq ($(DEBUG),0)
CXXFLAGS += -g -O0
else
CXXFLAGS += -O3
endif
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)
$(BUILDDIR)/%.o: %.cpp
mkdir -p $(BUILDDIR)
$(CXX) $(CXXFLAGS) $(INC) -o $@ -c $<
clean:
rm -r $(BUILDDIR) $(EXECUTABLE)
DEPS := $(OBJECTS:.o=.d)
-include $(DEPS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment