musicxml2ly: Rewrite `<direction>` handling (12/12): Remove 'new' postfix
[lilypond/mirror.git] / GNUmakefile.in
blob20652d1c2565e0b2623b32bec6e1275962fadaba
1 # -*-Makefile-*-
3 depth = .
5 SUBDIRS = python scripts \
6 flower lily \
7 mf ly \
8 ps scm \
9 po \
10 elisp vim \
11 input \
12 $(documentation-dir)
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)
19 README_FILES = README.md COPYING COPYING.FDL DEDICATION ROADMAP \
20 LICENSE LICENSE.DOCUMENTATION LICENSE.OFL
21 TOPDOC_FILES = AUTHORS INSTALL NEWS
22 TOPDOC_TXT_FILES = $(foreach T,$(TOPDOC_FILES),Documentation/$(outdir)/topdocs/$(T).txt)
24 RELEASE_FILES = RELEASE-COMMIT
25 RELEASE_OUT_FILES = $(RELEASE_FILES:%=$(outdir)/%)
26 INSTALLATION_DIR=$(local_lilypond_datadir)
27 INSTALLATION_FILES=$(config_make) VERSION
28 GENERATED_BUILD_FILES=configure aclocal.m4 autogen.sh
30 TEMPLATES = install lilypond
32 include $(depth)/make/lilypond.make
34 .PHONY: test info website
36 dist: $(GENERATED_BUILD_FILES) top-doc refresh-release-files
37 $(call ly_progress,Packing,$(DIST_NAME).tar.gz)
38 @if ! test -e $(top-src-dir)/.git ; \
39 then echo "*** dist needs a git repository" \
40 exit 1 ; \
42 @cd $(top-src-dir) && if ! git diff --quiet HEAD ; \
43 then echo "*** dist must been rolled on a clean git tree;"; \
44 echo "uncommitted changes detected, aborting."; \
45 exit 1 ; \
47 rm -rf $(distdir)
48 mkdir -p $(distdir)
49 $(LN) $(RELEASE_OUT_FILES) $(TOPDOC_TXT_FILES) $(distdir)
50 $(LN) $(GENERATED_BUILD_FILES:%=$(src-dir)/%) $(distdir)
51 (cd $(top-src-dir) && git ls-files) | \
52 rsync -a --files-from=- --link-dest=$(top-src-dir) $(top-src-dir) $(distdir)
53 chmod -R a+r $(distdir)
54 chmod a+x `find $(distdir) -type d -print`
55 (cd $(outdir); \
56 $(TAR) --sort=name --mtime="$$(git --git-dir=$(top-src-dir)/.git log -1 --format=%cD)" \
57 -cf - --owner=0 --group=0 $(DIST_NAME) | gzip -9 > $(DIST_NAME).tar.gz)
58 rm -rf $(distdir)
60 top-doc:
61 $(MAKE) -C Documentation $(foreach T,$(TOPDOC_FILES),$(outdir)/topdocs/$(T).txt)
63 all: $(outdir)/VERSION
65 $(outdir)/VERSION: $(config_make) VERSION
66 $(call ly_progress,Making,$@,)
67 -mkdir -p $(outdir)
68 echo $(TOPLEVEL_VERSION) > $@
70 $(outdir)/RELEASE-COMMIT:
71 $(call ly_progress,Making,$@,)
72 git --git-dir=$(top-src-dir)/.git show --no-patch HEAD > $@
74 refresh-release-files:
75 @if ! test -e $(top-src-dir)/.git ; \
76 then echo "*** dist needs a git repository" \
77 exit 1 ; \
79 rm -f $(RELEASE_OUT_FILES)
80 $(MAKE) $(RELEASE_OUT_FILES)
83 # Guile bytecode
84 bytecode: all
85 $(MAKE) -C scm bytecode
87 install-bytecode: install
88 $(MAKE) -C scm install-bytecode
90 # PO files
92 po:
93 if test -r $(po-srcdir); then \
94 rm -f $(po-outdir)/$(package).po; \
95 mkdir -p $(po-outdir); \
96 touch $(po-outdir)/$(package).po; \
98 $(LOOP)
100 po-update: po
101 $(MAKE) -C $(po-outdir)/.. po-update
103 po-replace: po
104 $(MAKE) -C $(po-outdir)/.. po-replace
106 info:
107 $(MAKE) out=www -C Documentation info
109 install-info:
110 $(MAKE) COPY_INFO_IMAGES=yes out=www -C Documentation install-info
112 install-info-noimages:
113 $(MAKE) COPY_INFO_IMAGES=no out=www -C Documentation install-info
115 uninstall-info:
116 $(MAKE) out=www -C Documentation uninstall-info
118 install-help2man:
119 $(MAKE) -C scripts man install-help2man
120 $(MAKE) -C lily man install-help2man
122 install-doc: install-info-noimages install-WWW
124 uninstall-doc: uninstall-info uninstall-WWW
126 local-install:
127 $(INSTALLPY) -d $(DESTDIR)$(local_lilypond_datadir)
129 final-install:
130 @true
132 # All web targets, except info image symlinks and info docs are
133 # installed in non-recursing target from TOP-SRC-DIR
134 install-WWW: $(outdir)/offline-root/index.html
135 $(INSTALLPY) -m 755 -d $(DESTDIR)$(webdir)
136 rsync -rl --exclude='*.signature' $(dir $<) $(DESTDIR)$(webdir)
138 uninstall-WWW:
139 rm -rf $(DESTDIR)$(package_docdir)
140 $(MAKE) out=www -C Documentation uninstall
142 # For online docs with content negotiation, issue `make doc WEB_TARGETS=online'
143 # For both online and offline docs, issue `make doc WEB_TARGETS="offline online"'
144 WEB_TARGETS = offline
146 WEB_ROOT_FILES = $(WEB_TARGETS:%=$(outdir)/%-root/index.html)
148 WWW-post: $(WEB_ROOT_FILES)
150 $(outdir)/%-root/index.html: doc-build
151 $(call ly_progress,Making,$@,)
152 rm -rf $(dir $@)/
153 for d in . musicxml abc2ly lilypond-book ; do \
154 mkdir -p $(dir $@)/input/regression/$${d}; \
155 rsync -a --link-dest=$(build-dir)/input/regression/$${d}/out-www \
156 input/regression/$${d}/out-www/ \
157 $(dir $@)/input/regression/$${d} ; \
158 done
159 find $(dir $@)/input/regression/ \
160 -type f \
161 -not -name '*.png' \
162 -not -name '*.ly' \
163 -not -name '*.html' \
164 -not -name '*.xml' \
165 -not -name '*.mxl' \
166 -not -name 'collated-files.pdf' \
167 -delete
168 mkdir -p $(dir $@)/Documentation/
169 rsync -a --link-dest=$(build-dir)/Documentation/out-www/webdoc \
170 Documentation/out-www/webdoc/ \
171 $(dir $@)/Documentation
172 rsync -a --link-dest=$(build-dir)/Documentation/$(outdir)/topdocs \
173 $(TOPDOC_TXT_FILES) \
174 $(dir $@)
175 # No link because the files come from the source directory.
176 cp $(addprefix $(src-dir)/,$(README_FILES)) $(dir $@)
177 $(PYTHON) $(buildscript-dir)/www_post.py --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION) \
178 $(if $(CPU_COUNT),--job-count=$(CPU_COUNT),) --target "$*" $(dir $@)
179 find $(outdir)/$*-root -type l -delete
180 cd $(outdir)/$*-root && \
181 find . \
182 -name "*.html" \
183 -execdir $(buildscript-dir)/fix-docsize.sh {} +
184 find $(dir $@)/Documentation \
185 -maxdepth 1 \
186 -name "*html" | \
187 xargs $(PERL) -i -p \
188 -e 's#(href)="\.\./Documentation/#\1="#g'
189 find $(dir $@)/Documentation \
190 -mindepth 2 -maxdepth 2 \
191 -name "*html" | \
192 xargs $(PERL) -i -p \
193 -e 's#(href)="\.\./\.\./Documentation/#\1="../#g'
194 # Fix up links to CSS files.
195 find $(dir $@)/input/regression \
196 -maxdepth 1 \
197 -name "*html" | \
198 xargs $(PERL) -i -p \
199 -e 's#(href)="css/#\1="../../Documentation/css/#g'
200 find $(dir $@)/input/regression \
201 -mindepth 2 -maxdepth 2 \
202 -name "*html" | \
203 xargs $(PERL) -i -p \
204 -e 's#(href)="css/#\1="../../../Documentation/css/#g'
206 doc-build: top-doc
207 $(MAKE) out=www -C Documentation/ doc
208 $(MAKE) out=www -C input/regression/ doc
210 website: $(outdir)/website-root/index.html
212 $(outdir)/website-root/index.html: website-build
213 $(call ly_progress,Making,$@,)
214 rm -rf $(dir $@)/
215 mkdir -p $(dir $@)/
216 rsync -a Documentation/out-web/website/web/ $(dir $@)
217 $(foreach d,css misc pictures ly-examples,\
218 rsync -a Documentation/out-web/website/$(d) $(dir $@) &&) true
219 $(PYTHON) $(buildscript-dir)/www_post.py --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION) \
220 $(if $(CPU_COUNT),--job-count=$(CPU_COUNT),) --target offline $(dir $@)
221 $(call ly_progress,Fix up,links,to subdirectories)
222 $(PERL) \
223 -i -p \
224 -e 's#(href|src)="\.\./(misc|pictures|ly-examples|css|doc)#\1="\2#g' \
225 $(dir $@)/*html
226 $(call ly_progress,Simplify,links,to self)
227 $(PERL) -i -pe 's#(href)="\.\./web/#\1="#g' $(dir $@)/*html
229 website-build:
230 $(MAKE) out=web WEB_VERSION=yes -C Documentation/ website
232 # For those who cannot for the life in them remember to type
233 # WEB_TARGETS=..., just bloody make all doc stuff, already.
234 all-doc:
235 $(MAKE) WEB_TARGETS='online offline' doc
237 tree-prefix = $(outdir)
238 tree-bin = $(tree-prefix)/bin
239 tree-lib = $(tree-prefix)/lib
240 tree-share = $(tree-prefix)/share
242 # Don't put version numbers here. During development
243 # they make no sense, and cause EPS files to become invalid.
245 tree-lib-prefix = $(tree-lib)/lilypond/current
246 tree-share-prefix = $(tree-share)/lilypond/current
248 src-ext = c cc yy ll hh icc py scm tex ps texi itexi tely itely sh
250 default: $(config_h) link-tree doc-messages
252 link-tree: $(tree-prefix)/lilypond-force
254 # Preparing LilyPond tree for build-dir exec
255 $(tree-prefix)/lilypond-force: GNUmakefile GNUmakefile.in $(outdir)/VERSION
256 $(call ly_progress,Making,$@,)
257 rm -rf $(tree-bin) $(tree-lib) $(tree-share)
258 mkdir -p $(tree-bin)
259 mkdir -p $(tree-lib-prefix)
260 mkdir -p $(tree-share-prefix)
261 mkdir -p $(tree-share-prefix)/fonts
262 mkdir -p $(tree-share-prefix)/scm
263 cd $(tree-bin) && \
264 ln -sf ../../lily/$(outconfbase)/lilypond . && \
265 for i in abc2ly convert-ly etf2ly lilymidi lilypond-book lilypond-invoke-editor midi2ly musicxml2ly; \
266 do ln -sf ../../scripts/$(outconfbase)/$$i . ; done
267 mkdir -p $(tree-lib-prefix)/ccache && \
268 ln -s ../../../../../scm/$(outconfbase)/ $(tree-lib-prefix)/ccache/lily
269 cd $(tree-share-prefix)/fonts && \
270 for i in 00-lilypond-fonts.conf 99-lilypond-fonts.conf \
271 emmentaler-font.conf; do \
272 ln -s $(top-src-dir)/mf/$$i .; done
273 # Just link the entire directory, even if it puts the "wrong" files into the
274 # "wrong" directory, such as *.otf into svg/.
275 cd $(tree-share-prefix)/fonts && \
276 for i in otf svg; do \
277 ln -s ../../../../../mf/$(outconfbase) $$i; done
278 cd $(tree-share-prefix) && for i in ly python; do \
279 ln -s $(top-src-dir)/$$i; done
280 cd $(tree-share-prefix) && \
281 ln -s ../../../../ps/$(outconfbase) ps
282 cd $(tree-share-prefix)/scm && \
283 ln -s ../../../../../scm/$(outconfbase) lily
284 touch $@
286 TAGS.make: dummy
287 $(call ly_progress,Making,$@,)
288 etags -o $@ $(find $(top-src-dir) -name 'GNUmakefile*' -o -name '*.make')
290 $(config_h): config.hh.in
292 # this is to prevent people from getting
293 # undefined symbols when we add them to config.h.in,
294 # and they blindly run "cvs update; make".
296 @echo
297 @echo ' *** $(config_h) is out of date'
298 @echo ' *** Remove it and rerun autogen:'
299 @echo ' rm $(config_h); ./autogen.sh'
300 @echo
301 @false
303 grand-replace:
304 cd $(top-src-dir) && $(PYTHON) $(buildscript-dir)/grand-replace.py
307 ################################################################
308 # testing
310 BASELINE_STAMP:=$(top-build-dir)/out-baseline/.test-baseline-done
311 RESULT_DIR=$(top-build-dir)/out/test-results
313 test-pre: link-tree
314 $(call make_subdirs,python scripts flower lily mf,all)
316 test: test-pre
317 $(MAKE) -C python local-test
318 $(MAKE) -C scripts/build local-test
319 $(MAKE) -C ly local-test
320 @echo 'To begin investigating regression-test crashes, try this:'
321 @echo
322 @echo ' grep -L systems.texi out/lybook-testdb/*/*log | sed s/log/ly/g | xargs grep -H sourcefilename'
323 @echo
324 @echo 'Matching lines may provide original test source file names.'
325 @echo 'The .ly files in which they appear are preprocessed test input.'
326 @echo 'The corresponding .log files may have errors or warnings.'
327 @echo
328 @echo 'If the above is not helpful, try sifting through this:'
329 @echo
330 @echo ' find out/lybook-testdb -name "*.log" | xargs grep -H "\(error\|warning\)"'
331 @echo
332 $(MAKE) -C input/regression out=test lysdoc-test
333 $(buildscript-dir)/print-gittxt.sh $(top-src-dir) > input/regression/out-test/tree.gittxt
334 $(MAKE) -C input/regression/abc2ly out=test lysdoc-test
335 $(MAKE) -C input/regression/lilypond-book out=test local-test
336 $(MAKE) -C input/regression/midi out=test lysdoc-test
337 $(MAKE) -C input/regression/musicxml out=test lysdoc-test
338 $(MAKE) -C input/regression/other out=test lysdoc-test
340 test-baseline-pre:
341 cd $(top-src-dir) && \
342 if test -d .git ; then \
343 if ! git diff --exit-code > /dev/null ; then \
344 echo "*** commit before base lining" 1>&2; \
345 exit 1; \
346 fi \
348 $(MAKE) test-clean
349 $(MAKE) test
351 test-baseline: test-baseline-pre
352 rm -f $(BASELINE_STAMP)
353 # Make a copy of the fonts that all subdir baselines can share.
354 $(call ly_progress,Synching,out-baseline/share/lilypond/current/fonts,from out)
355 mkdir -p $(top-build-dir)/out-baseline/share/lilypond/current
356 rsync -L -a -q --delete --exclude source \
357 $(top-build-dir)/out/share/lilypond/current/fonts \
358 $(top-build-dir)/out-baseline/share/lilypond/current
359 $(MAKE) out=test -C input/regression local-test-baseline
360 $(MAKE) out=test -C input/regression/abc2ly local-test-baseline
361 $(MAKE) out=test -C input/regression/midi local-test-baseline
362 $(MAKE) out=test -C input/regression/musicxml local-test-baseline
363 $(MAKE) out=test -C input/regression/other local-test-baseline
364 $(MAKE) test-snippets-clean
365 touch $(BASELINE_STAMP)
367 local-check-pre:
368 [ -f $(BASELINE_STAMP) ] || \
369 ( echo "*** no baseline for comparison" 1>&2 && false )
370 $(MAKE) test
372 local-check: local-check-pre
373 rm -rf $(RESULT_DIR)
374 mkdir -p $(RESULT_DIR)
375 $(PYTHON) $(buildscript-dir)/output-distance.py $(if $(VERBOSE),-v) \
376 $(if $(CPU_COUNT),--job-count=$(CPU_COUNT),) \
377 --local-datadir --output-dir $(RESULT_DIR) \
378 input/regression/out-test-baseline input/regression/out-test \
379 input/regression/abc2ly/out-test-baseline input/regression/abc2ly/out-test \
380 input/regression/midi/out-test-baseline input/regression/midi/out-test \
381 input/regression/musicxml/out-test-baseline input/regression/musicxml/out-test \
382 input/regression/other/out-test-baseline input/regression/other/out-test
383 @find input ly -name '*.ly' -print |grep -v 'out.*/' | xargs grep '\\version' -L | grep -v "standard input" |sed 's/^/**** Missing version: /g'
385 test-clean: test-snippets-clean
386 rm -rf $(RESULT_DIR)
387 $(MAKE) -C input/regression out=test clean
389 doc-clean: snippets-clean
391 snippets-clean:
392 rm -rf out/lybook-db
394 test-snippets-clean:
395 rm -rf out/lybook-testdb
397 distclean: clean doc-clean test-clean
398 $(MAKE) local-distclean
400 local-distclean:
401 rm -f config.hh config.make GNUmakefile \
402 config.cache config.status config.log
403 rm -rf autom4te.cache
404 rm -rf $(outdir)
406 $(package-icon):
407 $(MAKE) -C Documentation/logo icon
409 install:
410 $(LOOP)
411 ifeq ($(strip $(SRCMAKE)),)
412 $(MAKE) final-install
413 endif
415 local-help:
416 @echo " config rerun configure"
417 @echo " dist roll tarball: $(depth)/$(outdir)/$(distname).tar.gz"
418 @echo " distclean make clean, doc-clean, test-clean and"
419 @echo " also remove configure output"
420 @echo " po make new translation Portable Object database"
421 @echo " po-replace do po-update and replace catalogs with msgmerged versions"
422 @echo " po-update update translation Portable Object database"
423 @echo
424 @echo " install-doc install website documentation in"
425 @echo " (webdir=$(webdir))"
426 @echo " and Info documentation with images"
427 @echo " uninstall-doc remove installed documentation with images"
428 @echo " info build Info documentation with images"
429 @echo " install-info install Info documentation with images"
430 @echo
431 @echo "Some more targets are available for testing changes:"
432 @echo " test-baseline"
433 @echo " check"
434 @echo " test-clean"
435 @echo
436 @echo " For more information on these targets, see"
437 @echo " \`Verify regression tests' in the Contributor's Guide."
438 @echo