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