Add configure.ac and Makefile.am and make them work
[nitsi.git] / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
2 AM_MAKEFLAGS = --no-print-directory
3 AUTOMAKE_OPTIONS = color-tests
4
5 # remove target it the command fails
6 .DELETE_ON_ERROR:
7
8 # keep itermediate files
9 .SECONDARY:
10
11 pythondir  = $(pyexecdir)
12
13 CLEANFILES =
14 DISTCLEANFILES =
15 EXTRA_DIST =
16 INSTALL_DIRS =
17 noinst_DATA =
18
19
20 AM_V_XSLT   = $(AM_V_XSLT_$(V))
21 AM_V_XSLT_  = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
22 AM_V_XSLT_0 = @echo "  XSLT    " $@;
23
24 bin_SCRIPTS = \
25         nitsi
26
27 CLEANFILES += \
28         nitsi
29
30 nitsi_PYTHON = \
31         src/nitsi/__init__.py \
32         src/nitsi/disk.py \
33         src/nitsi/machine.py \
34         src/nitsi/network.py \
35         src/nitsi/recipe.py \
36         src/nitsi/serial_connection.py \
37         src/nitsi/test.py \
38         src/nitsi/virtual_environ.py
39
40
41 nitsidir = $(pythondir)/nitsi
42
43 # ------------------------------------------------------------------------------
44
45 .PHONY: man
46 man: $(MANPAGES) $(MANPAGES_HTML)
47
48 if ENABLE_MANPAGES
49 MANPAGES = \
50         man/nitsi.1
51
52 MANPAGES_XML  = $(patsubst %.1,%.xml,$(patsubst %.5,%.xml,$(MANPAGES)))
53 MANPAGES_HTML = $(patsubst %.xml,%.html,$(MANPAGES_XML))
54
55 man_MANS = \
56         $(MANPAGES)
57
58 noinst_DATA += \
59         $(MANPAGES_HTML)
60
61 CLEANFILES += \
62         $(man_MANS) \
63         $(MANPAGES_HTML)
64
65 EXTRA_DIST += \
66         $(MANPAGES_XML) \
67         man/custom-html.xsl
68
69 XSLTPROC_FLAGS = \
70         --nonet \
71         --stringparam man.output.quietly 1 \
72         --stringparam funcsynopsis.style ansi \
73         --stringparam man.th.extra1.suppress 1 \
74         --stringparam man.authors.section.enabled 1 \
75         --stringparam man.copyright.section.enabled 1
76
77 XSLTPROC_COMMAND_MAN = \
78         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
79                 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
80
81 XSLTPROC_COMMAND_HTML = \
82         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
83
84 man/%.1: man/%.xml
85         $(XSLTPROC_COMMAND_MAN)
86
87 man/%.5: man/%.xml
88         $(XSLTPROC_COMMAND_MAN)
89
90 man/%.html: man/%.xml man/custom-html.xsl
91         $(XSLTPROC_COMMAND_HTML)
92
93 endif
94
95 # ------------------------------------------------------------------------------
96
97 substitutions = \
98         '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
99         '|PACKAGE_VERSION=$(PACKAGE_VERSION)|'
100
101 SED_PROCESS = \
102         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
103         $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
104                 < $< > $@
105
106 nitsi: nitsi.in Makefile
107         $(SED_PROCESS)