michael@0: # A Makefile for fusing Google Test and building a sample test against it. michael@0: # michael@0: # SYNOPSIS: michael@0: # michael@0: # make [all] - makes everything. michael@0: # make TARGET - makes the given target. michael@0: # make check - makes everything and runs the built sample test. michael@0: # make clean - removes all files generated by make. michael@0: michael@0: # Points to the root of fused Google Test, relative to where this file is. michael@0: FUSED_GTEST_DIR = output michael@0: michael@0: # Paths to the fused gtest files. michael@0: FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h michael@0: FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc michael@0: michael@0: # Where to find the sample test. michael@0: SAMPLE_DIR = ../../samples michael@0: michael@0: # Where to find gtest_main.cc. michael@0: GTEST_MAIN_CC = ../../src/gtest_main.cc michael@0: michael@0: # Flags passed to the preprocessor. michael@0: # We have no idea here whether pthreads is available in the system, so michael@0: # disable its use. michael@0: CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 michael@0: michael@0: # Flags passed to the C++ compiler. michael@0: CXXFLAGS += -g michael@0: michael@0: all : sample1_unittest michael@0: michael@0: check : all michael@0: ./sample1_unittest michael@0: michael@0: clean : michael@0: rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o michael@0: michael@0: $(FUSED_GTEST_H) : michael@0: ../fuse_gtest_files.py $(FUSED_GTEST_DIR) michael@0: michael@0: $(FUSED_GTEST_ALL_CC) : michael@0: ../fuse_gtest_files.py $(FUSED_GTEST_DIR) michael@0: michael@0: gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) michael@0: $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc michael@0: michael@0: gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) michael@0: $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) michael@0: michael@0: sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h michael@0: $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc michael@0: michael@0: sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ michael@0: $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) michael@0: $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc michael@0: michael@0: sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o michael@0: $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@