| 1 | # -*- make -*- |
| 2 | |
| 3 | # This handles man pages with po4a. We convert to the respective |
| 4 | # output in the source directory then copy over to the final dest. This |
| 5 | # means po4a is only needed if compiling from bzr |
| 6 | |
| 7 | # Input |
| 8 | # $(LC) - The language code of the translation |
| 9 | |
| 10 | # See defaults.mak for information about LOCAL |
| 11 | |
| 12 | # generate a list of accepted man page translations |
| 13 | SOURCE = $(patsubst %.xml,%,$(wildcard *.$(LC).?.xml)) |
| 14 | INCLUDES = apt.ent apt-verbatim.ent apt-vendor.ent |
| 15 | |
| 16 | manpages: |
| 17 | |
| 18 | %.xsl: ../%.xsl |
| 19 | cp -a $< . |
| 20 | |
| 21 | # Do not use XMLTO, build the manpages directly with XSLTPROC |
| 22 | ifdef XSLTPROC |
| 23 | |
| 24 | STYLESHEET=manpage-style.xsl |
| 25 | |
| 26 | LOCAL := po4a-manpage-$(firstword $(SOURCE)) |
| 27 | $(LOCAL)-LIST := $(SOURCE) |
| 28 | |
| 29 | # Install generation hooks |
| 30 | manpages: $($(LOCAL)-LIST) |
| 31 | clean: clean/$(LOCAL) |
| 32 | veryclean: veryclean/$(LOCAL) |
| 33 | |
| 34 | apt-verbatim.ent: ../apt-verbatim.ent |
| 35 | cp -a ../apt-verbatim.ent . |
| 36 | |
| 37 | apt-vendor.ent: ../apt-vendor.ent |
| 38 | cp -a ../apt-vendor.ent . |
| 39 | |
| 40 | $($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES) |
| 41 | echo Creating man page $@ |
| 42 | $(XSLTPROC) \ |
| 43 | --stringparam l10n.gentext.default.language $(LC) \ |
| 44 | -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here??? |
| 45 | test -f $(subst .$(LC),,$@) || echo 'FIXME: xsltproc respects the -o flag now, workaround can be removed' |
| 46 | mv -f $(subst .$(LC),,$@) $@ |
| 47 | |
| 48 | # Clean rule |
| 49 | .PHONY: clean/$(LOCAL) veryclean/$(LOCAL) |
| 50 | clean/$(LOCAL): |
| 51 | rm -f $($(@F)-LIST) apt.ent apt-verbatim.ent |
| 52 | veryclean/$(LOCAL): |
| 53 | # we are nuking the directory we are working in as it is auto-generated |
| 54 | rm -rf $(shell readlink -f .) |
| 55 | |
| 56 | HAVE_PO4A=yes |
| 57 | endif |
| 58 | |
| 59 | # take care of the rest |
| 60 | SOURCE := $(SOURCE) $(wildcard apt.$(LC).8) |
| 61 | INCLUDES := |
| 62 | |
| 63 | ifndef HAVE_PO4A |
| 64 | # Strip from the source list any man pages we dont have compiled already |
| 65 | SOURCE := $(wildcard $(SOURCE)) |
| 66 | endif |
| 67 | |
| 68 | # Chain to the manpage rule |
| 69 | ifneq ($(words $(SOURCE)),0) |
| 70 | include $(MANPAGE_H) |
| 71 | endif |
| 72 | |
| 73 | # DocBook XML Documents |
| 74 | SOURCE := $(wildcard *.$(LC).dbk) |
| 75 | include $(DOCBOOK_H) |