summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 4e5cdb86fe221061c5211cad4fcf6012c0b86550 (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
SUBDIRS = gdtoa


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

EXTRA_DIST = docs tests ledger.pdf ledger.info

#(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

libledger_la_CXXFLAGS = $(WARNFLAGS) -I$(top_builddir)/gdtoa
libledger_la_SOURCES = \
	amount.cc      \
	times.cc       \
	parsetime.yy   \
	scantime.ll    \
	quotes.cc      \
	balance.cc     \
	value.cc       \
	xml.cc         \
	xpath.cc       \
	mask.cc        \
	format.cc      \
	util.cc        \
		       \
	session.cc     \
	journal.cc     \
	parser.cc      \
	textual.cc     \
	binary.cc      \
	xmlparse.cc    \
	qif.cc	       \
		       \
	report.cc      \
	transform.cc   \
		       \
	register.cc    \
		       \
	csv.cc         \
	derive.cc      \
	emacs.cc       \
	reconcile.cc

if HAVE_EXPAT
libledger_la_CXXFLAGS += -DHAVE_EXPAT=1
libledger_la_SOURCES += gnucash.cc
endif
if HAVE_XMLPARSE
libledger_la_CXXFLAGS += -DHAVE_XMLPARSE=1
libledger_la_SOURCES += gnucash.cc
endif
if HAVE_LIBOFX
libledger_la_CXXFLAGS += -DHAVE_LIBOFX=1
libledger_la_SOURCES += ofx.cc
endif
if DEBUG
libledger_la_CXXFLAGS += -DDEBUG_LEVEL=4
libledger_la_SOURCES  += debug.cc trace.cc
endif
if HAVE_BOOST_PYTHON
libledger_la_CXXFLAGS += -DUSE_BOOST_PYTHON=1
endif

libledger_la_LDFLAGS = -release 3.0


libpyledger_la_CXXFLAGS = -DUSE_BOOST_PYTHON=1
libpyledger_la_SOURCES = \
	py_eval.cc       \
	py_amount.cc

if DEBUG
libpyledger_la_CXXFLAGS += -DDEBUG_LEVEL=4
endif

libpyledger_la_LDFLAGS = -release 3.0


pkginclude_HEADERS = \
	amount.h     \
	times.h      \
	parsetime.h  \
	balance.h    \
	binary.h     \
	csv.h	     \
	debug.h	     \
	derive.h     \
	emacs.h	     \
	error.h	     \
	fdstream.hpp \
	format.h     \
	gnucash.h    \
	journal.h    \
	ledger.h     \
	mask.h	     \
	ofx.h	     \
	option.h     \
	parser.h     \
	py_eval.h    \
	pyfstream.h  \
	pyledger.h   \
	qif.h	     \
	quotes.h     \
	reconcile.h  \
	report.h     \
	session.h    \
	textual.h    \
	timing.h     \
	trace.h	     \
	transform.h  \
	util.h	     \
	value.h	     \
	xml.h        \
	xmlparse.h   \
	xpath.h

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

bin_PROGRAMS = ledger

ledger_CXXFLAGS =
ledger_SOURCES = option.cc main.cc
ledger_LDADD = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la $(LEXLIB)

if HAVE_EXPAT
ledger_CXXFLAGS += -DHAVE_EXPAT=1
endif
if HAVE_XMLPARSE
ledger_CXXFLAGS += -DHAVE_XMLPARSE=1
endif
if HAVE_LIBOFX
ledger_CXXFLAGS += -DHAVE_LIBOFX=1
endif
if HAVE_BOOST_PYTHON
ledger_CXXFLAGS += -DUSE_BOOST_PYTHON=1
ledger_LDADD += libpyledger.la
endif
if DEBUG
ledger_CXXFLAGS += -DDEBUG_LEVEL=4
endif
ledger_LDFLAGS = -static	# for the sake of command-line speed

info_TEXINFOS = ledger.texi

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

lisp_LISP = ledger.el timeclock.el

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

if HAVE_BOOST_PYTHON

noinst_PROGRAMS = ledger.so

ledger_so_SOURCES = pyledger.cc

PYLIBS = pyledger ledger gdtoa boost_date_time boost_regex boost_python gmp

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

if DEBUG
DEBUG_LEVEL = 4
else
DEBUG_LEVEL = 0
endif

ledger.so: pyledger.cc libledger.la gdtoa/libgdtoa.la libpyledger.la
	SRCDIR="$(srcdir)" \
	CFLAGS="$(CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS) -L. -L.libs -Lgdtoa -Lgdtoa/.libs" \
	PYLIBS="$(PYLIBS)" \
	DEBUG_LEVEL="$(DEBUG_LEVEL)" \
	    python $(srcdir)/setup.py build --build-lib=.

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

endif

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

TESTS = UnitTests
if HAVE_BOOST_PYTHON
TESTS += PyUnitTests
endif

check_PROGRAMS = $(TESTS)

UnitTests_SOURCES = tests/UnitTests.cc \
	\
	tests/corelib/numerics/BasicAmount.cc \
	tests/corelib/numerics/CommodityAmount.cc \
	tests/corelib/numerics/DateTime.cc \
	tests/corelib/numerics/Commodity.cc

UnitTests_LDADD   = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit
UnitTests_LDFLAGS = $(LIBADD_DL)

UnitTests_CXXFLAGS = -I. -I$(srcdir)/tests
if HAVE_EXPAT
UnitTests_CXXFLAGS += -DHAVE_EXPAT=1
endif
if HAVE_XMLPARSE
UnitTests_CXXFLAGS += -DHAVE_XMLPARSE=1
endif
if HAVE_LIBOFX
UnitTests_CXXFLAGS += -DHAVE_LIBOFX=1
endif
if DEBUG
UnitTests_CXXFLAGS += -DDEBUG_LEVEL=4
endif

PyUnitTests_SOURCES =

PyUnitTests: PyUnitTests.py
	cat $(srcdir)/PyUnitTests.py | sed "s/%srcdir%/$(ESC_srcdir)/g" \
	    | sed "s/%builddir%/$(ESC_builddir)/g" > PyUnitTests
	chmod 755 PyUnitTests

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

alldocs: ledger.info ledger.pdf doxygen-docs

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

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

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

all: check

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