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