summaryrefslogtreecommitdiffstats
path: root/src/man/Makefile.am
blob: 1e51aebfdb26134f67bb20d492e562aa228f49b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# The following variable is dependent on placement of this file
top_builddir = ../..

############
# MANPAGES #
############


# If no conditions are given, *all* conditionals are expanded. We don't want
# to include any conditions by default, so we need to pass a phony conditional
if BUILD_SUDO
# conditionals are delimeted with a semicolon
SUDO_CONDS = ;with_sudo
endif
if BUILD_AUTOFS
AUTOFS_CONDS = ;with_autofs
endif
if BUILD_SSH
SSH_CONDS = ;with_ssh
endif
if BUILD_PAC_RESPONDER
PAC_RESPONDER_CONDS = ;with_pac_responder
endif
if BUILD_IFP
IFP_CONDS = ;with_ifp
endif
if BUILD_KCM
KCM_CONDS = ;with_kcm
endif
if BUILD_SYSTEMTAP
STAP_CONDS = ;with_stap
endif
if GPO_DEFAULT_ENFORCING
GPO_CONDS = ;gpo_default_enforcing
else
GPO_CONDS = ;gpo_default_permissive
endif
if HAVE_SYSTEMD_UNIT
SYSTEMD_CONDS = ;have_systemd
endif
if BUILD_KCM_RENEWAL
KCM_RENEWAL_CONDS = ;enable_kcm_renewal
endif
if BUILD_LOCKFREE_CLIENT
LOCKFREE_CLIENT_CONDS = ;enable_lockfree_support
endif
if HAVE_INOTIFY
HAVE_INOTIFY_CONDS = ;have_inotify
endif
if BUILD_PASSKEY
PASSKEY_CONDS = ;build_passkey
endif
if BUILD_FILES_PROVIDER
FILES_PROVIDER_CONDS = ;with_files_provider
else
FILES_PROVIDER_CONDS = ;without_files_provider
endif
if SSSD_NON_ROOT_USER
SSSD_NON_ROOT_USER_CONDS = ;with_non_root_user_support
endif


CONDS = with_false$(SUDO_CONDS)$(AUTOFS_CONDS)$(SSH_CONDS)$(PAC_RESPONDER_CONDS)$(IFP_CONDS)$(GPO_CONDS)$(SYSTEMD_CONDS)$(KCM_CONDS)$(STAP_CONDS)$(KCM_RENEWAL_CONDS)$(LOCKFREE_CLIENT_CONDS)$(HAVE_INOTIFY_CONDS)$(PASSKEY_CONDS)$(FILES_PROVIDER_CONDS)$(SSSD_NON_ROOT_USER_CONDS)


#Special Rules:
export SGML_CATALOG_FILES
DOCBOOK_XSLT = @DOCBOOK_XSLT@
DOCBOOK_XSLT ?= http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
XMLLINT_FLAGS = --catalogs --postvalid --nonet --noent --xinclude --noout
XSLTPROC_FLAGS = --catalogs --xinclude --nonet

if HAVE_PROFILE_CATALOGS
XSLTPROC_FLAGS += --stringparam profile.condition "$(CONDS)"
endif

EXTRA_DIST = $(wildcard $(srcdir)/*.xml) $(wildcard $(srcdir)/include/*.xml)
man_MANS = \
    sssd.8 sssd.conf.5 sssd-ldap.5 sssd-ldap-attributes.5 \
    sssd-krb5.5 sssd-simple.5 sss-certmap.5 \
    sssd_krb5_locator_plugin.8 sssd_krb5_localauth_plugin.8 \
    pam_sss.8 pam_sss_gss.8 sss_obfuscate.8 sss_cache.8 sss_debuglevel.8 \
	sss_seed.8 sss_override.8 idmap_sss.8 sssctl.8 sssd-session-recording.5 \
    $(NULL)

if BUILD_SAMBA
man_MANS += sssd-ipa.5 sssd-ad.5
endif

if BUILD_SSH
man_MANS += sss_ssh_authorizedkeys.1 sss_ssh_knownhostsproxy.1
endif

if BUILD_SUDO
man_MANS += sssd-sudo.5
endif

if BUILD_IFP
man_MANS += sssd-ifp.5
endif

if BUILD_KCM
man_MANS += sssd-kcm.8
endif

if BUILD_SYSTEMTAP
man_MANS += sssd-systemtap.5
endif

if BUILD_NFS_IDMAP
man_MANS += sss_rpcidmapd.5
endif

if HAVE_INOTIFY
if BUILD_FILES_PROVIDER
man_MANS += sssd-files.5
endif # BUILD_FILES_PROVIDER
endif

$(builddir)/src/man/sssd_user_name.include:
	@mkdir -p $(builddir)/src/man
	@echo -n $(SSSD_USER) > $(builddir)/src/man/sssd_user_name.include

%.1: %.1.xml
	$(XMLLINT) $(XMLLINT_FLAGS) $<
	$(XSLTPROC) -o $@  $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $<

%.3: %.3.xml
	$(XMLLINT) $(XMLLINT_FLAGS) $<
	$(XSLTPROC) -o $@  $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $<

%.5: %.5.xml $(builddir)/src/man/sssd_user_name.include
	$(XMLLINT) --path "$(srcdir)/src/man:$(builddir)/src/man" $(XMLLINT_FLAGS) $<
	$(XSLTPROC) --path "$(srcdir)/src/man:$(builddir)/src/man" -o $@  $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $<

%.8: %.8.xml
	$(XMLLINT) $(XMLLINT_FLAGS) $<
	$(XSLTPROC) -o $@  $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $<

########################
# MANPAGE TRANSLATIONS #
########################

PO4A=@PO4A@
SED=@SED@

PACKAGE_DOC=sssd-docs

POTFILE = po/$(PACKAGE_DOC).pot
PO4A_CONFIG = po/po4a.cfg

# Extract the list of languages from the po4a config file.
LINGUAS_DIST = `$(SED) -ne 's/^.*\[po4a_langs\] \(.*\)$$/\1/p' $(srcdir)/$(PO4A_CONFIG)`

# If the user has not defined it let's use the default.
LINGUAS ?= $(LINGUAS_DIST)

PO4A_COMMON_OPTS = --option doctype=docbook \
		   --package-name $(PACKAGE_DOC) \
		   --variable builddir=$(CURDIR) \
		   --package-version $(PACKAGE_VERSION) \
		   --msgid-bugs-address sssd-devel@redhat.com \
		   --copyright-holder "Red Hat"

PO4A_BUILD_OPTS = $(PO4A_COMMON_OPTS) --no-backups

EXTRA_DIST += \
	$(POTFILE)\
	$(PO4A_CONFIG)

XML_DOC = $(wildcard $(srcdir)/*.xml) $(wildcard $(srcdir)/include/*.xml)

if HAVE_PO4A
CFG_PAGES = $(addprefix $(srcdir)/, $(shell grep '\[type:docbook\]' $(PO4A_CONFIG) | awk '{print $$2}' | tr '\n' ' '))
NONTRANSLATED_PAGES = $(filter-out $(CFG_PAGES), $(XML_DOC))


# FIXME: Use a stamp file until po4a supports them internally.
man.stamp: $(XML_DOC) $(POTFILE) $(PO4A_CONFIG)
	cd $(srcdir) && \
	$(PO4A) $(PO4A_BUILD_OPTS) $(PO4A_CONFIG)
	touch $@

update-po:
	@if test x"$(NONTRANSLATED_PAGES)" != "x"; then \
	    echo "The following pages are not translated" $(NONTRANSLATED_PAGES); \
	    exit 1; \
	fi
	cd $(srcdir) && \
	$(PO4A) $(PO4A_BUILD_OPTS) --force $(PO4A_CONFIG)

dist-hook: man.stamp
	if [ -f man.stamp ]; then \
		cp man.stamp $(distdir); \
		for lang in $(LINGUAS_DIST); do \
			cp $(srcdir)/po/$$lang.po $(distdir)/po; \
			$(mkdir_p) $(distdir)/$$lang; \
			cp -r $(builddir)/$$lang $(distdir)/; \
		done; \
	else \
		cp $(srcdir)/man.stamp $(distdir); \
		for lang in $(LINGUAS_DIST); do \
			cp $(srcdir)/po/$$lang.po $(distdir)/po; \
			$(mkdir_p) $(distdir)/$$lang; \
			cp -r $(srcdir)/$$lang $(distdir)/; \
		done; \
	fi


clean-local:
	for lang in $(LINGUAS); do \
		if [ -d $$lang ]; then \
			rm -rf $$lang; \
		fi \
	done
	rm -f $(man_MANS)
	rm -f man.stamp
	rm -f $(builddir)/src/man/sssd_user_name.include

else

man.stamp: $(XML_DOC)
	touch $@

clean-local:
	rm -f $(man_MANS)
	rm -f man.stamp
	rm -f $(builddir)/src/man/sssd_user_name.include

endif

# Generate translated manual pages
all-local: all-local-@USE_NLS@
all-local-no:
all-local-yes: man.stamp
	if [ -z $$recursion ]; then \
		for lang in $(LINGUAS); do \
			if [ -d $$lang ]; then \
				sources=$$(ls -1 $$lang/*.xml); \
				manpages=$$(echo $$sources | $(SED) 's/\.xml//g'); \
				$(MAKE) recursion=1 man_MANS="$$manpages"; \
			fi \
		done \
	fi

install-data-local: install-data-local-@USE_NLS@
install-data-local-no:
install-data-local-yes:
	for lang in $(LINGUAS); do \
		if [ -d $$lang ]; then \
			sources=$$(ls -1 $$lang/*.xml); \
			manpages=$$(echo $$sources | $(SED) 's/\.xml//g'); \
			$(MAKE) install-man \
				mandir="$(mandir)/$$lang" \
				man_MANS="$$manpages"; \
		fi \
	done

uninstall-local: uninstall-local-@USE_NLS@
uninstall-local-no:
uninstall-local-yes:
	for lang in $(LINGUAS); do \
		if [ -d $$lang ]; then \
			sources=$$(ls -1 $$lang/*.xml); \
			manpages=$$(echo $$sources | $(SED) 's/\.xml//g'); \
			$(MAKE) uninstall-man \
				mandir="$(mandir)/$$lang" \
				man_MANS="$$manpages"; \
		fi \
	done