summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 8e8cd0923b12af8daf5e8139ae5f72c416e695fe (plain)
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
SUBDIRS	      = gdtoa
BUILT_SOURCES =
CLEANFILES    =
EXTRA_DIST    = LICENSE docs tests contrib scripts setup.py \
		acprep verify.sh run_verify.sh valgrind.sh \
		src/TODO src/gnucash.cc 

ESC_srcdir=`echo "$(srcdir)" | sed 's/\//\\\\\//g'`
ESC_builddir=`echo "$(top_builddir)" | sed 's/\//\\\\\//g'`
ESC_distdir=`echo "$(distdir)" | sed 's/\//\\\\\//g'`

#(cd $(distdir)/docs; zip -r doxygen-html.zip html; rm -fr html)
dist-hook:
	rm -fr `find $(distdir) -name .svn`


lib_LTLIBRARIES = libledger.la
if HAVE_BOOST_PYTHON
lib_LTLIBRARIES += libpyledger.la
endif

AM_YFLAGS = -d
AM_LFLAGS = -o $(LEX_OUTPUT_ROOT).c

WARNFLAGS  = -Wall -Wextra -Wfloat-equal -Wno-endif-labels
WARNFLAGS += -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion
WARNFLAGS += -Wconversion -Wshorten-64-to-32 -Wsign-compare
WARNFLAGS += -Wmissing-field-initializers -pedantic-errors
WARNFLAGS += -Weffc++ -Wstrict-null-sentinel -Wold-style-cast
WARNFLAGS += -Woverloaded-virtual -Wsign-promo

libledger_la_CPPFLAGS = -I$(top_builddir)/gdtoa -I$(srcdir)/gdtoa \
			-I$(srcdir)/src #$(WARNFLAGS)
libledger_la_LDFLAGS  = -release $(PACKAGE_VERSION)

libledger_la_SOURCES = \
	src/utils.cc	 \
	src/times.cc	 \
	src/mask.cc	 \
	src/commodity.cc \
	src/amount.cc    \
	src/balance.cc   \
	src/value.cc     \
			 \
	src/session.cc	 \
	src/journal.cc	 \
	src/binary.cc	 \
	src/qif.cc	 \
	src/textual.cc	 \
	src/quotes.cc	 \
	src/csv.cc	 \
	src/derive.cc	 \
	src/emacs.cc	 \
	src/format.cc	 \
	src/reconcile.cc \
	src/register.cc	 \
	src/report.cc	 \
	src/transform.cc \
	src/xml.cc	 \
	src/xmlparse.cc	 \
	src/xpath.cc

#if HAVE_EXPAT
#libledger_la_CPPFLAGS += -DHAVE_EXPAT=1
#libledger_la_SOURCES += src/gnucash.cc
#endif
#if HAVE_XMLPARSE
#libledger_la_CPPFLAGS += -DHAVE_XMLPARSE=1
#libledger_la_SOURCES += src/gnucash.cc
#endif
if HAVE_LIBOFX
libledger_la_CPPFLAGS += -DHAVE_LIBOFX=1
libledger_la_SOURCES += src/ofx.cc
endif
if DEBUG
libledger_la_CPPFLAGS += -DDEBUG_MODE
endif

if USE_PCH
nodist_libledger_la_SOURCES = system.hh.gch

BUILT_SOURCES += system.hh.gch
CLEANFILES += system.hh.gch system.hh

$(top_builddir)/system.hh.gch: $(srcdir)/src/system.hh acconf.h
	echo "#include \"src/system.hh\"" > $(top_builddir)/system.hh
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(libledger_la_CPPFLAGS) \
		-o $@ $(srcdir)/src/system.hh
endif


libpyledger_la_CPPFLAGS = $(libledger_la_CPPFLAGS)
libpyledger_la_LDFLAGS  = -release $(PACKAGE_VERSION)

libpyledger_la_SOURCES =    \
	src/pyinterp.cc	    \
	src/py_utils.cc	    \
	src/py_times.cc	    \
	src/py_commodity.cc \
	src/py_amount.cc


pkginclude_HEADERS = \
	src/amount.h	     \
	src/balance.h	     \
	src/balpair.h	     \
	src/binary.h	     \
	src/builder.h	     \
	src/commodity.h	     \
	src/context.h	     \
	src/csv.h	     \
	src/derive.h	     \
	src/emacs.h	     \
	src/fdstream.hpp     \
	src/flags.h	     \
	src/format.h	     \
	src/gnucash.h	     \
	src/journal.h	     \
	src/ledger.h	     \
	src/mask.h	     \
	src/ofx.h	     \
	src/option.h	     \
	src/parser.h	     \
	src/pyfstream.h	     \
	src/pyinterp.h	     \
	src/pyledger.h	     \
	src/pyutils.h	     \
	src/qif.h	     \
	src/quotes.h	     \
	src/reconcile.h	     \
	src/register.h	     \
	src/report.h	     \
	src/scoped_execute.h \
	src/session.h	     \
	src/system.hh	     \
	src/textual.h	     \
	src/times.h	     \
	src/transform.h	     \
	src/tuples.hpp	     \
	src/utils.h	     \
	src/value.h	     \
	src/xml.h	     \
	src/xpath.h

###############################################################################

bin_PROGRAMS = ledger

ledger_CPPFLAGS = $(libledger_la_CPPFLAGS)
ledger_LDADD	= $(LIBOBJS) libledger.la gdtoa/libgdtoa.la $(LEXLIB)
ledger_LDFLAGS	= -static	# for the sake of command-line speed

ledger_SOURCES  = \
	src/option.cc \
	src/main.cc

if HAVE_BOOST_PYTHON
ledger_LDADD += libpyledger.la
endif

nodist_info_TEXINFOS = docs/ledger.texi

###############################################################################

dist_lisp_LISP = lisp/ledger.el lisp/timeclock.el

DISTCLEANFILES = ledger.elc timeclock.elc

###############################################################################

if HAVE_BOOST_PYTHON

noinst_PROGRAMS = ledger.so

CLEANFILES += ledger.so

clean-local:
	rm -fr build

ledger_so_SOURCES = \
	src/pyledger.cc \
	src/pyinterp.cc \
	src/py_utils.cc \
	src/py_times.cc \
	src/py_commodity.cc \
	src/py_amount.cc

ledger_so_DEPENDENCIES = libledger.la gdtoa/libgdtoa.la libpyledger.la

PYLIBS  = pyledger ledger gdtoa gmp
PYLIBS += boost_date_time$(BOOST_SUFFIX)  \
          boost_filesystem$(BOOST_SUFFIX) \
          boost_regex$(BOOST_SUFFIX)	  \
          boost_python$(BOOST_SUFFIX)

#if HAVE_EXPAT
#PYLIBS += expat
#endif
#if HAVE_XMLPARSE
#PYLIBS += xmlparse xmltok
#endif
if HAVE_LIBOFX
PYLIBS += ofx
endif

ledger.so: $(ledger_so_SOURCES) $(ledger_so_DEPENDENCIES)
	CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libledger_la_CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS) -L. -L.libs -Lgdtoa -Lgdtoa/.libs" \
	PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
	    python $(srcdir)/setup.py build --build-lib=.

install-exec-hook:
	CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libledger_la_CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS) -L. -L.libs -Lgdtoa -Lgdtoa/.libs" \
	PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
	    python $(srcdir)/setup.py install --prefix=$(prefix)

endif

###############################################################################

TESTS = UnitTests
if HAVE_BOOST_PYTHON
TESTS += PyUnitTests
endif

check_PROGRAMS = $(TESTS)

nodist_UnitTests_SOURCES = tests/UnitTests.cc \
	\
	tests/utility/t_utils.cc      \
	tests/utility/t_times.cc      \
	tests/numerics/t_commodity.cc \
	tests/numerics/t_amount.cc    \
	tests/numerics/t_balance.cc

UnitTests_CPPFLAGS = -I$(srcdir)/tests $(libledger_la_CPPFLAGS)
UnitTests_LDFLAGS  = $(LIBADD_DL)
UnitTests_LDADD    = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit

nodist_PyUnitTests_SOURCES = tests/python/PyUnitTests.py

# jww (2007-05-10): This rule will not be triggered on systems that
# define an EXEEXT.
PyUnitTests: $(srcdir)/tests/python/PyUnitTests.py
	cat $(srcdir)/tests/python/PyUnitTests.py \
	    | sed "s/%srcdir%/$(ESC_srcdir)/g" \
	    | sed "s/%builddir%/$(ESC_builddir)/g" > $@
	chmod 755 $@

fullcheck: check
	MallocGuardEdges=1	 \
	MallocScribble=1	 \
	MallocPreScribble=1	 \
	MallocCheckHeapStart=100 \
	MallocCheckHeapEach=100	 \
	DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib \
	$(srcdir)/valgrind.sh $(top_builddir)/UnitTests$(EXEEXT) --verify

###############################################################################

DISTCLEANFILES += Doxyfile.gen

alldocs: docs/ledger.info docs/ledger.pdf doxygen-docs

$(top_builddir)/Doxyfile.gen: $(srcdir)/docs/Doxyfile
	cat $(srcdir)/docs/Doxyfile \
	    | sed "s/%srcdir%/$(ESC_srcdir)/g" \
	    | sed "s/%builddir%/$(ESC_builddir)/g" > $@

doxygen-docs: $(top_builddir)/Doxyfile.gen
	doxygen $(top_builddir)/Doxyfile.gen

###############################################################################

check-syntax:
	g++ -I. -Itests $(CPPFLAGS) $(UnitTests_CXXFLAGS) \
		-o /dev/null -S $(CHK_SOURCES)

all-clean: maintainer-clean
	rm -fr *~ .*~ .\#* *.html *.info *.pdf *.a *.so *.o *.lo *.la	     \
	       *.elc *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr	     \
	       .gdb_history gmon.out h out TAGS ledger valexpr .deps .libs   \
	       build INSTALL Makefile acconf.h acconf.h.in aclocal.m4	     \
	       autom4te config.guess config.sub configure depcomp install-sh \
	       libtool ltconfig ltmain.sh missing stamp texinfo.tex	     \
	       Makefile.in mkinstalldirs elisp-comp elc-stamp elc-temp	     \
	       py-compile ylwrap compile