about summary refs log tree commit diff
path: root/third_party/glog/Makefile.am
blob: e792332a02ca898fcb3e3d7ec4cd3c1f21d2b1b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
## Process this file with automake to produce Makefile.in

AUTOMAKE_OPTIONS = subdir-objects foreign

# Make sure that when we re-make ./configure, we get the macros we need
ACLOCAL_AMFLAGS = -I m4

# This is so we can #include <glog/foo>
AM_CPPFLAGS = -I$(top_srcdir)/src

# This is mostly based on configure options
AM_CXXFLAGS =

# These are good warnings to turn on by default
if GCC
  AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
endif

# These are x86-specific, having to do with frame-pointers
if X86_64
if ENABLE_FRAME_POINTERS
  AM_CXXFLAGS += -fno-omit-frame-pointer
else
  # TODO(csilvers): check if -fomit-frame-pointer might be in $(CXXFLAGS),
  #                 before setting this.
  AM_CXXFLAGS += -DNO_FRAME_POINTER
endif
endif

if DISABLE_RTTI
  AM_CXXFLAGS += -fno-rtti
endif

glogincludedir = $(includedir)/glog
## The .h files you want to install (that is, .h files that people
## who install this package can include in their own applications.)
## We have to include both the .h and .h.in forms.  The latter we
## put in noinst_HEADERS.
gloginclude_HEADERS = src/glog/log_severity.h
nodist_gloginclude_HEADERS = src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h
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

## This is for HTML and other documentation you want to install.
## Add your documentation files (in doc/) in addition to these
## top-level boilerplate files.  Also add a TODO file if you have one.
dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL README.md README.windows \
                doc/designstyle.css doc/glog.html

## The libraries (.so's) you want to install
lib_LTLIBRARIES =

# The libraries libglog depends on.
COMMON_LIBS = $(PTHREAD_LIBS) $(GFLAGS_LIBS) $(UNWIND_LIBS)
# Compile switches for our unittest.
TEST_CFLAGS = $(GTEST_CFLAGS) $(GMOCK_CFLAGS) $(GFLAGS_CFLAGS) \
              $(MINGW_CFLAGS) $(AM_CXXFLAGS)
# Libraries for our unittest.
TEST_LIBS = $(GTEST_LIBS) $(GMOCK_LIBS) $(GFLAGS_LIBS)

## unittests you want to run when people type 'make check'.
## TESTS is for binary unittests, check_SCRIPTS for script-based unittests.
## TESTS_ENVIRONMENT sets environment variables for when you run unittest,
## but it only seems to take effect for *binary* unittests (argh!)
TESTS =
# Set a small stack size so that (at least on Linux) PIEs are mapped at a lower
# address than DSOs. This is used by symbolize_pie_unittest to check that we can
# successfully symbolize PIEs loaded at low addresses.
TESTS_ENVIRONMENT = ulimit -s 8192;
check_SCRIPTS =
# Every time you add a unittest to check_SCRIPTS, add it here too
noinst_SCRIPTS =
# Binaries used for script-based unittests.
TEST_BINARIES =

TESTS += logging_unittest
logging_unittest_SOURCES = $(gloginclude_HEADERS) \
                           src/logging_unittest.cc \
                           src/config_for_unittests.h \
                           src/mock-log.h
nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)

check_SCRIPTS += logging_striplog_test_sh
noinst_SCRIPTS += src/logging_striplog_test.sh
logging_striplog_test_sh: logging_striptest0 logging_striptest2 logging_striptest10
	$(top_srcdir)/src/logging_striplog_test.sh

check_SCRIPTS += demangle_unittest_sh
noinst_SCRIPTS += src/demangle_unittest.sh
demangle_unittest_sh: demangle_unittest
	$(builddir)/demangle_unittest  # force to create lt-demangle_unittest
	$(top_srcdir)/src/demangle_unittest.sh

check_SCRIPTS += signalhandler_unittest_sh
noinst_SCRIPTS += src/signalhandler_unittest.sh
signalhandler_unittest_sh: signalhandler_unittest
	$(builddir)/signalhandler_unittest  # force to create lt-signalhandler_unittest
	$(top_srcdir)/src/signalhandler_unittest.sh

TEST_BINARIES += logging_striptest0
logging_striptest0_SOURCES = $(gloginclude_HEADERS) \
                             src/logging_striptest_main.cc
nodist_logging_striptest0_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest0_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_striptest0_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest0_LDADD = libglog.la $(COMMON_LIBS)

TEST_BINARIES += logging_striptest2
logging_striptest2_SOURCES = $(gloginclude_HEADERS) \
                             src/logging_striptest2.cc
nodist_logging_striptest2_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_striptest2_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest2_LDADD = libglog.la $(COMMON_LIBS)

TEST_BINARIES += logging_striptest10
logging_striptest10_SOURCES = $(gloginclude_HEADERS) \
                              src/logging_striptest10.cc
nodist_logging_striptest10_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_striptest10_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest10_LDADD = libglog.la $(COMMON_LIBS)

TESTS += demangle_unittest
demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
                            src/demangle_unittest.cc
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
demangle_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)

TESTS += stacktrace_unittest
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
                              src/stacktrace_unittest.cc
nodist_stacktrace_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
stacktrace_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
stacktrace_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
stacktrace_unittest_LDADD = libglog.la $(COMMON_LIBS)

TESTS += symbolize_unittest
symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
                              src/symbolize_unittest.cc
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)

TESTS += symbolize_pie_unittest
symbolize_pie_unittest_SOURCES = $(gloginclude_HEADERS) \
                                 src/symbolize_unittest.cc
nodist_symbolize_pie_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
symbolize_pie_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -fPIE
symbolize_pie_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -pie
symbolize_pie_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)

TESTS += stl_logging_unittest
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
                               src/stl_logging_unittest.cc
nodist_stl_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
stl_logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
stl_logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
stl_logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)

TEST_BINARIES += signalhandler_unittest
signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) \
                               src/signalhandler_unittest.cc
nodist_signalhandler_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
signalhandler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
signalhandler_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
signalhandler_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)

TESTS += utilities_unittest
utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
                             src/utilities_unittest.cc
nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
utilities_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)

if HAVE_GMOCK
TESTS += mock_log_test
mock_log_test_SOURCES = $(gloginclude_HEADERS) \
                        src/mock-log_test.cc
nodist_mock_log_test_SOURCES = $(nodist_gloginclude_HEADERS)
mock_log_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
mock_log_test_LDFLAGS = $(PTHREAD_CFLAGS)
mock_log_test_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
endif

## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS

lib_LTLIBRARIES += libglog.la
libglog_la_SOURCES = $(gloginclude_HEADERS) \
                       src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \
                       src/utilities.cc src/utilities.h \
                       src/demangle.cc src/demangle.h \
                       src/stacktrace.h \
                       src/stacktrace_generic-inl.h \
                       src/stacktrace_libunwind-inl.h \
                       src/stacktrace_powerpc-inl.h \
                       src/stacktrace_x86-inl.h \
                       src/stacktrace_x86_64-inl.h \
                       src/symbolize.cc src/symbolize.h \
                       src/signalhandler.cc \
                       src/base/mutex.h src/base/googleinit.h \
                       src/base/commandlineflags.h src/googletest.h
nodist_libglog_la_SOURCES = $(nodist_gloginclude_HEADERS)

libglog_la_CXXFLAGS = $(PTHREAD_CFLAGS) $(GFLAGS_CFLAGS) $(MINGW_CFLAGS) \
                      $(AM_CXXFLAGS) -DNDEBUG
libglog_la_LDFLAGS = $(PTHREAD_CFLAGS) $(GFLAGS_LDFLAGS)
libglog_la_LIBADD = $(COMMON_LIBS)

## The location of the windows project file for each binary we make
WINDOWS_PROJECTS = google-glog.sln
WINDOWS_PROJECTS += vsprojects/libglog/libglog.vcproj
WINDOWS_PROJECTS += vsprojects/logging_unittest/logging_unittest.vcproj
WINDOWS_PROJECTS += vsprojects/libglog_static/libglog_static.vcproj
WINDOWS_PROJECTS += vsprojects/logging_unittest_static/logging_unittest_static.vcproj

## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS


## This should always include $(TESTS), but may also include other
## binaries that you compile but don't want automatically installed.
noinst_PROGRAMS = $(TESTS) $(TEST_BINARIES)

rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
	@cd packages && ./rpm.sh ${PACKAGE} ${VERSION}

deb: dist-gzip packages/deb.sh packages/deb/*
	@cd packages && ./deb.sh ${PACKAGE} ${VERSION}

# Windows wants write permission to .vcproj files and maybe even sln files.
dist-hook:
	test -e "$(distdir)/vsprojects" \
	   && chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/

libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec \
	packages/deb.sh packages/deb/* \
	$(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt \
	src/windows/config.h src/windows/port.h src/windows/port.cc \
	src/windows/preprocess.sh \
	src/windows/glog/log_severity.h src/windows/glog/logging.h \
	src/windows/glog/raw_logging.h src/windows/glog/stl_logging.h \
	src/windows/glog/vlog_is_on.h \
	$(WINDOWS_PROJECTS)

CLEANFILES = core demangle.dm demangle.nm signalhandler.out* \
	signalhandler_unittest.*.log.INFO.*

# Add pkgconfig file
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libglog.pc