Skip to content

Commit 89fba95

Browse files
committedMay 2, 2014
Build: Create a common location for shared makefile functionality
1 parent f6f66ac commit 89fba95

File tree

9 files changed

+90
-133
lines changed

9 files changed

+90
-133
lines changed
 

‎Makefile.common

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Not all current distros support AM_V_P
2+
# https://www.gnu.org/software/automake/manual/html_node/Automake-silent_002drules-Option.html
3+
4+
V ?= $(AM_DEFAULT_VERBOSITY)
5+
6+
PCMK_V = $(pcmk__v_$(V))
7+
pcmk__v_0 = :
8+
pcmk__v_1 =
9+
10+
PCMK_quiet = $(pcmk_quiet_$(V))
11+
pcmk_quiet_0 = >/dev/null 2>&1
12+
pcmk_quiet_1 =
13+
14+
AM_V_XSL = $(am__v_XSL_$(V))
15+
am__v_XSL_0 = @echo " XSL " $@;
16+
am__v_XSL_1 =
17+
18+
AM_V_MAN = $(am__v_MAN_$(V))
19+
am__v_MAN_0 = @echo " MAN " $@;
20+
am__v_MAN_1 =
21+
22+
AM_V_ASCII = $(am__v_ASCII_$(V))
23+
am__v_ASCII_0 = @echo " ASCII " $@;
24+
am__v_ASCII_1 =
25+
26+
AM_V_PUB = $(am__v_PUB_$(V))
27+
am__v_PUB_0 = @echo " PUB $@: $(DOCBOOK_FORMATS)";
28+
am__v_PUB_1 =
29+
30+
MAINTAINERCLEANFILES = Makefile.in
31+
32+
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \
33+
-I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl
34+
35+
if BUILD_HELP
36+
man8_MANS = $(sbin_PROGRAMS:%=%.8) $(sbin_SCRIPTS:%=%.8)
37+
endif
38+
39+
%.8: %
40+
chmod a+x $(abs_builddir)/$<
41+
$(PCMK_V) $(abs_builddir)/$< --help
42+
$(AM_V_MAN)$(HELP2MAN) --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(abs_builddir)/$<
43+
44+
%.xml: %
45+
$(AM_V_GEN)$(abs_builddir)/$< metadata > $@
46+
47+
%.dbook: %.xml
48+
$(AM_V_XSL)$(XSLTPROC) --nonet --novalid --stringparam man.name $* $(DBOOK_OPTS) $(top_srcdir)/xml/ocf-meta2man.xsl $(abs_builddir)/$< > $(abs_builddir)/$@
49+
50+
%.7: %.dbook
51+
$(AM_V_XSL)$(XSLTPROC) $(MANPAGE_XSLT) $(abs_builddir)/$< $(PCMK_quiet)
52+
53+
# Build docbook from asciidoc because XML is a PITA to edit
54+
#
55+
# Build each chapter as a book (since the numbering isn't right for
56+
# articles and only books can have appendicies) and then strip out the
57+
# bits we don't want/need
58+
#
59+
%.xml: %.txt
60+
$(AM_V_ASCII)asciidoc -b docbook -a cli_name=$(ASCIIDOC_CLI_TYPE) -a $(ASCIIDOC_CLI_TYPE)=true -d book -o $@ $<
61+
sed -i.sed 's///' $@
62+
sed -i.sed 's///' $@ # Fix line endings
63+
sed -i.sed 's/\ lang="en"//' $@ # Never specify a language in the chapters
64+
sed -i.sed 's/simpara/para/g' $@ # publican doesn't correctly render footnotes with simpara
65+
sed -i.sed 's/.*<date>.*//g' $@ # Remove dangling tag
66+
sed -i.sed 's/.*preface>//g' $@ # Remove preface elements
67+
sed -i.sed 's:<title></title>::g' $@ # Remove empty title
68+
sed -i.sed 's/chapter/section/g' $@ # Chapters become sections, so that books can become chapters
69+
sed -i.sed 's/<.*bookinfo.*>//g' $@ # Strip out bookinfo, we don't need it
70+
-grep -qis "<appendix" $@ && sed -i.sed 's/.*book>//' $@ # We just want the appendix tag
71+
-grep -vqis "<appendix" $@ && sed -i.sed 's/book>/chapter>/g' $@ # Rename to chapter
72+
73+
# echo Rebuilt $@ from $<

‎cib/Makefile.am

+1-13
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
# along with this program; if not, write to the Free Software
1616
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717
#
18-
MAINTAINERCLEANFILES = Makefile.in
19-
20-
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
21-
-I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl
18+
include $(top_srcdir)/Makefile.common
2219

2320
EXTRA_DIST = cib.pam
2421

@@ -32,15 +29,6 @@ COMMONLIBS = $(top_builddir)/lib/common/libcrmcommon.la \
3229
## binary progs
3330
halib_PROGRAMS = cib cibmon
3431

35-
if BUILD_HELP
36-
man8_MANS =
37-
%.8: %
38-
echo " MAN $@"
39-
chmod a+x $(top_builddir)/cib/$<
40-
if $(AM_V_P); then $(top_builddir)/cib/$< --help; fi
41-
$(HELP2MAN) --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/cib/$<
42-
endif
43-
4432
## SOURCES
4533
noinst_HEADERS = callbacks.h cibio.h cibmessages.h common.h notify.h
4634

‎crmd/Makefile.am

+2-20
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
# along with this program; if not, write to the Free Software
1616
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717
#
18-
MAINTAINERCLEANFILES = Makefile.in
19-
20-
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
21-
-I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl
18+
include $(top_srcdir)/Makefile.common
2219

2320
halibdir = $(CRM_DAEMON_DIR)
2421

@@ -50,29 +47,14 @@ crmd_LDADD = $(top_builddir)/lib/fencing/libstonithd.la \
5047
$(top_builddir)/lib/services/libcrmservice.la \
5148
$(top_builddir)/lib/lrmd/liblrmd.la \
5249
$(CLUSTERLIBS)
50+
5351
if BUILD_XML_HELP
5452
man7_MANS = crmd.7
55-
56-
pcmk_quiet = $(pcmk_quiet_@AM_V@)
57-
pcmk_quiet_ = $(pcmk_quiet_@AM_DEFAULT_V@)
58-
pcmk_quiet_0 = 2>/dev/null
59-
60-
%.xml: %
61-
echo " DBOOK $@"
62-
$(top_builddir)/crmd/$< metadata | $(XSLTPROC) --nonet --novalid --stringparam man.name $< $(top_srcdir)/xml/ocf-meta2man.xsl - > $(top_builddir)/crmd/$@
63-
64-
%.7: %.xml
65-
echo " MAN $@"
66-
$(XSLTPROC) $(MANPAGE_XSLT) $(top_builddir)/crmd/$< $(pcmk_quiet)
6753
endif
6854

6955
clean-generic:
7056
rm -f *.log *.debug *.xml *~
7157

72-
install-exec-local:
73-
74-
uninstall-local:
75-
7658
graphs: fsa_inputs.png fsa_inputs_by_action.png fsa_actions_by_state.png
7759

7860
%.png: %.dot

‎extra/resources/Makefile.am

+6-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
# along with this program; if not, write to the Free Software
1818
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1919
#
20-
MAINTAINERCLEANFILES = Makefile.in
20+
include $(top_srcdir)/Makefile.common
21+
2122
EXTRA_DIST = $(ocf_SCRIPTS)
2223

2324
ocfdir = @OCF_RA_DIR@/pacemaker
@@ -35,20 +36,14 @@ ocf_SCRIPTS = ClusterMon \
3536
SystemHealth \
3637
remote
3738

38-
pcmk_quiet = $(pcmk_quiet_@AM_V@)
39-
pcmk_quiet_ = $(pcmk_quiet_@AM_DEFAULT_V@)
40-
pcmk_quiet_0 = 2>/dev/null
41-
4239
if BUILD_XML_HELP
40+
4341
man7_MANS = $(ocf_SCRIPTS:%=ocf_pacemaker_%.7)
42+
DBOOK_OPTS = --stringparam command.prefix ocf_pacemaker_ --stringparam variable.prefix OCF_RESKEY_ --param man.vol 7
4443

45-
%.xml: %
46-
echo " DBOOK $@"
47-
OCF_FUNCTIONS=/dev/null OCF_ROOT=$(OCF_ROOT_DIR) sh $(top_srcdir)/extra/resources/$< meta-data | $(XSLTPROC) --nonet --novalid --stringparam command.prefix ocf_pacemaker_ --stringparam variable.prefix OCF_RESKEY_ --param man.vol 7 $(top_srcdir)/xml/ocf-meta2man.xsl - > $@ $(pcmk_quiet)
44+
ocf_pacemaker_%.xml: %
45+
$(AM_V_GEN)OCF_FUNCTIONS=/dev/null OCF_ROOT=$(OCF_ROOT_DIR) sh $(abs_builddir)/$< meta-data > $@
4846

49-
ocf_pacemaker_%.7: %.xml
50-
echo " MAN $@"
51-
$(XSLTPROC) $(MANPAGE_XSLT) $(top_builddir)/extra/resources/$< $(pcmk_quiet)
5247
endif
5348

5449
clean-generic:

‎fencing/Makefile.am

+2-25
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# along with this program; if not, write to the Free Software
1616
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717
#
18-
MAINTAINERCLEANFILES = Makefile.in
18+
include $(top_srcdir)/Makefile.common
1919

2020
SUBDIRS =
2121

@@ -31,31 +31,8 @@ sbin_SCRIPTS = fence_legacy fence_pcmk
3131

3232
noinst_HEADERS = internal.h
3333

34-
man7_MANS =
35-
man8_MANS =
36-
37-
pcmk_quiet = $(pcmk_quiet_@AM_V@)
38-
pcmk_quiet_ = $(pcmk_quiet_@AM_DEFAULT_V@)
39-
pcmk_quiet_0 = 2>/dev/null
40-
4134
if BUILD_XML_HELP
42-
man7_MANS += stonithd.7
43-
stonithd.xml: stonithd
44-
echo " DBOOK $@"
45-
$(top_builddir)/fencing/$< metadata | $(XSLTPROC) --nonet --novalid --stringparam man.name $< $(top_srcdir)/xml/ocf-meta2man.xsl - > $(top_builddir)/fencing/$@
46-
47-
stonithd.7: stonithd.xml
48-
echo " MAN $@"
49-
$(XSLTPROC) $(MANPAGE_XSLT) $(top_builddir)/fencing/$< $(pcmk_quiet)
50-
endif
51-
52-
if BUILD_HELP
53-
man8_MANS += $(sbin_PROGRAMS:%=%.8) $(sbin_SCRIPTS:%=%.8)
54-
%.8: %
55-
echo " MAN $@"
56-
chmod a+x $(top_builddir)/fencing/$<
57-
if $(AM_V_P); then $(top_builddir)/fencing/$< --help; fi
58-
$(HELP2MAN) --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/fencing/$<
35+
man7_MANS = stonithd.7
5936
endif
6037

6138
stonith_test_SOURCES = test.c

‎lrmd/Makefile.am

+1-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1616
#
1717

18-
MAINTAINERCLEANFILES = Makefile.in
18+
include $(top_srcdir)/Makefile.common
1919

2020
testdir = $(datadir)/$(PACKAGE)/tests/lrmd
2121
test_SCRIPTS = regression.py
@@ -31,16 +31,6 @@ if BUILD_SYSTEMD
3131
systemdunit_DATA = pacemaker_remote.service
3232
endif
3333

34-
if BUILD_HELP
35-
man8_MANS = $(sbin_PROGRAMS:%=%.8)
36-
endif
37-
38-
%.8: %
39-
echo " MAN $@"
40-
chmod a+x $(top_builddir)/lrmd/$<
41-
if $(AM_V_P); then $(top_builddir)/lrmd/$< --help; fi
42-
$(HELP2MAN) --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/lrmd/$<
43-
4434
lrmd_SOURCES = main.c lrmd.c
4535
lrmd_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \
4636
$(top_builddir)/lib/services/libcrmservice.la \

‎mcp/Makefile.am

+1-19
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,14 @@
1515
# along with this program; if not, write to the Free Software
1616
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717
#
18-
MAINTAINERCLEANFILES = Makefile.in
18+
include $(top_srcdir)/Makefile.common
1919

2020
if BUILD_CS_SUPPORT
21-
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
22-
-I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl
2321

2422
initdir = $(INITDIR)
2523
init_SCRIPTS = pacemaker
2624
sbin_PROGRAMS = pacemakerd
2725

28-
if BUILD_HELP
29-
man8_MANS = $(sbin_PROGRAMS:%=%.8)
30-
endif
31-
3226
if BUILD_SYSTEMD
3327
systemdunit_DATA = pacemaker.service
3428
endif
@@ -41,18 +35,6 @@ pacemakerd_SOURCES = pacemaker.c corosync.c
4135
pacemakerd_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la $(top_builddir)/lib/common/libcrmcommon.la
4236
pacemakerd_LDFLAGS = $(CLUSTERLIBS)
4337

44-
%.8: %
45-
echo " MAN $@"
46-
chmod a+x $(top_builddir)/mcp/$<
47-
if $(AM_V_P); then $(top_builddir)/mcp/$< --help; fi
48-
$(HELP2MAN) --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/mcp/$<
49-
5038
clean-generic:
5139
rm -f *.log *.debug *.xml *~
52-
53-
install-exec-local:
54-
55-
uninstall-local:
56-
57-
.PHONY: install-exec-hook
5840
endif

‎pengine/Makefile.am

+3-19
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
# along with this program; if not, write to the Free Software
1616
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717
#
18-
MAINTAINERCLEANFILES = Makefile.in
18+
include $(top_srcdir)/Makefile.common
1919

20-
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
21-
-I$(top_builddir) -I$(top_srcdir) \
22-
-I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl
20+
AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir)
2321

2422
halibdir = $(CRM_DAEMON_DIR)
2523

@@ -43,22 +41,8 @@ lib_LTLIBRARIES = libpengine.la
4341
## binary progs
4442
halib_PROGRAMS = pengine
4543

46-
pcmk_quiet = $(pcmk_quiet_@AM_V@)
47-
pcmk_quiet_ = $(pcmk_quiet_@AM_DEFAULT_V@)
48-
pcmk_quiet_0 = 2>/dev/null
49-
50-
man7_MANS =
51-
5244
if BUILD_XML_HELP
53-
man7_MANS += pengine.7
54-
55-
pengine.xml: pengine
56-
echo " DBOOK $@"
57-
$(top_builddir)/pengine/$< metadata | $(XSLTPROC) --nonet --novalid --stringparam man.name $< $(top_srcdir)/xml/ocf-meta2man.xsl - > $(top_builddir)/pengine/$@
58-
59-
pengine.7: pengine.xml
60-
echo " MAN $@"
61-
$(XSLTPROC) $(MANPAGE_XSLT) $(top_builddir)/pengine/$< $(pcmk_quiet)
45+
man7_MANS = pengine.7
6246
endif
6347

6448
## SOURCES

‎tools/Makefile.am

+1-15
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
# along with this program; if not, write to the Free Software
1616
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717
#
18-
MAINTAINERCLEANFILES = Makefile.in
19-
20-
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
21-
-I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl
18+
include $(top_srcdir)/Makefile.common
2219

2320
COMMONLIBS = \
2421
$(top_builddir)/lib/common/libcrmcommon.la \
@@ -54,10 +51,6 @@ if BUILD_OPENIPMI_SERVICELOG
5451
sbin_PROGRAMS += ipmiservicelogd
5552
endif
5653

57-
if BUILD_HELP
58-
man8_MANS = $(sbin_PROGRAMS:%=%.8) $(sbin_SCRIPTS:%=%.8)
59-
endif
60-
6154
## SOURCES
6255

6356
noinst_HEADERS =
@@ -142,13 +135,6 @@ ipmiservicelogd_CFLAGS = $(OPENIPMI_SERVICELOG_CFLAGS) $(SERVICELOG_CFLAGS)
142135
ipmiservicelogd_LDFLAGS = $(top_builddir)/lib/common/libcrmcommon.la $(OPENIPMI_SERVICELOG_LIBS) $(SERVICELOG_LIBS)
143136
endif
144137

145-
# https://www.gnu.org/software/automake/manual/html_node/Automake-silent_002drules-Option.html
146-
%.8: % crm_attribute
147-
echo " MAN $@"
148-
chmod a+x $(top_builddir)/tools/$<
149-
if $(AM_V_P); then $(top_builddir)/tools/$< --help; fi
150-
PATH=$(top_builddir)/tools:$$PATH $(HELP2MAN) --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/tools/$<
151-
152138
clean-generic:
153139
rm -f *.log *.debug *.xml *~
154140

0 commit comments

Comments
 (0)
Please sign in to comment.