]> git.donarmstrong.com Git - lilypond.git/blob - GNUmakefile.in
Fix "make top-doc" (and thus "make dist") on clean build tree
[lilypond.git] / GNUmakefile.in
1 # -*-Makefile-*-
2
3 depth = .
4
5 SUBDIRS = 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 smart-autogen.sh smart-configure.sh
20 README_FILES = COPYING COPYING.FDL DEDICATION ROADMAP THANKS HACKING \
21   LICENSE LICENSE.DOCUMENTATION
22 TOPDOC_FILES = AUTHORS INSTALL README NEWS
23 TOPDOC_TXT_FILES = $(addprefix $(top-build-dir)/Documentation/topdocs/$(outdir)/,$(addsuffix .txt,$(TOPDOC_FILES)))
24 IN_FILES := $(call src-wildcard,*.in)
25
26 RELEASE_FILES = ChangeLog RELEASE-COMMIT
27 RELEASE_OUT_FILES = $(RELEASE_FILES:%=$(outdir)/%)
28 OUT_DIST_FILES += $(RELEASE_OUT_FILES)
29 EXTRA_DIST_FILES = VERSION .gitignore .mailmap \
30   $(README_FILES) $(SCRIPTS) $(IN_FILES)
31 INSTALLATION_DIR=$(local_lilypond_datadir)
32 INSTALLATION_FILES=$(config_make) VERSION
33
34 # bootstrap stepmake:
35 #
36 STEPMAKE_TEMPLATES=toplevel po install
37 LOCALSTEPMAKE_TEMPLATES=lilypond
38
39 include $(depth)/make/stepmake.make
40
41 .PHONY: test info website
42
43 local-dist: refresh-release-files dist-toplevel-txt-files
44
45 all: $(outdir)/VERSION
46
47 $(outdir)/VERSION: $(config_make) VERSION
48         -mkdir -p $(outdir)
49         echo $(TOPLEVEL_VERSION) > $@
50
51 $(outdir)/ChangeLog: $(outdir)/VERSION
52         @echo 'See http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=log;h=refs/tags/release/$(TOPLEVEL_VERSION)-1' > $@
53
54 $(outdir)/RELEASE-COMMIT: # FIXME: any file in $(top-src-dir)/.git/ we can depend on and be sure RELEASE-COMMIT is up to date?
55         git --git-dir=$(top-src-dir)/.git show HEAD | head -100 > $@
56
57 # junk me as soon as RELEASE-COMMIT FIXME: has been addressed
58 refresh-release-files:
59         test -d $(top-src-dir)/.git && rm -f $(RELEASE_OUT_FILES)
60         $(MAKE) $(RELEASE_OUT_FILES)
61
62 python-modules:
63         $(MAKE) -C scripts/build
64         $(MAKE) -C python
65
66 top-doc: python-modules
67
68 local-clean: local-clean-ChangeLog
69
70 local-clean-ChangeLog:
71         rm -f ChangeLog
72
73 dist-toplevel-txt-files: top-doc
74         -mkdir -p $(distdir)
75         ln $(TOPDOC_TXT_FILES) $(distdir)
76         ln $(top-src-dir)/stepmake/aclocal.m4 $(distdir)
77
78 info:
79         $(foreach d, $(INFO_DIRECTORIES),$(MAKE) -C $(d) out=www info && ) true
80
81 install-info: info
82         $(MAKE) out=www COPY_INFO_IMAGES=1 install-info-WWW
83
84 install-help2man:
85         $(MAKE) -C scripts man install-help2man
86         $(MAKE) -C lily man install-help2man
87
88 install-doc:
89         $(MAKE) out=www install-WWW
90         $(MAKE) out=www install-info-WWW
91
92 uninstall-doc:
93         $(MAKE) out=www uninstall-WWW
94
95 local-install:
96         $(INSTALL) -d $(DESTDIR)$(local_lilypond_datadir)
97
98 final-install:
99         @true
100
101 ifeq ($(out),www)
102 # All web targets, except info image symlinks and info docs are
103 # installed in non-recursing target from TOP-SRC-DIR
104 install-WWW:
105         -$(INSTALL) -m 755 -d $(DESTDIR)$(webdir)
106         rsync -rl --exclude='*.signature' $(outdir)/offline-root $(DESTDIR)$(webdir)
107         $(MAKE) -C Documentation omf-local-install
108
109 install-info-WWW:
110         $(foreach d, $(INFO_DIRECTORIES),$(MAKE) -C $(d) install-info && ) true
111
112 uninstall-WWW:
113         rm -rf $(DESTDIR)$(webdir)
114         -rmdir $(package_docdir)
115         $(MAKE) -C Documentation uninstall
116
117
118 # For online docs with content negotiation, issue `make doc WEB_TARGETS=online'
119 # For both online and offline docs, issue `make doc WEB_TARGETS="offline online"'
120 WEB_TARGETS = offline
121
122 WEB_ROOT_FILES = $(WEB_TARGETS:%=$(outdir)/%-root/index.html)
123
124 WEB_TRACKED_FILES = $(filter-out $(outdir)/index.html, \
125                     $(shell bash -O nullglob -c "echo $(outdir)/*.{midi,html,pdf,png,jpg,jpeg,txt,ly,ily,signature,css,zip,js,idx,php}")) \
126                     $(shell bash -O nullglob -c "echo input/$(outdir)/*.{midi,html,pdf,png,jpg,jpeg,txt,ly,ily,signature,css,zip,js,idx,php}") \
127                     $(shell bash -O nullglob -c "echo input/*/$(outdir)/*.{midi,html,pdf,png,jpg,jpeg,txt,ly,ily,signature,css,zip,js,idx,php}") \
128                     $(shell bash -O nullglob -c "echo input/*/*/$(outdir)/*.{midi,html,pdf,png,jpg,jpeg,txt,ly,ily,signature,css,zip,js,idx,php}") \
129                     $(shell bash -O nullglob -c "echo input/regression/lilypond-book/$(outdir)/*.{info,tex}") \
130                     $(shell bash -O nullglob -c "echo Documentation/$(outdir)/*.{midi,html,pdf,png,jpg,jpeg,txt,ly,ily,signature,css,zip,js,idx,php}") \
131                     $(shell bash -O nullglob -c "echo Documentation/$(outdir)/*/*.{midi,html,pdf,png,jpg,jpeg,txt,ly,ily,signature,css,zip,js,idx,php}")
132
133 WWW-post: $(top-build-dir)/.htaccess $(WEB_ROOT_FILES)
134
135 # need UTF8 setting in case this is hosted on a website.
136 $(top-build-dir)/.htaccess:
137         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
138
139 $(outdir)/offline-root/index.html: $(WEB_TRACKED_FILES)
140         $(buildscript-dir)/www_post $(PACKAGE_NAME) $(TOPLEVEL_VERSION) $(outdir) offline
141         find $(outdir)/offline-root -type l | xargs rm -f
142
143 $(outdir)/online-root/index.html: $(WEB_TRACKED_FILES)
144         $(buildscript-dir)/www_post $(PACKAGE_NAME) $(TOPLEVEL_VERSION) $(outdir) online
145 endif # ifeq ($(out),www)
146
147 # For those who cannot for the life in them remember to type
148 # WEB_TARGETS=..., just bloody make all doc stuff, already.
149 all-doc:
150         $(MAKE) WEB_TARGETS='online offline' doc
151
152 tree-prefix = $(outdir)
153 tree-bin = $(tree-prefix)/bin
154 tree-lib = $(tree-prefix)/lib
155 tree-share = $(tree-prefix)/share
156
157 # Don't put version numbers here. During development
158 # they make no sense, and cause EPS files to become invalid.
159
160 tree-share-prefix = $(tree-share)/lilypond/current
161 tree-lib-prefix = $(tree-lib)/lilypond/current
162
163 C_DIRS = flower lily
164 c-clean:
165         $(foreach i, $(C_DIRS), $(MAKE) -C $(i) clean &&) true
166
167 src-ext = c cc yy ll hh icc py scm tex ps texi itexi tely itely sh
168
169 doc-clean: snippets-clean $(tree-share-prefix)/lilypond-force
170
171 default: $(config_h) build-dir-setup build-scripts
172
173 build-dir-setup: $(tree-share-prefix)/lilypond-force
174
175 build-scripts:
176         $(MAKE) -C scripts/build
177
178 PO_FILES = $(call src-wildcard,$(src-depth)/po/*.po)
179 HELP_CATALOGS = $(PO_FILES:po/%.po=%)
180 CATALOGS = $(HELP_CATALOGS:lilypond=)
181
182 # Preparing LilyPond tree for build-dir exec
183 link-tree: $(tree-share-prefix)/lilypond-force
184
185 $(tree-share-prefix)/lilypond-force: GNUmakefile $(outdir)/VERSION
186         cd $(top-build-dir)/$(outbase) && rm -rf bin lib share
187         mkdir -p $(tree-bin)
188         mkdir -p $(tree-share-prefix)
189         mkdir -p $(tree-lib-prefix)
190         mkdir -p $(tree-share-prefix)/elisp
191         mkdir -p $(tree-share-prefix)/fonts
192         mkdir -p $(tree-share-prefix)/fonts/otf
193         mkdir -p $(tree-share-prefix)/fonts/tfm
194         mkdir -p $(tree-share-prefix)/fonts/type1
195         mkdir -p $(tree-share-prefix)/fonts/svg
196         mkdir -p $(tree-share-prefix)/fonts/map
197         mkdir -p $(tree-share-prefix)/fonts/enc
198         mkdir -p $(tree-share-prefix)/tex
199         cd $(tree-bin) && \
200                 ln -sf ../../lily/$(outconfbase)/lilypond . && \
201                 for i in abc2ly convert-ly etf2ly lilymidi lilypond-book lilypond-invoke-editor midi2ly musicxml2ly; \
202                         do ln -sf ../../scripts/$(outconfbase)/$$i . ; done
203         cd $(tree-lib-prefix) && \
204                 ln -s ../../../../python/$(outconfbase) python
205         cd $(tree-share-prefix) && \
206                 ln -s $(top-src-dir)/ly ly && \
207                 ln -s ../../../../mf mf && \
208                 ln -s $(top-src-dir)/ps && \
209                 ln -s ../../../../python/$(outconfbase) python && \
210                 ln -s $(top-src-dir)/scm && \
211                 ln -s $(top-src-dir)/scripts scripts
212         cd $(tree-share-prefix)/tex && \
213                 ln -s $(top-src-dir)/tex source && \
214                 ln -s ../../../../../tex/$(outconfbase) tex-out && \
215                 true
216         cd $(tree-share-prefix)/fonts && \
217                 ln -s $(top-src-dir)/mf source && \
218                 true
219         -cd $(tree-share-prefix)/elisp && \
220                 ln -sf ../../../../../elisp/$(outconfbase)/lilypond-words.el . && \
221                 ln -s $(top-src-dir)/elisp/*.el .
222         $(foreach i,$(CATALOGS), \
223                 (mkdir -p $(tree-share)/locale/$i/LC_MESSAGES && \
224                 cd $(tree-share)/locale/$i/LC_MESSAGES && \
225                 ln -sf ../../../../../po/$(outconfbase)/$i.mo lilypond.mo) &&) true
226         touch $(tree-share-prefix)/lilypond-force
227
228 link-mf-tree: $(tree-share-prefix)/mf-link-tree
229
230 $(tree-share-prefix)/mf-link-tree: $(tree-share-prefix)/lilypond-force
231         -rm -f $(tree-share-prefix)/fonts/otf/* &&  \
232         rm -f $(tree-share-prefix)/fonts/svg/* &&  \
233         rm -f $(tree-share-prefix)/fonts/fonts.conf &&  \
234         rm -f $(tree-share-prefix)/fonts/tfm/* &&  \
235         rm -f $(tree-share-prefix)/fonts/type1/* &&  \
236                 cd $(tree-share-prefix)/fonts/otf && \
237                 ln -s ../../../../../../mf/$(outconfbase)/*.otf .
238         -cd $(tree-share-prefix)/fonts && \
239                 ln -s ../../../../../mf/$(outconfbase)/fonts.conf .
240         -cd $(tree-share-prefix)/fonts/svg && \
241                 ln -s ../../../../../../mf/$(outconfbase)/*.svg .
242         -cd $(tree-share-prefix)/fonts/svg && \
243                 ln -s ../../../../../../mf/$(outconfbase)/*.woff .
244         -cd $(tree-share-prefix)/fonts/tfm && \
245                 ln -s ../../../../../../mf/$(outconfbase)/*.tfm .
246         -cd $(tree-share-prefix)/fonts/type1 && \
247                 ln -s ../../../../../../mf/$(outconfbase)/*.pf? .
248         touch $(tree-share-prefix)/mf-link-tree
249
250 TAGS.make: dummy
251         etags -o $@ $(find $(top-src-dir) -name 'GNUmakefile*' -o -name '*.make')
252
253 $(config_h): config.hh.in
254 #
255 # this is to prevent people from getting
256 # undefined symbols  when we add them to config.h.in,
257 # and they blindly run "cvs update; make".
258 #
259         @echo
260         @echo ' *** $(config_h) is out of date'
261         @echo ' *** Remove it and rerun autogen:'
262         @echo '         rm $(config_h); ./autogen.sh'
263         @echo
264         @false
265
266 grand-replace:
267         $(MAKE) -C scripts/build
268         PATH=$(buildscript-dir):$(PATH) $(buildscript-dir)/grand-replace
269
270
271 ################################################################
272 # testing
273
274 RESULT_DIR=$(top-build-dir)/out/test-results
275
276
277 test:
278         @echo 'For tracking crashes: use'
279         @echo
280         @echo '        grep sourcefilename `grep -L systems.texi out/lybook-testdb/*/*log|sed s/log/ly/g`'
281         @echo
282         $(MAKE) -C input/regression out=test local-test
283         $(MAKE) -C input/regression/midi out=test local-test
284         $(MAKE) -C input/regression/musicxml out=test local-test
285         $(MAKE) -C input/regression/abc2ly out=test local-test
286         $(MAKE) -C input/regression/lilypond-book out=test local-test
287
288 ifndef BASELINE_COMMIT
289 BASELINE_COMMIT:=HEAD
290 endif
291
292 ifdef LILYPOND_BASELINES
293 BASELINE_ARCHIVE:=$(LILYPOND_BASELINES)/baseline-$(shell git rev-list -1 $(BASELINE_COMMIT)).tar.gz
294
295 test-baseline: $(BASELINE_ARCHIVE)
296         tar xzf $(BASELINE_ARCHIVE)
297         $(MAKE) test-snippets-clean
298
299 $(BASELINE_ARCHIVE):
300         $(MAKE) test-baseline-create
301         tar czf $(BASELINE_ARCHIVE) input/regression/out-test-baseline \
302                 input/regression/midi/out-test-baseline \
303                 input/regression/musicxml/out-test-baseline \
304                 input/regression/abc2ly/out-test-baseline \
305                 input/regression/lilypond-book/out-test-baseline
306 else
307 test-baseline: test-baseline-create
308         $(MAKE) test-snippets-clean
309 endif
310
311 test-baseline-create:
312         @if test -d .git ; then \
313                 $(if $(shell git diff $(BASELINE_COMMIT)), echo "commit before base lining" && false,true) ; \
314         fi
315         $(MAKE)
316         $(MAKE) test
317         $(MAKE) out=test -C input/regression local-test-baseline
318         $(MAKE) out=test -C input/regression/midi local-test-baseline
319         $(MAKE) out=test -C input/regression/musicxml local-test-baseline
320         $(MAKE) out=test -C input/regression/abc2ly local-test-baseline
321         $(MAKE) out=test -C input/regression/lilypond-book local-test-baseline
322
323 local-check: test
324         rm -rf $(RESULT_DIR)
325         mkdir -p $(RESULT_DIR)
326         $(buildscript-dir)/output-distance --local-datadir --create-images --output-dir $(RESULT_DIR) \
327                 input/regression/out-test-baseline input/regression/out-test \
328                 input/regression/midi/out-test-baseline input/regression/midi/out-test 
329         @find input ly -name '*.ly' -print |grep -v 'out.*/' | xargs grep '\\version' -L | grep -v "standard input" |sed 's/^/**** Missing version: /g'
330
331
332 test-redo:
333         for a in `cat $(RESULT_DIR)/changed.txt` ; do \
334                 echo removing $$a* ; \
335                 rm -f $$a* ;\
336         done
337         $(MAKE) check
338
339 test-clean: test-snippets-clean
340         $(MAKE) -C input/regression out=test clean
341
342 snippets-clean:
343         rm -rf out/lybook-db
344
345 test-snippets-clean:
346         rm -rf out/lybook-testdb
347
348 # we want this separate for security; see CG 4.2.  -gp
349 website:
350         $(MAKE) config_make=$(config_make) \
351                 top-src-dir=$(top-src-dir) \
352                 -f $(top-src-dir)/make/website.make \
353                 website
354