Minor edits.
[gitmagic/gitmagic.git] / po4gitmagic / Makefile
blob8dcb751ab026eb4e4453a0fcbcb3badae5b7a0b7
1 # Makefile to genereate everything needed for a translation of git-magic using po4a
3 SHELL := /bin/bash
5 # the possible targets
7 # clean - remove the folder $(POTDIR) and all the .txt files
8 # gettext - create the folder $(POTDIR) and generate the .po files in there
9 # translate - create the .txt files from the translated .po files
10 # for success you must have translated already 80% of a .po file
11 # update - update the .po files in case the originals has changed
12 # changed items are marked 'fuzzy' in the .po file to fin them easy
14 .PHONY: clean gettext translate update
16 # the path to the english original .txt files
17 ORGDIR := ../en
19 # the folder where the .po files will be created
20 POTDIR := pot
22 # the filenames for the .txt and .po files
23 # must be identical to the english original .txt files
24 FILES := preface intro basic clone branch history multiplayer grandmaster secrets drawbacks translate
25 # add the .txt suffix to the filenames for a list of .txt files
26 TXTFILES := $(addsuffix .txt, $(FILES))
27 # add the .po suffix to the filenames for a list of .po files
28 POTFILES := $(addsuffix .po, $(FILES))
30 # prerequisites for gettext are the .po files
31 gettext: $(addprefix $(POTDIR)/,$(POTFILES))
33 # prerequisites for translate are the .txt files
34 translate: $(TXTFILES)
36 # no prerequisites to update the translated .po files when the english original .txt has changed
37 update:
38 ( for FILE in $(FILES) ; \
39 do if [ -f $(ORGDIR)/$$FILE.txt ]; \
40 then po4a-updatepo -f text -m $(ORGDIR)/$$FILE.txt -M UTF-8 -p $(POTDIR)/$$FILE.po; echo $$FILE; \
41 fi; \
42 done )
44 # remove all .po and .txt files
45 clean:
46 -rm -rf $(POTDIR)
47 -rm -rf *.txt
49 # prerequisites for the .po files is the existance of the pot folder
50 $(POTFILES) : | $(POTDIR)
52 # create the folder for the .po files
53 $(POTDIR) :
54 -mkdir $(POTDIR)
56 # rule how to make the .po files from the english original .txt file
57 $(POTDIR)/%.po : $(ORGDIR)/%.txt
58 po4a-gettextize -f text -m $< -p $@ -M UTF-8
60 # rule how to make the translatets .txt files from the translated .po files
61 %.txt : $(POTDIR)/%.po
62 po4a-translate -f text -m ../en/$@ -p $< -M UTF-8 -l $@