Revision 7641 (by gradha, 2006/12/09 15:21:36) Updating links to use correct online version of docs. Added stub
generation of HTML to point to the new version and avoid dead links.
# Makefile for web generation.
# Note that from this line on to the first include we are only defining
# variables. Why? Well, to allow you customize the web generation. Just
# create a Makefile.local file which overrides the variables declared
# here and you are done, this local file won't be updated by cvs.

# You might want to change this to point to your python binary. You can
# use a full path if needed.
PYTHON_EXEC = python

WEBMAKE = $(PYTHON_EXEC) scripts/webmake.py
MIRROR_PY = $(PYTHON_EXEC) scripts/mirror.py
EXTERNAL_DEP_HELPER = $(PYTHON_EXEC) scripts/external_dep_helper.py
MAKEDOC = external/makedoc.exe
MAKEDOC_SRC = $(wildcard external/makedoc/m*.c)
# Don't want to rebuild makedoc? Set MAKEDOC_DEP empty in Makefile.local
MAKEDOC_DEP = $(MAKEDOC)
EXTERNAL_TEMPFILE = external/temp
MIRROR_TIMESTAMP = external/mirror_timestamp
MIRROR_DATA = external/binary-files.txt
RM = $(PYTHON_EXEC) scripts/rm.py
USELESS_SLEEP =   # this is needed by sourceforge's make, don't touch: hack

OUTDIR = out/
SRCDIR = src/
STDOUTPUT = $@

# This line indicates which languages will be generated. At the moment
# available languages are en:es:de. If you override this variable in
# Makefile.local and delete (or add) some langcode, please activate in
# allegro.ini the missing codes' substitution rules if needed.
# Languages are in form ,, but if you omit the
# charset, iso-8859-1 will be used.
GENERATE_LANGUAGES = en:es:de,utf8:fr:ko,euc-kr:pl,iso-8859-2:it:cs,iso-8859-2

# The following is similar to GENERATE_LANGUAGES, but for the online
# documentation. Don't leave blank: if you don't want to generate _any_
# online documentation, just leave ':'. Again, remember to put in
# allegro.ini the missing codes' substitution rules if needed.
GENERATE_ONLINE_DOCS = en

# Next lines indicates which languages will have translation
# statistics generated for. Usually this is changed only by the
# webmaster, depending on which translations are active.
#
# Note: obsolete, now the find_missing_translations.py script
# is used.
STAT_LANGS = es de fr cs

# in the following included file you can override global settings
-include Makefile.local

# General rules. From here on you shouldn't touch anything
.PHONY: all generate dep depend clean distclean
DEP_INFO = dependency_info

all: generate

-include $(DEP_INFO)

generate: $(EXTERNAL_DEPS) $(DEPS)

dep: depend

depend:
	@$(RM) $(DEP_INFO)

$(DEP_INFO):
	$(WEBMAKE) --output=$(OUTDIR) --localize=$(GENERATE_LANGUAGES) --depend --mirror-timestamp=$(MIRROR_TIMESTAMP) src/*.html > $(DEP_INFO)
	$(EXTERNAL_DEP_HELPER) --localize=$(GENERATE_LANGUAGES) --source=external --destination=data/external >> $(DEP_INFO)
	$(EXTERNAL_DEP_HELPER) --localize=$(GENERATE_ONLINE_DOCS) --source=external --api=out/latestdocs >> $(DEP_INFO)
	$(EXTERNAL_DEP_HELPER) --localize=$(GENERATE_ONLINE_DOCS) --source=external/stable --stable-api=out/stabledocs >> $(DEP_INFO)
	$(EXTERNAL_DEP_HELPER) --redirect=out/onlinedocs >> $(DEP_INFO)
	$(USELESS_SLEEP)

clean: $(AUTOMATIC_CLEANUP_FILES)
	$(RM) $(DEP_INFO) $(EXTERNAL_TEMPFILE)

distclean: clean
	$(RM) *.pyc

$(MAKEDOC_DEP): $(MAKEDOC_SRC)
	gcc -o $(MAKEDOC_DEP) -O2 -s $(MAKEDOC_SRC)

mirror:
	$(MIRROR_PY) --configuration=allegro.ini --data=$(MIRROR_DATA) --output-dir=$(OUTDIR) --timestamp=$(MIRROR_TIMESTAMP)

fake-mirror:
	$(MIRROR_PY) --fake --configuration=allegro.ini --data=$(MIRROR_DATA) --output-dir=$(OUTDIR) --timestamp=$(MIRROR_TIMESTAMP)

translation-statistics:
	$(RM) -R stats statistics statistics.*
	make -C . depend OUTDIR=stats WEBMAKE="$(PYTHON_EXEC) scripts/webmake.py -w statistics"
	make -C . OUTDIR=stats WEBMAKE="$(PYTHON_EXEC) scripts/webmake.py -w statistics"
	@for code in $(STAT_LANGS); do \
		cat statistics|grep $$code:|sort|uniq> $(OUTDIR)/statistics.$$code; \
		chown .alleg $(OUTDIR)/statistics.$$code; chmod 664 $(OUTDIR)/statistics.$$code; \
	done
	$(RM) -R stats statistics $(DEP_INFO)

whoareyou:
	@echo "It's me, the white rabbit."

RESTDOCS=instructions sf_cron_update_web sf_cron_author_statistics_update \
	sf_cron_translation_stat

restdocs: $(addprefix docs/,$(addsuffix .html,$(RESTDOCS)))
	@echo Done

docs/%.html: docs/%.txt
	rest2html --embed-stylesheet --stylesheet-path docs/style.css $< > $@