Skip to content

Commit

Permalink
Improves makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
psde committed Jan 17, 2013
1 parent a799236 commit 3c40afc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
codepeiler
*.sublime-workspace
*.code
bin/*
27 changes: 21 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
OBJS = $(addsuffix .o,$(basename $(wildcard src/*.cpp)))
CXXFLAGS := -MD
# Configuration
BIN = codepeiler
BINDIR = bin
SOURCEDIR = src

# Generic makefile
SRCS = $(wildcard $(SOURCEDIR)/*.cpp)
OBJS = $(patsubst $(SOURCEDIR)/%.cpp, $(BINDIR)/%.o, $(SRCS))
DEPS = $(OBJS:.o=.d)
CXXFLAGS := #-MM
RELEASEFLAGS := -O3 -DNDEBUG $(CXXFLAGS)
DEBUGFLAGS := -O0 -g -DDEBUG -Wall -Wextra -pedantic -ansi $(CXXFLAGS)
LIBS :=
BIN = codepeiler

#-include $(OBJS:.o=.d) #$(addsufix .d, $(OBJS))
all: release

release:
$(MAKE) CXXFLAGS="$(RELEASEFLAGS)" $(BIN)

debug:
$(MAKE) CXXFLAGS="$(DEBUGFLAGS)" $(BIN)

#depend: .depend
#.depend: $(SRCS)
# $(CXX) $(CXXFLAGS) -MM $^ -MF ./.depend;
#include .depend

$(BINDIR)/%.o: $(SOURCEDIR)/%.cpp $(INCS)
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(BIN): $(OBJS)
$(CXX) -o $@ $(OBJS) $(LIBS)

.PHONY: clean
clean:
$(RM) $(BIN) $(OBJS) $(OBJS:.o=.d)

$(RM) $(BIN) $(OBJS) $(DEPS)
Empty file added bin/EMPTY
Empty file.

0 comments on commit 3c40afc

Please sign in to comment.