blob: 8edaea065406dddb8a8f7c314c6ecc71d78040c9 [file] [log] [blame]
zhanyong.wan56fe7462009-04-09 03:01:25 +00001# A Makefile for fusing Google Mock and building a sample test against it.
2#
3# SYNOPSIS:
4#
5# make [all] - makes everything.
6# make TARGET - makes the given target.
7# make check - makes everything and runs the built sample test.
8# make clean - removes all files generated by make.
9
10# Points to the root of fused Google Mock, relative to where this file is.
11FUSED_GMOCK_DIR = output
12
13# Paths to the fused gmock files.
14FUSED_GTEST_H = $(FUSED_GMOCK_DIR)/gtest/gtest.h
15FUSED_GMOCK_H = $(FUSED_GMOCK_DIR)/gmock/gmock.h
16FUSED_GMOCK_GTEST_ALL_CC = $(FUSED_GMOCK_DIR)/gmock-gtest-all.cc
17
18# Where to find the gmock_test.cc.
19GMOCK_TEST_CC = ../../test/gmock_test.cc
20
21# Where to find gmock_main.cc.
22GMOCK_MAIN_CC = ../../src/gmock_main.cc
23
24# Flags passed to the preprocessor.
25CPPFLAGS += -I$(FUSED_GMOCK_DIR)
26
27# Flags passed to the C++ compiler.
28CXXFLAGS += -g
29
30all : gmock_test
31
32check : all
33 ./gmock_test
34
35clean :
36 rm -rf $(FUSED_GMOCK_DIR) gmock_test *.o
37
38$(FUSED_GTEST_H) :
39 ../fuse_gmock_files.py $(FUSED_GMOCK_DIR)
40
41$(FUSED_GMOCK_H) :
42 ../fuse_gmock_files.py $(FUSED_GMOCK_DIR)
43
44$(FUSED_GMOCK_GTEST_ALL_CC) :
45 ../fuse_gmock_files.py $(FUSED_GMOCK_DIR)
46
47gmock-gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GMOCK_H) $(FUSED_GMOCK_GTEST_ALL_CC)
48 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GMOCK_GTEST_ALL_CC)
49
50gmock_main.o : $(FUSED_GTEST_H) $(FUSED_GMOCK_H) $(GMOCK_MAIN_CC)
51 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GMOCK_MAIN_CC)
52
53gmock_test.o : $(FUSED_GTEST_H) $(FUSED_GMOCK_H) $(GMOCK_TEST_CC)
54 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GMOCK_TEST_CC)
55
56gmock_test : gmock_test.o gmock-gtest-all.o gmock_main.o
57 $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@