blob: f4f30c22d5ca3e06a061b2ac600cb8589125a779 [file] [log] [blame]
Craig Silversteinb9f23482007-03-22 00:15:41 +00001## 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
Craig Silverstein2b66a842007-06-12 23:59:42 +00004ACLOCAL_AMFLAGS = -I m4
Craig Silversteinb9f23482007-03-22 00:15:41 +00005
Craig Silverstein67914682008-08-21 00:50:59 +00006# This is so we can #include <gflags/foo>
Craig Silversteinb9f23482007-03-22 00:15:41 +00007AM_CPPFLAGS = -I$(top_srcdir)/src
8
Craig Silversteinc79c32d2008-07-22 23:29:39 +00009# This is mostly based on configure options
10AM_CXXFLAGS =
11
12# These are good warnings to turn on by default,
13if GCC
14AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
15endif
16
Craig Silverstein67914682008-08-21 00:50:59 +000017gflagsincludedir = $(includedir)/gflags
Craig Silversteinb9f23482007-03-22 00:15:41 +000018## The .h files you want to install (that is, .h files that people
19## who install this package can include in their own applications.)
Craig Silverstein67914682008-08-21 00:50:59 +000020gflagsinclude_HEADERS = src/gflags/gflags.h src/gflags/gflags_completions.h
21
22# This is for backwards compatibility only.
23googleincludedir = $(includedir)/google
Craig Silversteinc79c32d2008-07-22 23:29:39 +000024googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h
25
26bin_SCRIPTS = src/gflags_completions.sh
Craig Silversteinb9f23482007-03-22 00:15:41 +000027
28docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
29## This is for HTML and other documentation you want to install.
30## Add your documentation files (in doc/) in addition to these
31## top-level boilerplate files. Also add a TODO file if you have one.
32dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \
Craig Silverstein690172b2007-04-20 21:16:33 +000033 doc/designstyle.css doc/gflags.html
Craig Silversteinb9f23482007-03-22 00:15:41 +000034
35## The libraries (.so's) you want to install
36lib_LTLIBRARIES =
37
38## unittests you want to run when people type 'make check'.
39## TESTS is for binary unittests, check_SCRIPTS for script-based unittests.
40## TESTS_ENVIRONMENT sets environment variables for when you run unittest,
41## but it only seems to take effect for *binary* unittests (argh!)
42TESTS =
Craig Silversteineb208392007-08-15 19:44:54 +000043TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)"
Craig Silversteinb9f23482007-03-22 00:15:41 +000044check_SCRIPTS =
45# Every time you add a unittest to check_SCRIPTS, add it here too
46noinst_SCRIPTS =
Craig Silverstein585a44a2007-10-18 20:08:26 +000047# Used for auto-generated source files
48CLEANFILES =
Craig Silversteinb9f23482007-03-22 00:15:41 +000049
50## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
51
52lib_LTLIBRARIES += libgflags.la
Craig Silverstein67914682008-08-21 00:50:59 +000053libgflags_la_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
Craig Silversteinc79c32d2008-07-22 23:29:39 +000054 src/gflags.cc src/gflags_reporting.cc \
55 src/gflags_completions.cc
56libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG
57libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS)
Craig Silversteinb9f23482007-03-22 00:15:41 +000058libgflags_la_LIBADD = $(PTHREAD_LIBS)
59
Craig Silverstein67914682008-08-21 00:50:59 +000060TESTS += gflags_unittest$(EXEEXT)
61gflags_unittest_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
Craig Silverstein585a44a2007-10-18 20:08:26 +000062 src/gflags_unittest.cc
Craig Silversteinb9f23482007-03-22 00:15:41 +000063gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
64gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
65gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS)
66
Craig Silversteineb208392007-08-15 19:44:54 +000067# Also make sure this works when we don't link in pthreads
Craig Silverstein67914682008-08-21 00:50:59 +000068TESTS += gflags_nothreads_unittest$(EXEEXT)
Craig Silversteineb208392007-08-15 19:44:54 +000069gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES)
70gflags_nothreads_unittest_LDADD = libgflags.la
71
Craig Silverstein585a44a2007-10-18 20:08:26 +000072# We also want to test that things work properly when the file that
73# holds main() has a name ending with -main or _main. To keep the
74# Makefile small :-), we test the no-threads version of these.
Craig Silverstein67914682008-08-21 00:50:59 +000075TESTS += gflags_unittest2$(EXEEXT)
76gflags_unittest2_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
Craig Silverstein585a44a2007-10-18 20:08:26 +000077 src/gflags_unittest-main.cc
78gflags_unittest2_LDADD = libgflags.la
79src/gflags_unittest-main.cc: src/gflags_unittest.cc
80 rm -f src/gflags_unittest-main.cc
81 cp -p src/gflags_unittest.cc src/gflags_unittest-main.cc
82CLEANFILES += src/gflags_unittest-main.cc
83
Craig Silverstein67914682008-08-21 00:50:59 +000084TESTS += gflags_unittest3$(EXEEXT)
85gflags_unittest3_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
Craig Silverstein585a44a2007-10-18 20:08:26 +000086 src/gflags_unittest_main.cc
87gflags_unittest3_LDADD = libgflags.la
88src/gflags_unittest_main.cc: src/gflags_unittest.cc
89 rm -f src/gflags_unittest_main.cc
90 cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc
91CLEANFILES += src/gflags_unittest_main.cc
92
Craig Silverstein67914682008-08-21 00:50:59 +000093# Some buggy sh's ignore "" instead of treating it as a positional
94# parameter. Since we use "" in this script, we prefer bash if we
95# can. If there's no bash, we fall back to sh.
Craig Silversteinb9f23482007-03-22 00:15:41 +000096check_SCRIPTS += gflags_unittest_sh
97noinst_SCRIPTS += src/gflags_unittest.sh
Craig Silverstein67914682008-08-21 00:50:59 +000098dist_noinst_DATA = src/gflags_unittest_flagfile
99gflags_unittest_sh: gflags_unittest$(EXEEXT) \
100 gflags_unittest2$(EXEEXT) \
101 gflags_unittest3$(EXEEXT)
102 bash --version >/dev/null && export SH=bash || export SH=sh; \
103 $$SH "$(top_srcdir)/src/gflags_unittest.sh" "$(PWD)/gflags_unittest" \
104 "$(top_srcdir)"
Craig Silversteinb9f23482007-03-22 00:15:41 +0000105
Craig Silverstein290da382007-03-28 21:54:07 +0000106# These aren't part of the c++ source, but we want them to be distributed
107PYTHON = python/setup.py \
108 python/gflags.py \
109 python/gflags2man.py \
110 python/gflags_unittest.py
111
112
Craig Silversteinb9f23482007-03-22 00:15:41 +0000113## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
114
115
116## This should always include $(TESTS), but may also include other
117## binaries that you compile but don't want automatically installed.
118noinst_PROGRAMS = $(TESTS)
119
120rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
121 @cd packages && ./rpm.sh ${PACKAGE} ${VERSION}
122
123deb: dist-gzip packages/deb.sh packages/deb/*
124 @cd packages && ./deb.sh ${PACKAGE} ${VERSION}
125
126libtool: $(LIBTOOL_DEPS)
127 $(SHELL) ./config.status --recheck
128EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \
Craig Silverstein290da382007-03-28 21:54:07 +0000129 libtool $(SCRIPTS) $(PYTHON)