diff options
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 230 |
1 files changed, 174 insertions, 56 deletions
diff --git a/Makefile.am b/Makefile.am index 5de39382..7ced6a31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,20 +1,31 @@ +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_CXXFLAGS = +libamounts_la_CPPFLAGS = libamounts_la_SOURCES = \ amount.cc \ balance.cc \ - datetime.cc \ value.cc if HAVE_BOOST_PYTHON -libamounts_la_CXXFLAGS += -DUSE_BOOST_PYTHON=1 +libamounts_la_CPPFLAGS += -DUSE_BOOST_PYTHON=1 endif if DEBUG -libamounts_la_CXXFLAGS += -DDEBUG_LEVEL=4 -libamounts_la_SOURCES += debug.cc +libamounts_la_CPPFLAGS += -DDEBUG_MODE +libamounts_la_SOURCES += utils.cc endif -libledger_la_CXXFLAGS = +libledger_la_CPPFLAGS = libledger_la_SOURCES = \ binary.cc \ config.cc \ @@ -36,19 +47,19 @@ libledger_la_SOURCES = \ walk.cc \ xml.cc if HAVE_EXPAT -libledger_la_CXXFLAGS += -DHAVE_EXPAT=1 +libledger_la_CPPFLAGS += -DHAVE_EXPAT=1 libledger_la_SOURCES += gnucash.cc endif if HAVE_XMLPARSE -libledger_la_CXXFLAGS += -DHAVE_XMLPARSE=1 +libledger_la_CPPFLAGS += -DHAVE_XMLPARSE=1 libledger_la_SOURCES += gnucash.cc endif if HAVE_LIBOFX -libledger_la_CXXFLAGS += -DHAVE_LIBOFX=1 +libledger_la_CPPFLAGS += -DHAVE_LIBOFX=1 libledger_la_SOURCES += ofx.cc endif if DEBUG -libledger_la_CXXFLAGS += -DDEBUG_LEVEL=4 +libledger_la_CPPFLAGS += -DDEBUG_MODE endif libledger_la_LDFLAGS = -release 2.6.0.90 @@ -85,92 +96,199 @@ pkginclude_HEADERS = \ 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)/src/utility/system.hh acconf.h + echo "#include \"src/utility/system.hh\"" > $(top_builddir)/system.hh + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(libledger_la_CPPFLAGS) \ + -o $@ $(srcdir)/src/utility/system.hh +endif + ###################################################################### bin_PROGRAMS = ledger -ledger_CXXFLAGS = +ledger_CPPFLAGS = ledger_SOURCES = main.cc ledger_LDADD = $(LIBOBJS) libamounts.la libledger.la if HAVE_EXPAT -ledger_CXXFLAGS += -DHAVE_EXPAT=1 +ledger_CPPFLAGS += -DHAVE_EXPAT=1 endif if HAVE_XMLPARSE -ledger_CXXFLAGS += -DHAVE_XMLPARSE=1 +ledger_CPPFLAGS += -DHAVE_XMLPARSE=1 endif if HAVE_LIBOFX -ledger_CXXFLAGS += -DHAVE_LIBOFX=1 +ledger_CPPFLAGS += -DHAVE_LIBOFX=1 endif if DEBUG -ledger_CXXFLAGS += -DDEBUG_LEVEL=4 +ledger_CPPFLAGS += -DDEBUG_MODE endif ledger_LDFLAGS = -static # for the sake of command-line speed -info_TEXINFOS = ledger.texi +info_TEXINFOS = doc/ledger.texi ###################################################################### -lisp_LISP = ledger.el timeclock.el 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)" LDFLAGS="$(LDFLAGS) -L. -L.libs" \ - python setup.py build --build-lib=. + CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS)" \ + LDFLAGS="$(LDFLAGS) -L. -L.libs" \ + PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \ + python $(srcdir)/setup.py build --build-lib=. install-exec-hook: - CFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) -L. -L.libs" \ - python setup.py install --prefix=$(prefix) + CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS)" \ + LDFLAGS="$(LDFLAGS) -L. -L.libs" \ + PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \ + python $(srcdir)/setup.py install --prefix=$(prefix) endif ###################################################################### -TESTS = alltests +TESTS = UnitTests +if HAVE_BOOST_PYTHON +TESTS += PyUnitTests +endif -CXXTEST_DIR = /usr/local/cxxtest -TESTGEN = $(CXXTEST_DIR)/cxxtestgen.py -TESTSUITES = tests/*.h +check_PROGRAMS = $(TESTS) -AM_CXXFLAGS = -if HAVE_EXPAT -AM_CXXFLAGS += -DHAVE_EXPAT=1 -endif -if HAVE_XMLPARSE -AM_CXXFLAGS += -DHAVE_XMLPARSE=1 -endif -if HAVE_LIBOFX -AM_CXXFLAGS += -DHAVE_LIBOFX=1 -endif -if DEBUG -AM_CXXFLAGS += -DDEBUG_LEVEL=4 -endif +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 $@ -alltests.cc: $(TESTSUITES) - test -f $(TESTGEN) && python $(TESTGEN) -o $@ --error-printer $(TESTSUITES) +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 -alltests: alltests.cc ledger - $(CXXCOMPILE) -I$(CXXTEST_DIR) -lexpat -lgmp -lpcre -o $@ \ - alltests.cc -L. -L.libs -lamounts -lledger +############################################################################### -runtests: alltests - LD_LIBRARY_PATH=.libs ./alltests && tests/regress && tests/regtest +DISTCLEANFILES += Doxyfile.gen -verify: runtests - python tests/runtests.py +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 ###################################################################### -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 AUTHORS COPYING 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 py-compile +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 |