]> git.donarmstrong.com Git - lilypond.git/blob - GNUmakefile.in
Merge ssh+git://hanwen@repo.or.cz/srv/git/lilypond into master-hanwen
[lilypond.git] / GNUmakefile.in
1 # -*-Makefile-*-
2
3 depth = .
4
5 SUBDIRS = buildscripts python scripts \
6         flower lily \
7         mf ly \
8         tex ps scm \
9         po make \
10         elisp vim \
11         input \
12         stepmake $(documentation-dir)
13
14
15 ## this convoluted construction is necessary, since we don't know the
16 ## value of DOCUMENTATION here.
17 documentation-dir=$(if $(findstring no,$(DOCUMENTATION)),,Documentation)
18
19 SCRIPTS = configure autogen.sh 
20 README_FILES = ChangeLog COPYING DEDICATION ROADMAP THANKS HACKING
21 TOPDOC_FILES=AUTHORS README INSTALL NEWS
22 TOPDOC_TXT_FILES = $(addprefix $(top-build-dir)/Documentation/topdocs/$(outdir)/,$(addsuffix .txt,$(TOPDOC_FILES)))
23 IN_FILES := $(call src-wildcard,*.in)
24
25 EXTRA_DIST_FILES = VERSION .cvsignore .gitignore SConstruct \
26   $(README_FILES) $(SCRIPTS) $(IN_FILES) 
27 INSTALLATION_DIR=$(local_lilypond_datadir)
28 INSTALLATION_FILES=$(config_make) VERSION
29
30 # bootstrap stepmake:
31 #
32 STEPMAKE_TEMPLATES=toplevel po install
33 include $(depth)/make/stepmake.make
34
35 local-dist: dist-toplevel-txt-files 
36
37 default: $(outdir)/VERSION
38
39 $(outdir)/VERSION: $(config_make)
40         echo $(TOPLEVEL_VERSION) > $@
41
42 dist-toplevel-txt-files:
43         -mkdir -p $(distdir)
44         ln $(TOPDOC_TXT_FILES) $(distdir)/
45         ln $(top-src-dir)/stepmake/aclocal.m4 $(distdir)/
46
47 doc: 
48         $(MAKE) -C Documentation
49
50 install-WWW:
51         -$(INSTALL) -m 755 -d $(DESTDIR)$(webdir)
52         cp -a $(outdir)/web-root/ $(DESTDIR)$(webdir)/
53
54         $(MAKE) -C Documentation/user local-install-WWW
55         $(MAKE) -C Documentation/user install-info
56
57 install-help2man:
58         $(MAKE) -C scripts man install-help2man
59         $(MAKE) -C lily man install-help2man
60
61 web-install:
62         $(MAKE) out=www install-WWW
63
64 uninstall-WWW:
65         echo TODO
66
67 web-uninstall:
68         $(MAKE) out=www uninstall-WWW
69
70 local-install:
71         $(INSTALL) -d $(DESTDIR)$(local_lilypond_datadir)
72
73 final-install:
74         @true
75
76 web-ext = html midi pdf png txt ly signature
77
78 footify = $(PYTHON) $(step-bindir)/add-html-footer.py  --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION)
79 footifymail = MAILADDRESS='http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs'
80
81
82
83 local-WWW-post:
84 # need UTF8 setting in case this is hosted on a website. 
85         echo -e 'AddDefaultCharset utf-8\nAddCharset utf-8 .html\nAddCharset utf-8 .en\nAddCharset utf-8 .nl\nAddCharset utf-8 .txt\n' > $(top-build-dir)/.htaccess
86         $(PYTHON) $(buildscript-dir)/mutopia-index.py -o $(outdir)/examples.html input/
87         echo '<META HTTP-EQUIV="refresh" content="0;URL=Documentation/index.html">' > $(outdir)/index.html
88         echo '<html><body>Redirecting to the documentation index...</body></html>' >> $(outdir)/index.html
89
90         cd $(top-build-dir) && $(FIND) . -name '*.html' -print | $(footifymail) xargs $(footify)
91
92         cd $(top-build-dir) && find Documentation input \
93                 $(web-ext:%=-path '*/out-www/*.%' -or) -type l \
94                 | grep -v 'lily-[0-9].*.pdf' \
95                 > $(outdir)/weblist
96         ls $(outdir)/*.html >> $(outdir)/weblist
97
98 ## urg: this is too hairy, should write a python script to do this.
99
100 ## rewrite file names so we lose out-www
101         rm -rf $(outdir)/web-root/ 
102         mkdir $(outdir)/web-root/
103 ## urg slow.
104         cat $(outdir)/weblist | (cd $(top-build-dir); tar -cf-  -T- ) | \
105                 tar -C $(outdir)/web-root/ -xf -  
106         for dir in $(outdir)/web-root/ ; do  \
107                 cd $$dir && \
108                 for a in `find . -name out-www`; do \
109                         rsync -a  --link-dest $$a/ $$a/ $$a/.. ; \
110                         rm -rf $$a ; \
111                 done \
112         done
113         echo $(TOPLEVEL_VERSION) > $(outdir)/web-root/VERSION
114
115 tree-prefix = $(outdir)
116 tree-bin = $(tree-prefix)/bin
117 tree-lib = $(tree-prefix)/lib
118 tree-share = $(tree-prefix)/share
119 tree-share-prefix = $(tree-share)/lilypond/$(TOPLEVEL_VERSION)
120 tree-share-prefix-current = $(tree-share)/lilypond/current
121 tree-lib-prefix = $(tree-lib)/lilypond/$(TOPLEVEL_VERSION)
122 tree-lib-prefix-current = $(tree-lib)/lilypond/current
123
124 C_DIRS = flower lily
125 c-clean:
126         $(foreach i, $(C_DIRS), $(MAKE) -C $(i) clean &&) true
127
128 src-ext = c cc yy ll hh icc py scm tex ps texi itexi tely itely sh
129
130 web-clean:
131         $(MAKE) out=www clean
132         $(MAKE) $(tree-share-prefix)/lilypond-force
133
134 default: $(config_h) build-dir-setup 
135
136 build-dir-setup: $(tree-share-prefix)/lilypond-force
137
138 PO_FILES = $(call src-wildcard,$(src-depth)/po/*.po)
139 HELP_CATALOGS = $(PO_FILES:po/%.po=%)
140 CATALOGS = $(HELP_CATALOGS:lilypond=) 
141
142 $(tree-share-prefix)/lilypond-force link-tree: GNUmakefile
143 # Preparing LilyPond tree for build-dir exec
144         cd $(top-build-dir)/$(outbase) && rm -rf bin lib share
145         mkdir -p $(tree-bin)
146         mkdir -p $(tree-share-prefix)
147         ln -s $(TOPLEVEL_VERSION) $(tree-share-prefix-current)
148         mkdir -p $(tree-lib-prefix)
149         ln -s $(TOPLEVEL_VERSION) $(tree-lib-prefix-current)
150         mkdir -p $(tree-share-prefix)/dvips
151         mkdir -p $(tree-share-prefix)/elisp
152         mkdir -p $(tree-share-prefix)/fonts
153         mkdir -p $(tree-share-prefix)/fonts/otf
154         mkdir -p $(tree-share-prefix)/fonts/tfm
155         mkdir -p $(tree-share-prefix)/fonts/type1
156         mkdir -p $(tree-share-prefix)/fonts/svg
157         mkdir -p $(tree-share-prefix)/fonts/map
158         mkdir -p $(tree-share-prefix)/fonts/enc
159         mkdir -p $(tree-share-prefix)/tex
160         cd $(tree-bin) && \
161                 ln -sf ../../lily/$(outconfbase)/lilypond . && \
162                 for i in abc2ly convert-ly etf2ly lilypond-book lilypond-invoke-editor midi2ly musicxml2ly; \
163                         do ln -sf ../../scripts/$(outconfbase)/$$i . ; done
164         cd $(tree-lib-prefix) && \
165                 ln -s ../../../../python/$(outconfbase) python
166         cd $(tree-share-prefix) && \
167                 ln -s $(top-src-dir)/ly ly && \
168                 ln -s ../../../../mf mf && \
169                 ln -s $(top-src-dir)/ps && \
170                 ln -s ../../../../python/$(outconfbase) python && \
171                 ln -s $(top-src-dir)/scm && \
172                 ln -s $(top-src-dir)/scripts scripts
173         cd $(tree-share-prefix)/dvips && \
174                 ln -s ./../../../mf/$(outconfbase) mf-out && \
175                 ln -s $(top-src-dir)/ps
176         cd $(tree-share-prefix)/tex && \
177                 ln -s $(top-src-dir)/tex source && \
178                 ln -s ../../../../../tex/$(outconfbase) tex-out && \
179                 ln -s ../../../../../mf/$(outconfbase) mf-out
180
181         cd $(tree-share-prefix)/fonts && \
182                 ln -s $(top-src-dir)/mf source && \
183                 true
184         -cd $(tree-share-prefix)/elisp && \
185                 ln -sf ../../../../../../elisp/$(outconfbase)/lilypond-words.el . && \
186                 ln -s $(top-src-dir)/elisp/*.el .
187         $(foreach i,$(CATALOGS), \
188                 (mkdir -p $(tree-share)/locale/$i/LC_MESSAGES && \
189                 cd $(tree-share)/locale/$i/LC_MESSAGES && \
190                 ln -sf ../../../../../po/$(outconfbase)/$i.mo lilypond.mo) &&) true
191         touch $(tree-share-prefix)/lilypond-force
192
193 $(tree-share-prefix)/mf-link-tree link-mf-tree: $(tree-share-prefix)/lilypond-force
194         -rm -f $(tree-share-prefix)/fonts/otf/* &&  \
195         rm -f $(tree-share-prefix)/fonts/svg/* &&  \
196         rm -f $(tree-share-prefix)/fonts/tfm/* &&  \
197         rm -f $(tree-share-prefix)/fonts/type1/* &&  \
198                 cd $(tree-share-prefix)/fonts/otf && \
199                 ln -s ../../../../../../mf/$(outconfbase)/*.otf .
200         -cd $(tree-share-prefix)/fonts/svg && \
201                 ln -s ../../../../../../mf/$(outconfbase)/*.svg .
202         -cd $(tree-share-prefix)/fonts/tfm && \
203                 ln -s ../../../../../../mf/$(outconfbase)/*.tfm .
204         -cd $(tree-share-prefix)/fonts/type1 && \
205                 ln -s ../../../../../../mf/$(outconfbase)/*.pfa .
206
207 TAGS.make: dummy
208         etags -o $@ $(find $(srcdir) -name 'GNUmakefile*' -o -name '*.make')
209
210 local-clean: build-dir-setup-clean local-web-clean
211
212 local-web-clean:
213         rm -rf $(outdir)/web-root/
214
215
216
217 build-dir-setup-clean:
218         cd $(top-build-dir) && rm -rf share
219
220 $(config_h): config.hh.in
221 #
222 # this is to prevent people from getting
223 # undefined symbols  when we add them to config.h.in,
224 # and they blindly run "cvs update; make".
225 #
226         @echo
227         @echo ' *** $(config_h) is out of date'
228         @echo ' *** Remove it and rerun autogen:'
229         @echo '         rm $(config_h); ./autogen.sh'
230         @echo
231         @false