summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile86
1 files changed, 71 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 6ff88b8b..bbdee80d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,43 @@
-CODE = amount.cc ledger.cc parse.cc reports.cc
+CODE = amount.cc balance.cc account.cc ledger.cc \
+ constraint.cc item.cc expr.cc format.cc \
+ textual.cc binary.cc
OBJS = $(patsubst %.cc,%.o,$(CODE))
#CXX = cc
CXX = g++
-CFLAGS = #-Wall -ansi -pedantic
-DFLAGS = -O3 -fomit-frame-pointer
-#DFLAGS = -g -DDEBUG=1
-INCS = -I/usr/local/include
-LIBS = -L/usr/local/lib -lgmpxx -lgmp -lpcre
+CFLAGS = -Wall -ansi -pedantic
+#DFLAGS = -O3 -fomit-frame-pointer
+DFLAGS = -g -DDEBUG=1
+#DFLAGS = -g -pg
+INCS = -I/sw/include -I/usr/include/gcc/darwin/3.3/c++ -I/usr/include/gcc/darwin/3.3/c++/ppc-darwin
+LIBS = -L/sw/lib -lgmpxx -lgmp -lpcre
ifdef GNUCASH
CODE := $(CODE) gnucash.cc
CFLAGS := $(CFLAGS) -DREAD_GNUCASH=1
-INCS := $(INCS) -I/usr/include/xmltok
-LIBS := $(LIBS) -lxmlparse
+INCS := $(INCS) -I/usr/include/httpd/xml
+LIBS := $(LIBS) -L/sw/lib -lxmlparse
endif
-all: make.deps ledger ledger.info
+all: make.deps ledger
-install: all
- strip ledger
+docs: ledger.info ledger.pdf
+
+install:
+ make clean
+ make DFLAGS="-O3 -fomit-frame-pointer"
cp ledger $(HOME)/bin
+ strip $(HOME)/bin/ledger
+
+libledger.a: $(OBJS)
+ ar rv $@ $?
+ ranlib $@
+
+ledger: libledger.a main.o
+ $(CXX) $(CFLAGS) $(INCS) $(DFLAGS) -o $@ main.o -L. -lledger $(LIBS)
-ledger: $(OBJS)
- $(CXX) $(CFLAGS) $(INCS) $(DFLAGS) -o $@ $(OBJS) $(LIBS)
+report: libledger.a report.cc
+ $(CXX) $(CFLAGS) $(INCS) $(DFLAGS) -DTEST -o $@ report.cc \
+ -L. -lledger $(LIBS)
ledger.info: ledger.texi
makeinfo $<
@@ -34,11 +49,12 @@ ledger.pdf: ledger.texi
$(CXX) $(CFLAGS) $(INCS) $(DFLAGS) -c -o $@ $<
clean:
- rm -f ledger *.o *.elc *~ .\#* .gdb_history README.texi
+ rm -f ledger report libledger.a *.o *.elc *~ .\#*
rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr
+ rm -f .gdb_history
distclean fullclean: clean
- rm -f ledger.info README.html *.pdf *.elc make.deps TAGS
+ rm -f *.texi *.info *.html *.pdf *.elc make.deps TAGS
rebuild: clean deps all
@@ -48,3 +64,43 @@ make.deps: Makefile
cc -M $(INCS) $(CODE) > $@
include make.deps
+
+# These next rules are for my own use.
+
+README.html: README
+ (cd $(HOME)/src/muse && \
+ ./publish --html $(shell pwd)/README && \
+ mv README.html $(shell pwd))
+
+ledger.texi: README
+ (cd $(HOME)/src/muse && \
+ ./publish --texi $(shell pwd)/README && \
+ cat README.texi | sed 's/README\.info/ledger.info/g' \
+ > $(shell pwd)/ledger.texi && \
+ rm README.texi)
+
+VERSION = $(shell scripts/version)
+
+dist:
+ rm -fr /tmp/ledger-$(VERSION)
+ rsync -av --exclude=".*" --exclude="TAGS" --exclude="version" \
+ --exclude="_darcs/" --exclude="ledger.dat" \
+ $(shell pwd)/ /tmp/ledger-$(VERSION)
+ (cd /tmp/ledger-$(VERSION) && \
+ make fullclean && \
+ make docs README.html && \
+ make clean && rm make.deps && \
+ cat Makefile | sed 's/\/sw\//\/usr\/local\//g' > t && \
+ mv t Makefile && \
+ cat Makefile | sed 's/ -I\/usr\/include\/gcc.*//' > t && \
+ mv t Makefile && \
+ perl -ne 'print if 1 .. /^include make.deps/;' Makefile > t && \
+ mv t Makefile && \
+ cd $(HOME)/Public && \
+ tar cvzf ledger-$(VERSION).tar.gz /tmp/ledger-$(VERSION))
+
+publish: dist
+ (cd $(HOME)/Public && \
+ ln -sf ledger-$(VERSION).tar.gz ledger.tar.gz && \
+ rm -fr /tmp/ledger-$(VERSION) && \
+ upload)