Skip to content

Commit

Permalink
Add makefile template.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinamatthews committed Jul 28, 2017
1 parent acb5f75 commit 6695140
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions makefile_template/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
################################################################################
# Fill these out for your own project
################################################################################

# The name of your executable
PROGRAM:=

# A good default
CXX:=g++

# Add whatever flags you need
CXXFLAGS:=-std=c++11

# Add whatever flags or external libraries you need
LDFLAGS:=-Wl,-rpath,$(CONDA_PREFIX)/lib

################################################################################
# From here on is "boilerplate" alter at your own risk
################################################################################

SOURCES:=$(shell find . -iname "*.cxx" -o -iname "*.cpp" -o -iname "*.cc")
OBJECTS:=$(addsuffix .o, $(basename $(SOURCES))))

all: $(PROGRAM)

%.cxx: %.o
$(CXX) -c -o $@ $^ $(CXXFLAGS)

%.cpp: %.o
$(CXX) -c -o $@ $^ $(CXXFLAGS)

%.cc: %.o
$(CXX) -c -o $@ $^ $(CXXFLAGS)

$(PROGRAM): $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)

clean:
find . -name '*.o' -delete
rm -f $(PROGRAM)

0 comments on commit 6695140

Please sign in to comment.