1# Copyright (C) 2011 Tobias Oetiker
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16
17
18AUTOMAKE_OPTIONS =  foreign
19
20# section 7
21
22DOCS = smokeping_extend.pod smokeping_install.pod smokeping_master_slave.pod  smokeping_upgrade.pod
23
24# section 5
25DOCSCONFIG = smokeping_config.pod smokeping_examples.pod
26
27#PM :=  ../lib/Smokeping.pm ../lib/Smokeping/Examples.pm ../lib/Smokeping/RRDtools.pm
28
29EXTRA_DIST = $(DOCS) smokeping_install.txt
30
31PODPROBE :=  $(wildcard ../lib/Smokeping/probes/*.pm)
32PODMATCH :=  $(wildcard ../lib/Smokeping/matchers/*.pm)
33PODSORT :=  $(wildcard ../lib/Smokeping/sorters/*.pm)
34
35DOCSBASE = $(subst .pod,,$(DOCS))
36
37MODBASE = $(subst .pm,,$(subst ../lib/Smokeping/probes/,Smokeping_probes_,$(PODPROBE))) \
38	  $(subst .pm,,$(subst ../lib/Smokeping/matchers/,Smokeping_matchers_,$(PODMATCH))) \
39	  $(subst .pm,,$(subst ../lib/Smokeping/sorters/,Smokeping_sorters_,$(PODSORT)))
40
41PROGBASE = smokeping smokeping_cgi tSmoke smokeinfo
42
43DOCSCONFIGBASE = smokeping_config smokeping_examples
44
45MAN3 = $(addsuffix .3,$(MODBASE))
46MAN5 = $(addsuffix .5,$(DOCSCONFIGBASE))
47MAN7 = $(addsuffix .7,$(DOCSBASE))
48MAN1 = $(addsuffix .1,$(PROGBASE))
49
50POD2MAN = pod2man --release=$(VERSION) --center=SmokePing $<
51
52# we go to this trouble to ensure that MAKEPOD only uses modules in the installation directory
53MAKEPOD= PERL5LIB=$(PERL5LIB) $(PERL) -I../thirdparty/lib/perl5 -I../lib -mSmokeping -e 'Smokeping::main()' -- --makepod
54GENEX= PERL5LIB=$(PERL5LIB) $(PERL) -I../thirdparty/lib/perl5  -I../lib -mSmokeping -e 'Smokeping::main()' -- --gen-examples
55
56%.7: %.pod
57	$(AM_V_GEN)$(POD2MAN) --section 7 > $@
58
59%.5: %.pod
60	$(AM_V_GEN)$(POD2MAN) --section 5 > $@
61
62Smokeping.3: ../lib/Smokeping.pm
63	$(AM_V_GEN)$(POD2MAN) --section 3 > $@
64
65Smokeping_Examples.3: ../lib/Smokeping/Examples.pm
66	$(AM_V_GEN)$(POD2MAN) --section 3 > $@
67
68Smokeping_RRDtools.3: ../lib/Smokeping/RRDtools.pm
69	$(AM_V_GEN)$(POD2MAN) --section 3 > $@
70
71Smokeping_probes_%.pod: ../lib/Smokeping/probes/%.pm
72	$(AM_V_GEN)$(MAKEPOD) Smokeping::probes::$* > $@
73
74Smokeping_probes_%.3: Smokeping_probes_%.pod
75	$(AM_V_GEN)$(POD2MAN) --section 3 > $@
76
77Smokeping_matchers_%.3: ../lib/Smokeping/matchers/%.pm
78	$(AM_V_GEN)$(POD2MAN) --section 3 > $@
79
80Smokeping_sorters_%.3: ../lib/Smokeping/sorters/%.pm
81	$(AM_V_GEN)$(POD2MAN) --section 3 > $@
82
83smokeping.1: ../bin/smokeping
84	$(AM_V_GEN)$(POD2MAN) --section 1 > $@
85
86smokeping_cgi.1: ../bin/smokeping_cgi
87	$(AM_V_GEN)$(POD2MAN) --section 1 > $@
88
89tSmoke.1: ../bin/tSmoke
90	$(AM_V_GEN)$(POD2MAN) --section 1 > $@
91
92smokeinfo.1: ../bin/smokeinfo
93	$(AM_V_GEN)$(POD2MAN) --section 1 > $@
94
95smokeping_config.pod: ../lib/Smokeping.pm
96	$(AM_V_GEN)$(MAKEPOD) > $@
97
98smokeping_examples.pod: ../lib/Smokeping/Examples.pm ../etc/config.sample
99	$(AM_V_GEN)$(MKDIR) -p examples
100	$(AM_V_GEN)$(GENEX)
101
102.1.txt .3.txt .5.txt .7.txt:
103	$(AM_V_GEN)GROFF_NO_SGR=1 @NROFF@ -man -Tlp $< > $@
104
105
106CLEANFILES = *.[1357] smokeping_examples.pod smokeping_config.pod examples/*
107
108iman1dir = $(mandir)/man1
109iman1_DATA = $(MAN1)
110
111iman3dir = $(mandir)/man3
112iman3_DATA = $(MAN3)
113
114iman5dir = $(mandir)/man5
115iman5_DATA = $(MAN5)
116
117iman7dir = $(mandir)/man7
118iman7_DATA = $(MAN7)
119
120EXAMPLES := $(wildcard examples/config.*)
121
122etcdir = /usr/local/share/examples/smokeping
123etc_DATA = $(EXAMPLES)
124
125