summaryrefslogtreecommitdiffstats
path: root/man/Rules.man
blob: 55ff35d6f8d0f5a4f9ec3ce0aa739984a7a116e6 (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
## Copyright (C) 1994, 1995 Graeme Wilford.
## Copyright (C) 2001, 2002, 2003, 2007 Colin Watson.
## Much of the following is based on automake/lib/am/mans.am, which is:
## Copyright (C) 1998, 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
##
## This file is part of man-db.
##
## man-db is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## man-db is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with man-db; if not, write to the Free Software Foundation,
## Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

mandir = @mandir@/$(LINGUA)

CLEANFILES = $(man1_MANS) $(man5_MANS) $(man8_MANS) replace.sed

if !CROSS_COMPILING
TESTS_ENVIRONMENT = top_builddir="$(top_builddir)"; export top_builddir; \
		    LINGUA="$(LINGUA)"; export LINGUA; \
		    EGREP="$(EGREP)"; export EGREP;
LOG_COMPILER = @SHELL@ $(top_srcdir)/man/check-man
TESTS = $(man1_MANS) $(man5_MANS) $(man8_MANS)
endif

replace.sed: $(top_builddir)/man/replace.sin
	$(AM_V_GEN)sed -e 's,%REPLACE_CONFIG_FILE%,$(config_file),g' $(top_builddir)/man/replace.sin > $@

$(MANS): replace.sed

.man1.1:
	$(AM_V_at)$(MKDIR_P) man1
	$(AM_V_GEN)program=`echo '$@' | sed -e 's/\.1//' -e 's,.*/,,' -e '$(program_transform_name)'`; \
	sed -f replace.sed -e "s,%program%,$$program,g" $< > $@
.man5.5:
	$(AM_V_at)$(MKDIR_P) man5
	$(AM_V_GEN)sed -f replace.sed $< > $@
.man8.8:
	$(AM_V_at)$(MKDIR_P) man8
	$(AM_V_GEN)program=`echo '$@' | sed -e 's/\.8//' -e 's,.*/,,' -e '$(program_transform_name)'`; \
	sed -f replace.sed -e "s,%program%,$$program,g" $< > $@

mostlyclean-local:
	-rm -f index.*

dist-hook:
	@if [ "x$(PO4A_LINGUA)" != xyes ]; then \
		list='$(man1_MANS) $(man5_MANS) $(man8_MANS)'; \
		dist_files=`for file in $$list; do \
				echo $$file | sed 's/\.\([0-9]\)/.man\1/'; \
			    done`; \
		$(MKDIR_P) `echo "$$dist_files" | \
			    sed 's|^|$(distdir)/|;s,/[^/]*$$,,' | \
			    sort -u`; \
		for file in $$dist_files; do \
			test -f $(distdir)/$$file \
			|| cp -p $(srcdir)/$$file $(distdir)/$$file \
			|| exit 1; \
		done; \
	fi

distclean-local:
	@if [ "x$(PO4A_LINGUA)" = xyes ]; then \
		rm -rf man1 man5 man8; \
	fi