Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | # A Makefile for fusing Google Test and building a sample test against it. |
michael@0 | 2 | # |
michael@0 | 3 | # SYNOPSIS: |
michael@0 | 4 | # |
michael@0 | 5 | # make [all] - makes everything. |
michael@0 | 6 | # make TARGET - makes the given target. |
michael@0 | 7 | # make check - makes everything and runs the built sample test. |
michael@0 | 8 | # make clean - removes all files generated by make. |
michael@0 | 9 | |
michael@0 | 10 | # Points to the root of fused Google Test, relative to where this file is. |
michael@0 | 11 | FUSED_GTEST_DIR = output |
michael@0 | 12 | |
michael@0 | 13 | # Paths to the fused gtest files. |
michael@0 | 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h |
michael@0 | 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc |
michael@0 | 16 | |
michael@0 | 17 | # Where to find the sample test. |
michael@0 | 18 | SAMPLE_DIR = ../../samples |
michael@0 | 19 | |
michael@0 | 20 | # Where to find gtest_main.cc. |
michael@0 | 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc |
michael@0 | 22 | |
michael@0 | 23 | # Flags passed to the preprocessor. |
michael@0 | 24 | # We have no idea here whether pthreads is available in the system, so |
michael@0 | 25 | # disable its use. |
michael@0 | 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 |
michael@0 | 27 | |
michael@0 | 28 | # Flags passed to the C++ compiler. |
michael@0 | 29 | CXXFLAGS += -g |
michael@0 | 30 | |
michael@0 | 31 | all : sample1_unittest |
michael@0 | 32 | |
michael@0 | 33 | check : all |
michael@0 | 34 | ./sample1_unittest |
michael@0 | 35 | |
michael@0 | 36 | clean : |
michael@0 | 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o |
michael@0 | 38 | |
michael@0 | 39 | $(FUSED_GTEST_H) : |
michael@0 | 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) |
michael@0 | 41 | |
michael@0 | 42 | $(FUSED_GTEST_ALL_CC) : |
michael@0 | 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) |
michael@0 | 44 | |
michael@0 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) |
michael@0 | 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc |
michael@0 | 47 | |
michael@0 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) |
michael@0 | 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) |
michael@0 | 50 | |
michael@0 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h |
michael@0 | 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc |
michael@0 | 53 | |
michael@0 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ |
michael@0 | 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) |
michael@0 | 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc |
michael@0 | 57 | |
michael@0 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o |
michael@0 | 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ |