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