1# 2# Makefile for the PO files (translation) catalog 3# 4 5TOP = ../.. 6 7# What is this package? 8NLSPACKAGE = policycoreutils 9POTFILE = $(NLSPACKAGE).pot 10INSTALL = /usr/bin/install -c -p 11INSTALL_DATA = $(INSTALL) -m 644 12INSTALL_DIR = /usr/bin/install -d 13 14# destination directory 15INSTALL_NLS_DIR = $(DESTDIR)/usr/share/locale 16 17# PO catalog handling 18MSGMERGE = msgmerge 19MSGMERGE_FLAGS = -q 20XGETTEXT = xgettext --default-domain=$(NLSPACKAGE) 21MSGFMT = msgfmt 22 23# All possible linguas 24PO_LINGUAS := $(sort $(patsubst %.po,%,$(wildcard *.po))) 25 26# Only the files matching what the user has set in LINGUAS 27USER_LINGUAS := $(filter $(patsubst %,%%,$(LINGUAS)),$(PO_LINGUAS)) 28 29# if no valid LINGUAS, build all languages 30USE_LINGUAS := $(if $(USER_LINGUAS),$(USER_LINGUAS),$(PO_LINGUAS)) 31 32POFILES = $(patsubst %,%.po,$(USE_LINGUAS)) 33MOFILES = $(patsubst %.po,%.mo,$(POFILES)) 34POTFILES = \ 35 ../run_init/open_init_pty.c \ 36 ../run_init/run_init.c \ 37 ../semodule_link/semodule_link.c \ 38 ../audit2allow/audit2allow \ 39 ../semanage/seobject.py \ 40 ../setsebool/setsebool.c \ 41 ../newrole/newrole.c \ 42 ../load_policy/load_policy.c \ 43 ../sestatus/sestatus.c \ 44 ../semodule/semodule.c \ 45 ../setfiles/setfiles.c \ 46 ../semodule_package/semodule_package.c \ 47 ../semodule_deps/semodule_deps.c \ 48 ../semodule_expand/semodule_expand.c \ 49 ../scripts/chcat \ 50 ../scripts/fixfiles \ 51 ../restorecond/stringslist.c \ 52 ../restorecond/restorecond.h \ 53 ../restorecond/utmpwatcher.h \ 54 ../restorecond/stringslist.h \ 55 ../restorecond/restorecond.c \ 56 ../restorecond/utmpwatcher.c \ 57 ../gui/booleansPage.py \ 58 ../gui/fcontextPage.py \ 59 ../gui/loginsPage.py \ 60 ../gui/mappingsPage.py \ 61 ../gui/modulesPage.py \ 62 ../gui/polgen.glade \ 63 ../gui/polgengui.py \ 64 ../gui/portsPage.py \ 65 ../gui/semanagePage.py \ 66 ../gui/statusPage.py \ 67 ../gui/system-config-selinux.glade \ 68 ../gui/system-config-selinux.py \ 69 ../gui/usersPage.py \ 70 ../secon/secon.c \ 71 booleans.py \ 72 ../sepolicy/sepolicy.py \ 73 ../sepolicy/sepolicy/communicate.py \ 74 ../sepolicy/sepolicy/__init__.py \ 75 ../sepolicy/sepolicy/network.py \ 76 ../sepolicy/sepolicy/generate.py \ 77 ../sepolicy/sepolicy/sepolicy.glade \ 78 ../sepolicy/sepolicy/gui.py \ 79 ../sepolicy/sepolicy/manpage.py \ 80 ../sepolicy/sepolicy/transition.py \ 81 ../sepolicy/sepolicy/templates/executable.py \ 82 ../sepolicy/sepolicy/templates/__init__.py \ 83 ../sepolicy/sepolicy/templates/network.py \ 84 ../sepolicy/sepolicy/templates/rw.py \ 85 ../sepolicy/sepolicy/templates/script.py \ 86 ../sepolicy/sepolicy/templates/semodule.py \ 87 ../sepolicy/sepolicy/templates/tmp.py \ 88 ../sepolicy/sepolicy/templates/user.py \ 89 ../sepolicy/sepolicy/templates/var_lib.py \ 90 ../sepolicy/sepolicy/templates/var_log.py \ 91 ../sepolicy/sepolicy/templates/var_run.py \ 92 ../sepolicy/sepolicy/templates/var_spool.py 93 94#default:: clean 95 96all:: $(MOFILES) 97 98booleans.py: 99 sepolicy booleans -a > booleans.py 100 101$(POTFILE): $(POTFILES) booleans.py 102 $(XGETTEXT) --keyword=_ --keyword=N_ $(POTFILES) 103 @if cmp -s $(NLSPACKAGE).po $(POTFILE); then \ 104 rm -f $(NLSPACKAGE).po; \ 105 else \ 106 mv -f $(NLSPACKAGE).po $(POTFILE); \ 107 fi; \ 108 109update-po: Makefile $(POTFILE) refresh-po 110 @rm -f booleans.py 111 112refresh-po: Makefile 113 for cat in $(POFILES); do \ 114 lang=`basename $$cat .po`; \ 115 if $(MSGMERGE) $(MSGMERGE_FLAGS) $$lang.po $(POTFILE) > $$lang.pot ; then \ 116 mv -f $$lang.pot $$lang.po ; \ 117 echo "$(MSGMERGE) of $$lang succeeded" ; \ 118 else \ 119 echo "$(MSGMERGE) of $$lang failed" ; \ 120 rm -f $$lang.pot ; \ 121 fi \ 122 done 123 124clean: 125 @rm -fv *mo *~ .depend 126 @rm -rf tmp 127 128install: $(MOFILES) 129 @for n in $(MOFILES); do \ 130 l=`basename $$n .mo`; \ 131 $(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \ 132 $(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \ 133 done 134 135%.mo: %.po 136 $(MSGFMT) -o $@ $< 137report: 138 @for cat in $(wildcard *.po); do \ 139 echo -n "$$cat: "; \ 140 msgfmt -v --statistics -o /dev/null $$cat; \ 141 done 142 143.PHONY: missing depend 144 145relabel: 146