Merge pull request #10 from jmr/std_vector
[platform/upstream/glog.git] / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2
3 AUTOMAKE_OPTIONS=subdir-objects
4
5 # Make sure that when we re-make ./configure, we get the macros we need
6 ACLOCAL_AMFLAGS = -I m4
7
8 # This is so we can #include <glog/foo>
9 AM_CPPFLAGS = -I$(top_srcdir)/src
10
11 # This is mostly based on configure options
12 AM_CXXFLAGS =
13
14 # These are good warnings to turn on by default
15 if GCC
16   AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
17 endif
18
19 # These are x86-specific, having to do with frame-pointers
20 if X86_64
21 if ENABLE_FRAME_POINTERS
22   AM_CXXFLAGS += -fno-omit-frame-pointer
23 else
24   # TODO(csilvers): check if -fomit-frame-pointer might be in $(CXXFLAGS),
25   #                 before setting this.
26   AM_CXXFLAGS += -DNO_FRAME_POINTER
27 endif
28 endif
29
30 if DISABLE_RTTI
31   AM_CXXFLAGS += -fno-rtti
32 endif
33
34 glogincludedir = $(includedir)/glog
35 ## The .h files you want to install (that is, .h files that people
36 ## who install this package can include in their own applications.)
37 ## We have to include both the .h and .h.in forms.  The latter we
38 ## put in noinst_HEADERS.
39 gloginclude_HEADERS = src/glog/log_severity.h
40 nodist_gloginclude_HEADERS = src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h
41 noinst_HEADERS = src/glog/logging.h.in src/glog/raw_logging.h.in src/glog/vlog_is_on.h.in src/glog/stl_logging.h.in
42
43 docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
44 ## This is for HTML and other documentation you want to install.
45 ## Add your documentation files (in doc/) in addition to these
46 ## top-level boilerplate files.  Also add a TODO file if you have one.
47 dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README README.windows \
48                 doc/designstyle.css doc/glog.html
49
50 ## The libraries (.so's) you want to install
51 lib_LTLIBRARIES =
52
53 # The libraries libglog depends on.
54 COMMON_LIBS = $(PTHREAD_LIBS) $(GFLAGS_LIBS) $(UNWIND_LIBS)
55 # Compile switches for our unittest.
56 TEST_CFLAGS = $(GTEST_CFLAGS) $(GMOCK_CFLAGS) $(GFLAGS_CFLAGS) \
57               $(MINGW_CFLAGS) $(AM_CXXFLAGS)
58 # Libraries for our unittest.
59 TEST_LIBS = $(GTEST_LIBS) $(GMOCK_LIBS) $(GFLAGS_LIBS)
60
61 ## unittests you want to run when people type 'make check'.
62 ## TESTS is for binary unittests, check_SCRIPTS for script-based unittests.
63 ## TESTS_ENVIRONMENT sets environment variables for when you run unittest,
64 ## but it only seems to take effect for *binary* unittests (argh!)
65 TESTS =
66 TESTS_ENVIRONMENT =
67 check_SCRIPTS =
68 # Every time you add a unittest to check_SCRIPTS, add it here too
69 noinst_SCRIPTS =
70 # Binaries used for script-based unittests.
71 TEST_BINARIES =
72
73 TESTS += logging_unittest
74 logging_unittest_SOURCES = $(gloginclude_HEADERS) \
75                            src/logging_unittest.cc \
76                            src/config_for_unittests.h \
77                            src/mock-log.h
78 nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
79 logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
80 logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
81 logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
82
83 check_SCRIPTS += logging_striplog_test_sh
84 noinst_SCRIPTS += src/logging_striplog_test.sh
85 logging_striplog_test_sh: logging_striptest0 logging_striptest2 logging_striptest10
86         $(top_srcdir)/src/logging_striplog_test.sh
87
88 check_SCRIPTS += demangle_unittest_sh
89 noinst_SCRIPTS += src/demangle_unittest.sh
90 demangle_unittest_sh: demangle_unittest
91         $(builddir)/demangle_unittest  # force to create lt-demangle_unittest
92         $(top_srcdir)/src/demangle_unittest.sh
93
94 check_SCRIPTS += signalhandler_unittest_sh
95 noinst_SCRIPTS += src/signalhandler_unittest.sh
96 signalhandler_unittest_sh: signalhandler_unittest
97         $(builddir)/signalhandler_unittest  # force to create lt-signalhandler_unittest
98         $(top_srcdir)/src/signalhandler_unittest.sh
99
100 TEST_BINARIES += logging_striptest0
101 logging_striptest0_SOURCES = $(gloginclude_HEADERS) \
102                              src/logging_striptest_main.cc
103 nodist_logging_striptest0_SOURCES = $(nodist_gloginclude_HEADERS)
104 logging_striptest0_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
105 logging_striptest0_LDFLAGS = $(PTHREAD_CFLAGS)
106 logging_striptest0_LDADD = libglog.la $(COMMON_LIBS)
107
108 TEST_BINARIES += logging_striptest2
109 logging_striptest2_SOURCES = $(gloginclude_HEADERS) \
110                              src/logging_striptest2.cc
111 nodist_logging_striptest2_SOURCES = $(nodist_gloginclude_HEADERS)
112 logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
113 logging_striptest2_LDFLAGS = $(PTHREAD_CFLAGS)
114 logging_striptest2_LDADD = libglog.la $(COMMON_LIBS)
115
116 TEST_BINARIES += logging_striptest10
117 logging_striptest10_SOURCES = $(gloginclude_HEADERS) \
118                               src/logging_striptest10.cc
119 nodist_logging_striptest10_SOURCES = $(nodist_gloginclude_HEADERS)
120 logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
121 logging_striptest10_LDFLAGS = $(PTHREAD_CFLAGS)
122 logging_striptest10_LDADD = libglog.la $(COMMON_LIBS)
123
124 TESTS += demangle_unittest
125 demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
126                             src/demangle_unittest.cc
127 nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
128 demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
129 demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
130 demangle_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
131
132 TESTS += stacktrace_unittest
133 stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
134                               src/stacktrace_unittest.cc
135 nodist_stacktrace_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
136 stacktrace_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
137 stacktrace_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
138 stacktrace_unittest_LDADD = libglog.la $(COMMON_LIBS)
139
140 TESTS += symbolize_unittest
141 symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
142                               src/symbolize_unittest.cc
143 nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
144 symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
145 symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
146 symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
147
148 TESTS += stl_logging_unittest
149 stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
150                                src/stl_logging_unittest.cc
151 nodist_stl_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
152 stl_logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
153 stl_logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
154 stl_logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
155
156 TEST_BINARIES += signalhandler_unittest
157 signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) \
158                                src/signalhandler_unittest.cc
159 nodist_signalhandler_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
160 signalhandler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
161 signalhandler_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
162 signalhandler_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
163
164 TESTS += utilities_unittest
165 utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
166                              src/utilities_unittest.cc
167 nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
168 utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
169 utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
170 utilities_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
171
172 if HAVE_GMOCK
173 TESTS += mock_log_test
174 mock_log_test_SOURCES = $(gloginclude_HEADERS) \
175                         src/mock-log_test.cc
176 nodist_mock_log_test_SOURCES = $(nodist_gloginclude_HEADERS)
177 mock_log_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
178 mock_log_test_LDFLAGS = $(PTHREAD_CFLAGS)
179 mock_log_test_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
180 endif
181
182 ## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
183
184 lib_LTLIBRARIES += libglog.la
185 libglog_la_SOURCES = $(gloginclude_HEADERS) \
186                        src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \
187                        src/utilities.cc src/utilities.h \
188                        src/demangle.cc src/demangle.h \
189                        src/stacktrace.h \
190                        src/stacktrace_generic-inl.h \
191                        src/stacktrace_libunwind-inl.h \
192                        src/stacktrace_powerpc-inl.h \
193                        src/stacktrace_x86-inl.h \
194                        src/stacktrace_x86_64-inl.h \
195                        src/symbolize.cc src/symbolize.h \
196                        src/signalhandler.cc \
197                        src/base/mutex.h src/base/googleinit.h \
198                        src/base/commandlineflags.h src/googletest.h
199 nodist_libglog_la_SOURCES = $(nodist_gloginclude_HEADERS)
200
201 libglog_la_CXXFLAGS = $(PTRHEAD_CFLAGS) $(GFLAGS_CFLAGS) $(MINGW_CFLAGS) \
202                       $(AM_CXXFLAGS) -DNDEBUG
203 libglog_la_LDFLAGS = $(PTRHEAD_CFLAGS) $(GFLAGS_LDFLAGS)
204 libglog_la_LIBADD = $(COMMON_LIBS)
205
206 ## The location of the windows project file for each binary we make
207 WINDOWS_PROJECTS = google-glog.sln
208 WINDOWS_PROJECTS += vsprojects/libglog/libglog.vcproj
209 WINDOWS_PROJECTS += vsprojects/logging_unittest/logging_unittest.vcproj
210 WINDOWS_PROJECTS += vsprojects/libglog_static/libglog_static.vcproj
211 WINDOWS_PROJECTS += vsprojects/logging_unittest_static/logging_unittest_static.vcproj
212
213 ## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
214
215
216 ## This should always include $(TESTS), but may also include other
217 ## binaries that you compile but don't want automatically installed.
218 noinst_PROGRAMS = $(TESTS) $(TEST_BINARIES)
219
220 rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
221         @cd packages && ./rpm.sh ${PACKAGE} ${VERSION}
222
223 deb: dist-gzip packages/deb.sh packages/deb/*
224         @cd packages && ./deb.sh ${PACKAGE} ${VERSION}
225
226 # Windows wants write permission to .vcproj files and maybe even sln files.
227 dist-hook:
228         test -e "$(distdir)/vsprojects" \
229            && chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/
230
231 libtool: $(LIBTOOL_DEPS)
232         $(SHELL) ./config.status --recheck
233
234 EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec \
235         packages/deb.sh packages/deb/* \
236         $(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt \
237         src/windows/config.h src/windows/port.h src/windows/port.cc \
238         src/windows/preprocess.sh \
239         src/windows/glog/log_severity.h src/windows/glog/logging.h \
240         src/windows/glog/raw_logging.h src/windows/glog/stl_logging.h \
241         src/windows/glog/vlog_is_on.h \
242         $(WINDOWS_PROJECTS)
243
244 CLEANFILES = core demangle.dm demangle.nm signalhandler.out* \
245         signalhandler_unittest.*.log.INFO.*
246
247 # Add pkgconfig file
248 pkgconfigdir = $(libdir)/pkgconfig
249 pkgconfig_DATA = libglog.pc