summaryrefslogtreecommitdiff
path: root/Makefile
blob: 2d8fa8a3ca4aaa37f6f0b03f33f44bd56119852a (about) (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
MAJVER=0
MINVER=0
PATCHLEVEL=8

TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)

# 
#

include Sources.make
progdocs=$(hdr) $(mycc)
gencc=parser.cc lexer.cc
cc=$(mycc) $(gencc)
obs=$(cc:.cc=.o) 


#dist
.EXPORT_ALL_VARIABLES:

DOCDIR=docdir
VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
PACKAGENAME=lilypond
DNAME=$(PACKAGENAME)-$(VERSION)
othersrc=lexer.l parser.y
SCRIPTS=make_version make_patch genheader
IFILES=dimen.tex symbol.ini suzan.ly maartje.ly\
	lilyponddefs.tex test.tex .dstreamrc
OFILES=Makefile Sources.make COPYING README
DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS)

#compiling
LOADLIBES=-L$(FLOWERDIR) -lflower
FLOWERDIR=../flower
# speedy
#DEFINES=-DNDEBUG -DNPRINT -O2
# lots of debugging info
DEFINES=-g

CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -W  -pedantic 
FLEX=flex
BISON=bison
exe=$(PACKAGENAME)

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

$(exe): $(obs)
	$(CXX) -o $@ $(obs) $(LOADLIBES)
clean:
	rm -f $(exe) *.o $(DOCDIR)/* core  

distclean: clean
	rm -f TAGS depend version.hh $(gencc) .GENERATE *~

all: kompijl doc

# doc++ documentation of classes
doc:
	-mkdir $(DOCDIR)
	doc++ -p -I -d $(DOCDIR) $(progdocs)

depend: Sources.make  .GENERATE
	$(CXX) $(CXXFLAGS) -MM $(cc) > $@

# hack to create these sources once, before the dependencies
.GENERATE:
	touch .GENERATE depend
	$(MAKE) version.hh
	$(MAKE) $(gencc)
	rm -f depend

include depend

parser.cc: parser.y
	$(BISON) -d $<
	mv parser.tab.h parser.hh
	mv parser.tab.c parser.cc

parser.hh: parser.cc

version.o: $(obs) version.hh

version.hh: Makefile make_version
	make_version $(MAJVER) $(MINVER) $(PATCHLEVEL)  > $@

lexer.cc: lexer.l
	$(FLEX) -+ -t $< > $@

DDIR=$(TOPDIR)/$(DNAME)
SUBDIRS=Documentation
dist:
	-mkdir $(DDIR)
	ln $(DFILES) $(DDIR)/
	for a in $(SUBDIRS); \
	do	mkdir $(DDIR)/$$a; \
		$(MAKE) -C $$a dist;\
	done
	tar cfz $(DNAME).tar.gz $(DNAME)/
	rm -rf $(DDIR)/


TAGS: $(mycc) $(hdr) Sources.make
	etags -CT $(mycc) $(hdr)