Skip to content

Commit

Permalink
Add benchmark testing to makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvasz committed Jan 1, 2012
1 parent 92b4c47 commit 866e8e5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ boost/

# coverage files
*.gcov

# input test data
inputs/
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
# List objects in order of DEPENDENCY. For example, if obj/main.o depends on
# obj/matrix.o, list obj/matrix.o first.
OBJS = obj/main.o
EXE = bin/main
TESTOBJS = obj/array_hash_test.o
TESTEXE = bin/test

# make variables
OFLAGS = -O0
OFLAGS = -O2
CXX = /opt/llvm/bin/clang++
CXXFLAGS = -Wall -c $(OFLAGS)
CXXFLAGS = -Wall -c
LDFLAGS = -lboost_unit_test_framework-mt -lprofile_rt -L/opt/llvm/lib

COMPILE.cpp = $(CXX) $(CXXFLAGS)

all: test
all: main

main: $(OBJS)
$(CXX) $(OFLAGS) $(OBJS) -o $(EXE)

time: main
time bin/main < inputs/kjv

test: $(TESTOBJS)
$(CXX) $(OFLAGS) $(TESTOBJS) -o $(TESTEXE) $(LDFLAGS)
$(CXX) $(TESTOBJS) -o $(TESTEXE) $(LDFLAGS)
./$(TESTEXE)

cover: $(TESTOBJS)
Expand All @@ -24,13 +32,13 @@ cover: $(TESTOBJS)
rm `ls *.gcov | grep -v array_hash.h.gcov`

obj/%.o: src/%.cpp
$(COMPILE.cpp) -o $@ $<
$(COMPILE.cpp) $(OFLAGS) -o $@ $<

obj/%.o: test/%.cpp
$(COMPILE.cpp) --coverage -o $@ $<

clean:
rm -f $(OBJECTS) $(EXE)
rm -f $(OBJS) $(EXE)
rm -f $(TESTOBJS) $(TESTEXE)

depend:
Expand All @@ -49,3 +57,4 @@ depend:
# makedepend src/*.cpp
# ... then change src/*.o in this Makefile to obj/*.o.
obj/array_hash_test.o: src/array_hash.h test/array_hash_test.cpp
obj/main.o: src/array_hash.h src/main.cpp
4 changes: 1 addition & 3 deletions src/array_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ class array_hash_traits
*/

template <class T>
class array_hash
{
};
class array_hash { };

/**
* Hash table container for unsorted strings.
Expand Down

0 comments on commit 866e8e5

Please sign in to comment.