Skip to content

Instantly share code, notes, and snippets.

@theidexisted
Created June 13, 2015 10:10
Show Gist options
  • Save theidexisted/09dc1710ff3b049c793f to your computer and use it in GitHub Desktop.
Save theidexisted/09dc1710ff3b049c793f to your computer and use it in GitHub Desktop.
CC = g++
BINDIR = ./bin
CFLAGS = -c -g -O0 -std=c++11 -I../include
LDFLAGS =
SOURCES = $(wildcard *.cc)
OBJECTS = $(SOURCES:.cc=.o)
FAKEOBJECTS = $(OBJECTS)
EXECUTABLE = $(addprefix $(BINDIR)/, $(basename $(SOURCES:.cpp=)))
.PHONY: all
all : $(BINDIR) $(OBJECTS) $(EXECUTABLE)
%.o : %.cc
$(CC) $(CFLAGS) $< -o $@
$(EXECUTABLE) :
$(CC) $(LDFLAGS) $(basename $(notdir $@)).o -o $@
$(BINDIR) :
mkdir -p $(BINDIR)
clean :
rm -f *.o $(BINDIR)/* 2> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment