X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=make%2Fwebsite.make;h=3e8df628d564f956f0be839224a947ae082b1c54;hb=aafcc4147ae2fea2ba1d95c7a54963c61f21b963;hp=3bb0faca5397de53015d0b316ee56e945620ce13;hpb=bb8aa1aed52c49e6e3de8c6c70a876598b11b4a8;p=lilypond.git diff --git a/make/website.make b/make/website.make index 3bb0faca53..3e8df628d5 100644 --- a/make/website.make +++ b/make/website.make @@ -7,7 +7,7 @@ ifeq ($(WEBSITE_ONLY_BUILD),1) ### for lilypond.org - TOP_SRC_DIR=$(HOME)/lilypond/lilypond-git + TOP_SRC_DIR=$(LILYPOND_GIT) TRUSTED_DIR=$(HOME)/lilypond/trusted-scripts top-src-dir=$(TOP_SRC_DIR) depth=. @@ -16,9 +16,8 @@ ifeq ($(WEBSITE_ONLY_BUILD),1) texi2html-init-file=$(trusted-dir)/lilypond-texi2html.init top-htaccess=$(trusted-dir)/lilypond.org.htaccess dir-htaccess=$(trusted-dir)/website-dir.htaccess - TEXI2HTML_PROGRAM=$(HOME)/usr/bin/texi2html - EXAMPLES=$(HOME)/lilypond/media/ly-examples - PICTURES=$(HOME)/lilypond/media/pictures + # grab it from PATH + TEXI2HTML_PROGRAM=texi2html PYTHON=python PYTHONPATH=$(TRUSTED_DIR) else @@ -28,11 +27,10 @@ else top-htaccess=$(top-src-dir)/Documentation/web/server/lilypond.org.htaccess dir-htaccess=$(top-src-dir)/Documentation/web/server/website-dir.htaccess include $(config_make) - # I assume this is run from top-build-dir - EXAMPLES=Documentation/web/ly-examples/out-www - PICTURES=Documentation/pictures/out-www endif +include $(top-src-dir)/VERSION + ################################################################ #The 4 lines below present an option to force make website to run # quietly only when it is run as make -s website. However, we've @@ -56,7 +54,7 @@ OUT=out-website WEB_LANGS := $(shell MAKEWEB=1 $(PYTHON) $(top-src-dir)/python/langdefs.py) -TEXI2HTML=ONLY_WEB=1 TOP_SRC_DIR=$(top-src-dir) DEPTH=$(depth) PERL_UNICODE=SD \ +TEXI2HTML=ONLY_WEB_VERSION=v$(MAJOR_VERSION).$(MINOR_VERSION) TOP_SRC_DIR=$(top-src-dir) DEPTH=$(depth) PERL_UNICODE=SD \ $(TEXI2HTML_PROGRAM) -D web_version --prefix=index --split=section \ --init-file=$(texi2html-init-file) \ --I=$(dir $<) \ @@ -70,11 +68,15 @@ EXTRACT_TEXI_FILENAMES=$(PYTHON) $(script-dir)/extract_texi_filenames.py $(quiet -I $(dir $<) \ -I $(OUT) \ -o $(OUT) -CREATE_VERSION=python $(script-dir)/create-version-itexi.py -CREATE_WEBLINKS=python $(script-dir)/create-weblinks-itexi.py -MASS_LINK=python $(script-dir)/mass-link.py -WEB_POST=python $(script-dir)/website_post.py -WEB_BIBS=python $(script-dir)/bib2texi.py +CREATE_VERSION=$(PYTHON) $(script-dir)/create-version-itexi.py +CREATE_WEBLINKS=$(PYTHON) $(script-dir)/create-weblinks-itexi.py +MASS_LINK=$(PYTHON) $(script-dir)/mass-link.py +WEB_POST=$(PYTHON) $(script-dir)/website_post.py +WEB_BIBS=$(PYTHON) $(script-dir)/bib2texi.py + +EXAMPLES=$(LILYPOND_WEB_MEDIA_GIT)/ly-examples +PICTURES=$(LILYPOND_WEB_MEDIA_GIT)/pictures +PDFS=$(LILYPOND_WEB_MEDIA_GIT)/pdf SERVER_FILES=$(top-src-dir)/Documentation/web/server @@ -100,6 +102,34 @@ MANUALS_WEB := web.texi $(WEB_LANGS:%=web.%.texi) MANUALS_BASE = $(basename $(MANUALS) $(MANUALS_WEB)) +####################### +### Dependency tracking + +# Find the file $(1) within the texinfo include dirs and return its path. +# If not found, i.e. it is a generated file, then the file is ignored. +find-texi = \ +$(firstword \ + $(wildcard $(dir $<)$(1)) \ + $(wildcard $(top-src-dir)/Documentation/$(1)) \ +) + +# Recursively scan the file $(1) for @include, search for included files +# within the texinfo include dirs, and return all dependencies. +scan-texi = \ + $(foreach f, $(shell echo | sed -ne "/^@include[[:space:]]/s/@include//p" $(1)), \ + $(call find-texi,$(f)) \ + $(call scan-texi,$(call find-texi,$(f))) \ +) + +# Find dependencies for the target $@, based on the texinfo source file $<, +# and write the dependencies to a .dep file. +DO_TEXI_DEP = ( mkdir -p $(dir $@) && echo ./$@: $(call scan-texi,$<) > $@.dep ) && + +# This is where we import the .dep files so that `make' knows about +# the various dependencies. +-include dummy.dep $(wildcard $(OUT)/*.dep) $(wildcard $(OUT)/*/*.dep) + + ################### ### Generated files @@ -111,16 +141,23 @@ css-files = $(css-src-files:%=$(OUT)/website/css/%) example-src-files := $(notdir $(wildcard $(EXAMPLES)/*)) example-files = $(example-src-files:%=$(OUT)/website/ly-examples/%) -misc-files = $(OUT)/.htaccess \ - $(OUT)/website/.htaccess \ - $(OUT)/website/favicon.ico \ - $(OUT)/website/robots.txt +misc-src-files := $(notdir $(wildcard $(top-src-dir)/Documentation/misc/*.*)) +misc-files += $(misc-src-files:%=$(OUT)/website/misc/%) picture-src-files := $(notdir $(wildcard $(PICTURES)/*)) picture-files = $(picture-src-files:%=$(OUT)/website/pictures/%) +pdf-src-files := $(notdir $(wildcard $(PDFS)/*)) +pdf-files = $(pdf-src-files:%=$(OUT)/website/pdf/%) + post-files = $(OUT)/website/index.html +root-files = $(OUT)/.htaccess \ + $(OUT)/website/.htaccess \ + $(OUT)/website/favicon.ico \ + $(OUT)/website/tweets.xml \ + $(OUT)/website/robots.txt + texinfo-files = $(OUT)/index.html $(WEB_LANGS:%=$(OUT)/%/index.html) version-files = $(OUT)/version.itexi $(OUT)/weblinks.itexi @@ -133,9 +170,15 @@ xref-files = $(MANUALS_BASE:%=$(OUT)/%.xref-map) .PHONY: website website-bibs website-css website-examples website-misc \ website-pictures website-post website-test website-texinfo \ - website-version website-xrefs + website-version website-xrefs check-setup website-pdf -website: website-post website-examples website-pictures website-css website-misc +check-setup: +ifeq ($(LILYPOND_WEB_MEDIA_GIT),) + echo "Need a LILYPOND_WEB_MEDIA_GIT environment variable!" + exit 1 +endif + +website: check-setup website-post website-examples website-pictures website-css website-misc website-pdf website-bibs: website-version $(OUT) $(bib-files) @@ -143,10 +186,12 @@ website-css: $(OUT)/website/css $(css-files) website-examples: $(OUT)/website/ly-examples $(example-files) -website-misc: $(OUT)/website $(misc-files) +website-misc: $(OUT)/website $(OUT)/website/misc $(misc-files) $(root-files) website-pictures: $(OUT)/website/pictures $(OUT)/pictures $(picture-files) +website-pdf: $(OUT)/website/pdf $(pdf-files) + website-post: website-texinfo $(post-files) website-test: @@ -163,17 +208,17 @@ website-xrefs: website-version $(OUT) $(xref-files) ### Rules # Directories -$(OUT) $(OUT)/website $(OUT)/website/css $(OUT)/website/ly-examples $(OUT)/website/pictures: %: +$(OUT) $(OUT)/website $(OUT)/website/css $(OUT)/website/ly-examples $(OUT)/website/misc $(OUT)/website/pdf $(OUT)/website/pictures: %: mkdir -p $@ $(OUT)/pictures: $(OUT)/website/pictures ln -sf website/pictures $(OUT)/pictures # Generated itexi files -$(OUT)/version.itexi: #FIXME: add dependencies +$(OUT)/version.itexi: $(top-src-dir)/VERSION $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi -$(OUT)/weblinks.itexi: #FIXME: add dependencies +$(OUT)/weblinks.itexi: $(top-src-dir)/VERSION $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi $(bib-files): $(OUT)/%.itexi: $(top-src-dir)/Documentation/web/%.bib @@ -207,12 +252,12 @@ $(OUT)/web.%.xref-map: $(top-src-dir)/Documentation/%/web.texi $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) --split=node $< # Build the English website -$(OUT)/index.html: $(top-src-dir)/Documentation/web.texi +$(OUT)/index.html: $(top-src-dir)/Documentation/web.texi $(version-files) $(xref-files) $(DO_TEXI_DEP) $(TEXI2HTML) $< # Build translated websites $(eval $(foreach l,$(WEB_LANGS),\ -$(eval $(OUT)/$(l)/index.html: $(top-src-dir)/Documentation/$(l)/web.texi; \ +$(eval $(OUT)/$(l)/index.html: $(top-src-dir)/Documentation/$(l)/web.texi $(version-files) $(xref-files); \ $$(DO_TEXI_DEP) $$(TEXI2HTML) --lang="$(l)" $$<; ) \ )) @@ -230,15 +275,24 @@ $(css-files): $(OUT)/website/css/%: $(top-src-dir)/Documentation/css/% $(example-files): $(OUT)/website/ly-examples/%: $(EXAMPLES)/% cp $< $@ +$(misc-files): $(OUT)/website/misc/%: $(top-src-dir)/Documentation/misc/% + cp $< $@ + $(picture-files): $(OUT)/website/pictures/%: $(PICTURES)/% cp $< $@ +$(pdf-files): $(OUT)/website/pdf/%: $(PDFS)/% + cp $< $@ + $(OUT)/website/favicon.ico: $(SERVER_FILES)/favicon.ico cp $< $@ $(OUT)/website/robots.txt: $(SERVER_FILES)/robots.txt cp $< $@ +$(OUT)/website/tweets.xml: $(SERVER_FILES)/tweets.xml + cp $< $@ + $(OUT)/.htaccess: $(top-htaccess) cp $< $@