~ubuntu-branches/ubuntu/precise/protobuf/precise

« back to all changes in this revision

Viewing changes to gtest/make/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2009-11-16 10:41:33 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091116104133-ykhy3deg5l4975tw
Tags: 2.1.0-1ubuntu1
* Merge from Debian testing.
* Remaining Ubuntu changes:
  - Disable the death tests on IA64, now as a quilt patch.
  - Don't use python2.4, also as a quilt patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# A sample Makefile for building Google Test and using it in user
 
2
# tests.  Please tweak it to suit your environment and project.  You
 
3
# may want to move it to your project's root directory.
 
4
#
 
5
# SYNOPSIS:
 
6
#
 
7
#   make [all]  - makes everything.
 
8
#   make TARGET - makes the given target.
 
9
#   make clean  - removes all files generated by make.
 
10
 
 
11
# Please tweak the following variable definitions as needed by your
 
12
# project, except GTEST_HEADERS, which you can use in your own targets
 
13
# but shouldn't modify.
 
14
 
 
15
# Points to the root of Google Test, relative to where this file is.
 
16
# Remember to tweak this if you move this file.
 
17
GTEST_DIR = ..
 
18
 
 
19
# Where to find user code.
 
20
USER_DIR = ../samples
 
21
 
 
22
# Flags passed to the preprocessor.
 
23
CPPFLAGS += -I$(GTEST_DIR) -I$(GTEST_DIR)/include
 
24
 
 
25
# Flags passed to the C++ compiler.
 
26
CXXFLAGS += -g -Wall -Wextra
 
27
 
 
28
# All tests produced by this Makefile.  Remember to add new tests you
 
29
# created to the list.
 
30
TESTS = sample1_unittest
 
31
 
 
32
# All Google Test headers.  Usually you shouldn't change this
 
33
# definition.
 
34
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
 
35
                $(GTEST_DIR)/include/gtest/internal/*.h
 
36
 
 
37
# House-keeping build targets.
 
38
 
 
39
all : $(TESTS)
 
40
 
 
41
clean :
 
42
        rm -f $(TESTS) gtest.a gtest_main.a *.o
 
43
 
 
44
# Builds gtest.a and gtest_main.a.
 
45
 
 
46
# Usually you shouldn't tweak such internal variables, indicated by a
 
47
# trailing _.
 
48
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
 
49
 
 
50
# For simplicity and to avoid depending on Google Test's
 
51
# implementation details, the dependencies specified below are
 
52
# conservative and not optimized.  This is fine as Google Test
 
53
# compiles fast and for ordinary users its source rarely changes.
 
54
gtest-all.o : $(GTEST_SRCS_)
 
55
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest-all.cc
 
56
 
 
57
gtest_main.o : $(GTEST_SRCS_)
 
58
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest_main.cc
 
59
 
 
60
gtest.a : gtest-all.o
 
61
        $(AR) $(ARFLAGS) $@ $^
 
62
 
 
63
gtest_main.a : gtest-all.o gtest_main.o
 
64
        $(AR) $(ARFLAGS) $@ $^
 
65
 
 
66
# Builds a sample test.  A test should link with either gtest.a or
 
67
# gtest_main.a, depending on whether it defines its own main()
 
68
# function.
 
69
 
 
70
sample1.o : $(USER_DIR)/sample1.cc $(USER_DIR)/sample1.h $(GTEST_HEADERS)
 
71
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1.cc
 
72
 
 
73
sample1_unittest.o : $(USER_DIR)/sample1_unittest.cc \
 
74
                     $(USER_DIR)/sample1.h $(GTEST_HEADERS)
 
75
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1_unittest.cc
 
76
 
 
77
sample1_unittest : sample1.o sample1_unittest.o gtest_main.a
 
78
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@