d578a4082d318ee469591f39443ecf968e17677d
[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 # Set a small stack size so that (at least on Linux) PIEs are mapped at a lower
67 # address than DSOs. This is used by symbolize_pie_unittest to check that we can
68 # successfully symbolize PIEs loaded at low addresses.
69 TESTS_ENVIRONMENT = ulimit -s 8192;
70 check_SCRIPTS =
71 # Every time you add a unittest to check_SCRIPTS, add it here too
72 noinst_SCRIPTS =
73 # Binaries used for script-based unittests.
74 TEST_BINARIES =
75
76 TESTS += logging_unittest
77 logging_unittest_SOURCES = $(gloginclude_HEADERS) \
78                            src/logging_unittest.cc \
79                            src/config_for_unittests.h \
80                            src/mock-log.h
81 nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
82 logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
83 logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
84 logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
85
86 check_SCRIPTS += logging_striplog_test_sh
87 noinst_SCRIPTS += src/logging_striplog_test.sh
88 logging_striplog_test_sh: logging_striptest0 logging_striptest2 logging_striptest10
89         $(top_srcdir)/src/logging_striplog_test.sh
90
91 check_SCRIPTS += demangle_unittest_sh
92 noinst_SCRIPTS += src/demangle_unittest.sh
93 demangle_unittest_sh: demangle_unittest
94         $(builddir)/demangle_unittest  # force to create lt-demangle_unittest
95         $(top_srcdir)/src/demangle_unittest.sh
96
97 check_SCRIPTS += signalhandler_unittest_sh
98 noinst_SCRIPTS += src/signalhandler_unittest.sh
99 signalhandler_unittest_sh: signalhandler_unittest
100         $(builddir)/signalhandler_unittest  # force to create lt-signalhandler_unittest
101         $(top_srcdir)/src/signalhandler_unittest.sh
102
103 TEST_BINARIES += logging_striptest0
104 logging_striptest0_SOURCES = $(gloginclude_HEADERS) \
105                              src/logging_striptest_main.cc
106 nodist_logging_striptest0_SOURCES = $(nodist_gloginclude_HEADERS)
107 logging_striptest0_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
108 logging_striptest0_LDFLAGS = $(PTHREAD_CFLAGS)
109 logging_striptest0_LDADD = libglog.la $(COMMON_LIBS)
110
111 TEST_BINARIES += logging_striptest2
112 logging_striptest2_SOURCES = $(gloginclude_HEADERS) \
113                              src/logging_striptest2.cc
114 nodist_logging_striptest2_SOURCES = $(nodist_gloginclude_HEADERS)
115 logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
116 logging_striptest2_LDFLAGS = $(PTHREAD_CFLAGS)
117 logging_striptest2_LDADD = libglog.la $(COMMON_LIBS)
118
119 TEST_BINARIES += logging_striptest10
120 logging_striptest10_SOURCES = $(gloginclude_HEADERS) \
121                               src/logging_striptest10.cc
122 nodist_logging_striptest10_SOURCES = $(nodist_gloginclude_HEADERS)
123 logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
124 logging_striptest10_LDFLAGS = $(PTHREAD_CFLAGS)
125 logging_striptest10_LDADD = libglog.la $(COMMON_LIBS)
126
127 TESTS += demangle_unittest
128 demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
129                             src/demangle_unittest.cc
130 nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
131 demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
132 demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
133 demangle_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
134
135 TESTS += stacktrace_unittest
136 stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
137                               src/stacktrace_unittest.cc
138 nodist_stacktrace_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
139 stacktrace_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
140 stacktrace_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
141 stacktrace_unittest_LDADD = libglog.la $(COMMON_LIBS)
142
143 TESTS += symbolize_unittest
144 symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
145                               src/symbolize_unittest.cc
146 nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
147 symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
148 symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
149 symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
150
151 TESTS += symbolize_pie_unittest
152 symbolize_pie_unittest_SOURCES = $(gloginclude_HEADERS) \
153                                  src/symbolize_unittest.cc
154 nodist_symbolize_pie_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
155 symbolize_pie_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -fPIE
156 symbolize_pie_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -pie
157 symbolize_pie_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
158
159 TESTS += stl_logging_unittest
160 stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
161                                src/stl_logging_unittest.cc
162 nodist_stl_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
163 stl_logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
164 stl_logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
165 stl_logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
166
167 TEST_BINARIES += signalhandler_unittest
168 signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) \
169                                src/signalhandler_unittest.cc
170 nodist_signalhandler_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
171 signalhandler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
172 signalhandler_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
173 signalhandler_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
174
175 TESTS += utilities_unittest
176 utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
177                              src/utilities_unittest.cc
178 nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
179 utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
180 utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
181 utilities_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
182
183 if HAVE_GMOCK
184 TESTS += mock_log_test
185 mock_log_test_SOURCES = $(gloginclude_HEADERS) \
186                         src/mock-log_test.cc
187 nodist_mock_log_test_SOURCES = $(nodist_gloginclude_HEADERS)
188 mock_log_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
189 mock_log_test_LDFLAGS = $(PTHREAD_CFLAGS)
190 mock_log_test_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
191 endif
192
193 ## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
194
195 lib_LTLIBRARIES += libglog.la
196 libglog_la_SOURCES = $(gloginclude_HEADERS) \
197                        src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \
198                        src/utilities.cc src/utilities.h \
199                        src/demangle.cc src/demangle.h \
200                        src/stacktrace.h \
201                        src/stacktrace_generic-inl.h \
202                        src/stacktrace_libunwind-inl.h \
203                        src/stacktrace_powerpc-inl.h \
204                        src/stacktrace_x86-inl.h \
205                        src/stacktrace_x86_64-inl.h \
206                        src/symbolize.cc src/symbolize.h \
207                        src/signalhandler.cc \
208                        src/base/mutex.h src/base/googleinit.h \
209                        src/base/commandlineflags.h src/googletest.h
210 nodist_libglog_la_SOURCES = $(nodist_gloginclude_HEADERS)
211
212 libglog_la_CXXFLAGS = $(PTRHEAD_CFLAGS) $(GFLAGS_CFLAGS) $(MINGW_CFLAGS) \
213                       $(AM_CXXFLAGS) -DNDEBUG
214 libglog_la_LDFLAGS = $(PTRHEAD_CFLAGS) $(GFLAGS_LDFLAGS)
215 libglog_la_LIBADD = $(COMMON_LIBS)
216
217 ## The location of the windows project file for each binary we make
218 WINDOWS_PROJECTS = google-glog.sln
219 WINDOWS_PROJECTS += vsprojects/libglog/libglog.vcproj
220 WINDOWS_PROJECTS += vsprojects/logging_unittest/logging_unittest.vcproj
221 WINDOWS_PROJECTS += vsprojects/libglog_static/libglog_static.vcproj
222 WINDOWS_PROJECTS += vsprojects/logging_unittest_static/logging_unittest_static.vcproj
223
224 ## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
225
226
227 ## This should always include $(TESTS), but may also include other
228 ## binaries that you compile but don't want automatically installed.
229 noinst_PROGRAMS = $(TESTS) $(TEST_BINARIES)
230
231 rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
232         @cd packages && ./rpm.sh ${PACKAGE} ${VERSION}
233
234 deb: dist-gzip packages/deb.sh packages/deb/*
235         @cd packages && ./deb.sh ${PACKAGE} ${VERSION}
236
237 # Windows wants write permission to .vcproj files and maybe even sln files.
238 dist-hook:
239         test -e "$(distdir)/vsprojects" \
240            && chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/
241
242 libtool: $(LIBTOOL_DEPS)
243         $(SHELL) ./config.status --recheck
244
245 EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec \
246         packages/deb.sh packages/deb/* \
247         $(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt \
248         src/windows/config.h src/windows/port.h src/windows/port.cc \
249         src/windows/preprocess.sh \
250         src/windows/glog/log_severity.h src/windows/glog/logging.h \
251         src/windows/glog/raw_logging.h src/windows/glog/stl_logging.h \
252         src/windows/glog/vlog_is_on.h \
253         $(WINDOWS_PROJECTS)
254
255 CLEANFILES = core demangle.dm demangle.nm signalhandler.out* \
256         signalhandler_unittest.*.log.INFO.*
257
258 # Add pkgconfig file
259 pkgconfigdir = $(libdir)/pkgconfig
260 pkgconfig_DATA = libglog.pc