Skip to content

Instantly share code, notes, and snippets.

@kisielk
Last active August 29, 2015 14:17
Show Gist options
  • Save kisielk/94273dba2da92e9c5c4b to your computer and use it in GitHub Desktop.
Save kisielk/94273dba2da92e9c5c4b to your computer and use it in GitHub Desktop.
include ../Makefile.inc
# Paths to gtest libraries
GTEST_HOME=../third_party/gtest-1.7.0
FUSED_GTEST_DIR = $(GTEST_HOME)/fused-src
FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h
FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc
GTEST_MAIN_CC = $(GTEST_HOME)/src/gtest_main.cc
CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0
CXXFLAGS += -g -std=c++11
TESTS=$(wildcard *_test.cc)
all : unittest
test : all
./unittest
clean :
rm -rf unittest *.o
gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc
gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC)
%.o : %.cc *.h $(FUSED_GTEST_H)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
unittest : $(TESTS:.cc=.o) gtest-all.o gtest_main.o
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment