# These are good warnings to turn on by default
if GCC
-AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
+ 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
+ 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
+ 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.)
## 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 NEWS README \
- doc/designstyle.css doc/glog.html
+dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README 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)
+COMMON_LIBS = $(PTHREAD_LIBS) $(GFLAGS_LIBS) $(UNWIND_LIBS)
+# Compile switches for our unittest.
+TEST_CFLAGS = $(GTEST_CFLAGS) $(GMOCK_CFLAGS) $(GFLAGS_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 += logging_unittest
logging_unittest_SOURCES = $(gloginclude_HEADERS) \
- src/logging_unittest.cc \
- src/config_for_unittests.h
+ 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)
+logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
-logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
+logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
check_SCRIPTS += logging_striplog_test_sh
noinst_SCRIPTS += src/logging_striplog_test.sh
check_SCRIPTS += demangle_unittest_sh
noinst_SCRIPTS += src/demangle_unittest.sh
demangle_unittest_sh: demangle_unittest
- $(top_srcdir)/demangle_unittest # force to create lt-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
- # force to create lt-signalhandler_unittest
- $(top_srcdir)/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)
+logging_striptest0_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_striptest0_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest0_LDADD = libglog.la $(COMMON_LIBS)
logging_striptest2_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest2.cc
nodist_logging_striptest2_SOURCES = $(nodist_gloginclude_HEADERS)
-logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS)
+logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_striptest2_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest2_LDADD = libglog.la $(COMMON_LIBS)
logging_striptest10_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest10.cc
nodist_logging_striptest10_SOURCES = $(nodist_gloginclude_HEADERS)
-logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS)
+logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
logging_striptest10_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest10_LDADD = libglog.la $(COMMON_LIBS)
demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
src/demangle_unittest.cc
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
-demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
+demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
-demangle_unittest_LDADD = libglog.la $(COMMON_LIBS)
+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)
+stacktrace_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
stacktrace_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
stacktrace_unittest_LDADD = libglog.la $(COMMON_LIBS)
symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
src/symbolize_unittest.cc
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
-symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
+symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
-symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS)
+symbolize_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)
+stl_logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
stl_logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
-stl_logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
+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)
+signalhandler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
signalhandler_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
-signalhandler_unittest_LDADD = libglog.la $(COMMON_LIBS)
+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)
+utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS)
utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
-utilities_unittest_LDADD = libglog.la $(COMMON_LIBS)
+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
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/demangle.cc src/demangle.h \
src/stacktrace.h \
src/stacktrace_generic-inl.h \
src/stacktrace_libunwind-inl.h \
src/base/commandlineflags.h src/googletest.h
nodist_libglog_la_SOURCES = $(nodist_gloginclude_HEADERS)
-libglog_la_CXXFLAGS = $(PTRHEAD_CFLAGS) -DNDEBUG
-libglog_la_LDFLAGS = $(PTRHEAD_CFLAGS)
+libglog_la_CXXFLAGS = $(PTRHEAD_CFLAGS) $(GFLAGS_CFLAGS) $(AM_CXXFLAGS) -DNDEBUG
+libglog_la_LDFLAGS = $(PTRHEAD_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
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