| 1 | ### |
|---|
| 2 | ### must have the following commandline tools: |
|---|
| 3 | ### |
|---|
| 4 | ### xml2po (Debian package: poxml) |
|---|
| 5 | ### po2xml (Debian package: poxml) |
|---|
| 6 | ### xmlto (Debian package: xmlto) |
|---|
| 7 | ### xmllint (Debian package: libxml2-utils) |
|---|
| 8 | ### |
|---|
| 9 | |
|---|
| 10 | MANUAL_MASTER = manual.docbook |
|---|
| 11 | TUTORIAL_MASTER = tutorial.docbook |
|---|
| 12 | |
|---|
| 13 | ALL_MASTERS = $(MANUAL_MASTER) $(TUTORIAL_MASTER) |
|---|
| 14 | |
|---|
| 15 | ALL_MANUALS = manual_en.html \ |
|---|
| 16 | manual_es.html \ |
|---|
| 17 | manual_fr.html \ |
|---|
| 18 | manual_it.html \ |
|---|
| 19 | manual_ca.html \ |
|---|
| 20 | manual_nl.html |
|---|
| 21 | |
|---|
| 22 | ALL_TUTORIALS = tutorial_en.html \ |
|---|
| 23 | tutorial_fr.html \ |
|---|
| 24 | tutorial_it.html |
|---|
| 25 | |
|---|
| 26 | ALL_POT_FILES = manual_en.pot tutorial_en.pot |
|---|
| 27 | |
|---|
| 28 | XMLTO_OPTS = --stringparam section.autolabel=1 \ |
|---|
| 29 | --stringparam toc.max.depth=2 \ |
|---|
| 30 | --stringparam xref.with.number.and.title=0 |
|---|
| 31 | |
|---|
| 32 | XML2POT = xml2pot |
|---|
| 33 | XMLTO = xmlto |
|---|
| 34 | XMLLINT = xmllint |
|---|
| 35 | PO2XML = po2xml |
|---|
| 36 | |
|---|
| 37 | all: all_manuals all_tutorials all_pot_files |
|---|
| 38 | |
|---|
| 39 | all_manuals: $(ALL_MANUALS) |
|---|
| 40 | |
|---|
| 41 | all_tutorials: $(ALL_TUTORIALS) |
|---|
| 42 | |
|---|
| 43 | ## Explicit build to avoid circular dependency |
|---|
| 44 | all_pot_files: $(ALL_MASTERS) |
|---|
| 45 | $(XML2POT) manual.docbook > manual.pot |
|---|
| 46 | $(XML2POT) tutorial.docbook > tutorial.pot |
|---|
| 47 | |
|---|
| 48 | clean: |
|---|
| 49 | -rm -f $(ALL_MANUALS) $(ALL_TUTORIALS) *_{en,es,it,fr,nl,ca}.docbook *.docbook_validated |
|---|
| 50 | |
|---|
| 51 | %.html: %.docbook %.docbook_validated |
|---|
| 52 | LL=$$(echo -n $< | sed 's/.*_\(..\)\.docbook/\1/') ; \ |
|---|
| 53 | $(XMLTO) html-nochunks $(XMLTO_OPTS) \ |
|---|
| 54 | --stringparam l10n.gentext.language=$$LL \ |
|---|
| 55 | $< |
|---|
| 56 | |
|---|
| 57 | %.docbook_validated: %.docbook |
|---|
| 58 | $(XMLLINT) --noout --valid $^ |
|---|
| 59 | touch $@ |
|---|
| 60 | |
|---|
| 61 | ## Special rule for master manual and tutorial |
|---|
| 62 | %_en.docbook: %.docbook |
|---|
| 63 | cp -f $^ $@ |
|---|
| 64 | |
|---|
| 65 | manual_%.docbook: manual_%.po $(MANUAL_MASTER) |
|---|
| 66 | $(PO2XML) $(MANUAL_MASTER) $< > $@ |
|---|
| 67 | |
|---|
| 68 | #manual_%.po: $(MANUAL_MASTER) |
|---|
| 69 | # $(XML2POT) -u $@ $^ |
|---|
| 70 | |
|---|
| 71 | tutorial_%.docbook: tutorial_%.po $(TUTORIAL_MASTER) |
|---|
| 72 | $(PO2XML) $(TUTORIAL_MASTER) $< > $@ |
|---|
| 73 | |
|---|
| 74 | #tutorial_%.po: $(TUTORIAL_MASTER) |
|---|
| 75 | # $(XML2POT) -u $@ $^ |
|---|
| 76 | |
|---|