XGETTEXT := hgettext APPDIR := ../app AUTHOR := Nikola Hadžić PACKAGE := weatherhs VERSION := 1.0.0 BUGS_ADDRESS := nikola.hadzic.000@protonmail.com MERGE_BACKUP := simple .PHONY: help clean help: $(info VARIABLES) $(info =================================================================================) $(info XGETTEXT: xgettext tool to use (you probably want hgettext).) $(info APPDIR: Application code directory.) $(info AUTHOR: Package author's name.) $(info PACKAGE: Package's name.) $(info VERSION: Package's version.) $(info BUGS_ADDRESS: E-mail address to report the program bugs to (usually author's).) $(info MERGE_BACKUP: Merge backup option; see msgmerge(1).) $(info ) $(info RULES) $(info =================================================================================) $(info help: Display this help menu.) $(info messages.pot: Build POT file.) $(info %.po: Generate PO file.) $(info clean: Remove unnecessary generated files.) messages.pot: $(APPDIR)/*.hs $(warning Since you probably use hgettext for string extraction, make sure that it has this commit: https://github.com/NH002/hgettext/commit/a7ba5f7bc2624b91ddbbeeff7846947f56605c45) $(XGETTEXT) -o '1-$@' -k __ $(patsubst %,'%',$^) --cpp --cpp-defs=FLAG_ENCRYPTION $(XGETTEXT) -o '2-$@' -k __ $(patsubst %,'%',$^) --cpp --cpp-defs=FLAG_NOJSON,FLAG_NOXML msgcat --no-wrap -o '$@' '1-$@' '2-$@' rm '1-$@' '2-$@' sed -i \ -e '6s/PACKAGE VERSION/$(PACKAGE) $(VERSION)/' \ -e '7s/.\{23\}/&$(BUGS_ADDRESS)/' \ -e '8s/\(.\{20\}\).\{21\}/\1$(shell date '+%F %R%z')/' \ '$@' %.po: messages.pot $(if $(wildcard $@),msgmerge --backup '$(MERGE_BACKUP)' -U --no-wrap '$@' '$<',msginit --no-wrap -l $(patsubst %.po,'%',$@)) clean: $(info Cleaning directory...) @rm -f *-messages.pot messages.pot *.po~