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# What do we need to do
24POFILES		= $(wildcard *.po)
25MOFILES		= $(patsubst %.po,%.mo,$(POFILES))
26POTFILES = \
27	../run_init/open_init_pty.c \
28	../run_init/run_init.c \
29	../semodule_link/semodule_link.c \
30	../audit2allow/audit2allow \
31	../semanage/seobject.py \
32	../setsebool/setsebool.c \
33	../newrole/newrole.c \
34	../load_policy/load_policy.c \
35	../sestatus/sestatus.c \
36	../semodule/semodule.c \
37	../setfiles/setfiles.c \
38	../semodule_package/semodule_package.c \
39	../semodule_deps/semodule_deps.c \
40	../semodule_expand/semodule_expand.c \
41	../scripts/chcat \
42	../scripts/fixfiles \
43	../restorecond/stringslist.c \
44	../restorecond/restorecond.h \
45	../restorecond/utmpwatcher.h \
46	../restorecond/stringslist.h \
47	../restorecond/restorecond.c \
48	../restorecond/utmpwatcher.c \
49	../gui/booleansPage.py \
50	../gui/fcontextPage.py \
51	../gui/loginsPage.py \
52	../gui/mappingsPage.py \
53	../gui/modulesPage.py \
54	../gui/polgen.glade \
55	../gui/polgengui.py \
56	../gui/portsPage.py \
57	../gui/semanagePage.py \
58	../gui/statusPage.py \
59	../gui/system-config-selinux.glade \
60	../gui/system-config-selinux.py \
61	../gui/usersPage.py \
62	../secon/secon.c \
63	booleans.py \
64	../sepolicy/info.c \
65	../sepolicy/search.c \
66	../sepolicy/sepolicy.py \
67	../sepolicy/sepolicy/communicate.py \
68	../sepolicy/sepolicy/__init__.py \
69	../sepolicy/sepolicy/network.py \
70	../sepolicy/sepolicy/generate.py \
71	../sepolicy/sepolicy/sepolicy.glade \
72	../sepolicy/sepolicy/gui.py \
73	../sepolicy/sepolicy/manpage.py \
74	../sepolicy/sepolicy/transition.py \
75	../sepolicy/sepolicy/templates/executable.py \
76	../sepolicy/sepolicy/templates/__init__.py \
77	../sepolicy/sepolicy/templates/network.py \
78	../sepolicy/sepolicy/templates/rw.py \
79	../sepolicy/sepolicy/templates/script.py \
80	../sepolicy/sepolicy/templates/semodule.py \
81	../sepolicy/sepolicy/templates/tmp.py \
82	../sepolicy/sepolicy/templates/user.py \
83	../sepolicy/sepolicy/templates/var_lib.py \
84	../sepolicy/sepolicy/templates/var_log.py \
85	../sepolicy/sepolicy/templates/var_run.py \
86	../sepolicy/sepolicy/templates/var_spool.py
87
88#default:: clean
89
90all::  $(MOFILES)
91
92booleans.py:
93	sepolicy booleans -a > booleans.py
94
95$(POTFILE): $(POTFILES) booleans.py
96	$(XGETTEXT) --keyword=_ --keyword=N_ $(POTFILES)
97	@if cmp -s $(NLSPACKAGE).po $(POTFILE); then \
98	    rm -f $(NLSPACKAGE).po; \
99	else \
100	    mv -f $(NLSPACKAGE).po $(POTFILE); \
101	fi; \
102
103update-po: Makefile $(POTFILE) refresh-po
104	@rm -f booleans.py
105
106refresh-po: Makefile
107	for cat in $(POFILES); do \
108		lang=`basename $$cat .po`; \
109		if $(MSGMERGE) $(MSGMERGE_FLAGS) $$lang.po $(POTFILE) > $$lang.pot ; then \
110			mv -f $$lang.pot $$lang.po ; \
111			echo "$(MSGMERGE) of $$lang succeeded" ; \
112		else \
113			echo "$(MSGMERGE) of $$lang failed" ; \
114			rm -f $$lang.pot ; \
115		fi \
116	done
117
118clean:
119	@rm -fv *mo *~ .depend
120	@rm -rf tmp
121
122install: $(MOFILES)
123	@for n in $(MOFILES); do \
124	    l=`basename $$n .mo`; \
125	    $(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \
126	    $(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
127	done
128
129%.mo: %.po
130	$(MSGFMT) -o $@ $<
131report:
132	@for cat in $(wildcard *.po); do \
133                echo -n "$$cat: "; \
134                msgfmt -v --statistics -o /dev/null $$cat; \
135        done
136
137.PHONY: missing depend
138
139relabel:
140