summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 6fac1788e35c2aa7922c882adef4d7235a978b47 (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
289
BUILT_SOURCES =
CLEANFILES    =
EXTRA_DIST    = LICENSE doc test contrib scripts setup.py \
		acprep valgrind.sh version

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

dist-hook:
	rm -fr .git

lib_LTLIBRARIES = libamounts.la libledger.la

libamounts_la_CPPFLAGS =
libamounts_la_SOURCES = \
	amount.cc      \
	commodity.cc   \
	balance.cc     \
	value.cc       \
	times.cc       \
	utils.cc
if HAVE_EXPAT
libamounts_la_CPPFLAGS += -DHAVE_EXPAT=1
endif
if HAVE_XMLPARSE
libamounts_la_CPPFLAGS += -DHAVE_XMLPARSE=1
endif
if HAVE_LIBOFX
libamounts_la_CPPFLAGS += -DHAVE_LIBOFX=1
endif
if HAVE_BOOST_PYTHON
libamounts_la_CPPFLAGS += -DUSE_BOOST_PYTHON=1
endif
if DEBUG
libamounts_la_CPPFLAGS += -DDEBUG_MODE
endif

libledger_la_CPPFLAGS = $(libamounts_la_CPPFLAGS)
libledger_la_SOURCES = \
	binary.cc      \
	config.cc      \
	csv.cc         \
	derive.cc      \
	emacs.cc       \
	format.cc      \
	journal.cc     \
	mask.cc        \
	option.cc      \
	parser.cc      \
	qif.cc	       \
	reconcile.cc   \
	report.cc      \
	startup.cc     \
	textual.cc     \
	valexpr.cc     \
	walk.cc        \
	xml.cc
#	quotes.cc      this is currently not being included
if HAVE_EXPAT
libledger_la_SOURCES += gnucash.cc
endif
if HAVE_XMLPARSE
libledger_la_SOURCES += gnucash.cc
endif
if HAVE_LIBOFX
libledger_la_SOURCES += ofx.cc
endif

libledger_la_LDFLAGS = -release 2.6.0.90

pkginclude_HEADERS = \
	acconf.h     \
		     \
	amount.h     \
	commodity.h  \
	balance.h    \
	balpair.h    \
	value.h      \
	times.h	     \
	utils.h	     \
		     \
	binary.h     \
	config.h     \
	csv.h        \
	derive.h     \
	emacs.h      \
	error.h      \
	format.h     \
	gnucash.h    \
	journal.h    \
	ledger.h     \
	mask.h       \
	option.h     \
	parser.h     \
	qif.h	     \
	quotes.h     \
	reconcile.h  \
	report.h     \
	textual.h    \
	valexpr.h    \
	walk.h       \
	xml.h

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)/system.hh $(top_builddir)/acconf.h
	echo "#include \"$(srcdir)/system.hh\"" > $(top_builddir)/system.hh
	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
		$(libledger_la_CPPFLAGS) \
		$(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
		-g -o $@ $(srcdir)/system.hh
endif

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

bin_PROGRAMS	= ledger

ledger_CPPFLAGS = $(libledger_la_CPPFLAGS)
ledger_SOURCES	= main.cc
ledger_LDADD	= $(LIBOBJS) libamounts.la libledger.la
ledger_LDFLAGS	= -static	# for the sake of command-line speed

info_TEXINFOS   = ledger.texi

dist_lisp_LISP  = ledger.el timeclock.el

DISTCLEANFILES  = ledger.elc timeclock.elc

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

if HAVE_BOOST_PYTHON

noinst_PROGRAMS = amounts.so

CLEANFILES += amounts.so

clean-local:
	rm -fr build

PYLIBS = amounts gmp

amounts.so: amounts.cc libamounts.la
	CFLAGS="$(CPPFLAGS) $(DEFAULT_INCLUDES) $(libamounts_la_CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS) -L. -L.libs" \
	PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
	    python $(srcdir)/setup.py build --build-lib=.

install-exec-hook:
	CFLAGS="$(CPPFLAGS) $(DEFAULT_INCLUDES) $(libamounts_la_CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS) -L. -L.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 = test/UnitTests.cc \
	\
	test/utility/t_utils.cc      \
	test/utility/t_times.cc      \
	test/numerics/t_commodity.cc \
	test/numerics/t_amount.cc    \
	test/numerics/t_balance.cc

UnitTests_CPPFLAGS = -I$(srcdir)/test $(libledger_la_CPPFLAGS)
UnitTests_LDFLAGS  = $(LIBADD_DL)
UnitTests_LDADD    = $(lib_LTLIBRARIES) -lcppunit

nodist_PyUnitTests_SOURCES = test/python/PyUnitTests.py

# jww (2007-05-10): This rule will not be triggered on systems that
# define an EXEEXT.
PyUnitTests: $(srcdir)/test/python/PyUnitTests.py
	cat $(srcdir)/test/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: 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

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

clean-backupfiles:
	rm -fr *~  \
	       .*~ \
	       .\#*

clean-documentation:
	(cd doc; \
	rm -fr *.aux  \
	       *.cp   \
	       *.fn   \
	       *.info \
	       *.ky   \
	       *.log  \
	       *.pdf  \
	       *.pg   \
	       *.toc  \
	       *.tp   \
	       *.vr)

clean-buildproducts:
	rm -fr *.Plo  \
	       *.Po   \
	       *.a    \
	       *.elc  \
	       *.gcno \
	       *.gdca \
	       *.la   \
	       *.lo   \
	       *.o    \
	       *.so   \
	       .deps  \
	       .libs  \
	       build

clean-debugdata:
	rm -fr .gdb_history \
	       TAGS         \
	       gmon.out	    \
	       h	    \
	       out

clean-autoconf:
	rm -fr Makefile	     \
	       Makefile.in   \
	       acconf.h	     \
	       acconf.h.in   \
	       aclocal.m4    \
	       autom4te.cache \
	       compile	     \
	       config.guess  \
	       config.sub    \
	       configure     \
	       depcomp	     \
	       elc-stamp     \
	       elc-temp	     \
	       elisp-comp    \
	       install-sh    \
	       libtool	     \
	       ltconfig	     \
	       ltmain.sh     \
	       missing	     \
	       mkinstalldirs \
	       py-compile    \
	       stamp	     \
	       texinfo.tex   \
	       ylwrap

all-clean: maintainer-clean    \
	   clean-buildproducts \
	   clean-backupfiles   \
	   clean-debugdata     \
	   clean-documentation \
	   clean-autoconf