blob: 4c57bab2848ab2f1e8bf1993d242fab44372fccf (
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
|
CODE = amount.cc balance.cc account.cc ledger.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
#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/httpd/xml
LIBS := $(LIBS) -L/sw/lib -lxmlparse
endif
all: make.deps 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)
report: libledger.a report.cc
$(CXX) $(CFLAGS) $(INCS) $(DFLAGS) -DTEST -o $@ report.cc \
-L. -lledger $(LIBS)
ledger.info: ledger.texi
makeinfo $<
ledger.pdf: ledger.texi
texi2pdf $<
%.o: %.cc
$(CXX) $(CFLAGS) $(INCS) $(DFLAGS) -c -o $@ $<
clean:
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 *.texi *.info *.html *.pdf *.elc make.deps TAGS
rebuild: clean deps all
deps: make.deps
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)
|