File: Makefile

package info (click to toggle)
cdist 7.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,992 kB
  • sloc: sh: 16,815; python: 9,199; makefile: 344; awk: 261
file content (148 lines) | stat: -rw-r--r-- 4,443 bytes parent folder | download | duplicates (3)
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
#
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.
#
# cdist 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 3 of the License, or
# (at your option) any later version.
#
# cdist 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 cdist. If not, see <http://www.gnu.org/licenses/>.
#
#

.PHONY: help
help:
	@echo "Please use \`make <target>' where <target> is one of"
	@echo "man             build only man user documentation"
	@echo "html            build only html user documentation"
	@echo "docs            build both man and html user documentation"
	@echo "dotman          build man pages for types in your ~/.cdist directory"
	@echo "speeches        build speeches pdf files"
	@echo "install         install in the system site-packages directory"
	@echo "install-user    install in the user site-packages directory"
	@echo "docs-clean      clean documentation"
	@echo "clean           clean"

DOCS_SRC_DIR=./docs/src
SPEECHDIR=./docs/speeches
TYPEDIR=./cdist/conf/type

SPHINXM=$(MAKE) -C $(DOCS_SRC_DIR) man
SPHINXH=$(MAKE) -C $(DOCS_SRC_DIR) html
SPHINXC=$(MAKE) -C $(DOCS_SRC_DIR) clean

################################################################################
# Manpages
#
MAN7DSTDIR=$(DOCS_SRC_DIR)/man7

# Manpages #1: Types
# Use shell / ls to get complete list - $(TYPEDIR)/*/man.rst does not work
# Using ls does not work if no file with given pattern exist, so use wildcard
MANTYPESRC=$(wildcard $(TYPEDIR)/*/man.rst)
MANTYPEPREFIX=$(subst $(TYPEDIR)/,$(MAN7DSTDIR)/cdist-type,$(MANTYPESRC))
MANTYPES=$(subst /man.rst,.rst,$(MANTYPEPREFIX))

# Link manpage: do not create man.html but correct named file
$(MAN7DSTDIR)/cdist-type%.rst: $(TYPEDIR)/%/man.rst
	mkdir -p $(MAN7DSTDIR)
	ln -sf "../../../$^" $@

# Manpages #2: reference
DOCSREF=$(MAN7DSTDIR)/cdist-reference.rst
DOCSREFSH=$(DOCS_SRC_DIR)/cdist-reference.rst.sh

$(DOCSREF): $(DOCSREFSH)
	$(DOCSREFSH)

# Html types list with references
DOCSTYPESREF=$(MAN7DSTDIR)/cdist-types.rst
DOCSTYPESREFSH=$(DOCS_SRC_DIR)/cdist-types.rst.sh

$(DOCSTYPESREF): $(DOCSTYPESREFSH)
	$(DOCSTYPESREFSH)

DOCSCFGSKEL=./configuration/cdist.cfg.skeleton

configskel: $(DOCSCFGSKEL)
	cp -f "$(DOCSCFGSKEL)" "$(DOCS_SRC_DIR)/"

version:
	@[ -f "cdist/version.py" ] || { \
		printf "Missing 'cdist/version.py', please generate it first.\n" && exit 1; \
	}

# Manpages #3: generic part
man: version configskel $(MANTYPES) $(DOCSREF) $(DOCSTYPESREF)
	$(SPHINXM)

html: version configskel $(MANTYPES) $(DOCSREF) $(DOCSTYPESREF)
	$(SPHINXH)

docs: man html

docs-clean:
	$(SPHINXC)

# Manpages: .cdist Types
DOT_CDIST_PATH=${HOME}/.cdist
DOTMAN7DSTDIR=$(MAN7DSTDIR)
DOTTYPEDIR=$(DOT_CDIST_PATH)/type
DOTMANTYPESRC=$(wildcard $(DOTTYPEDIR)/*/man.rst)
DOTMANTYPEPREFIX=$(subst $(DOTTYPEDIR)/,$(DOTMAN7DSTDIR)/cdist-type,$(DOTMANTYPESRC))
DOTMANTYPES=$(subst /man.rst,.rst,$(DOTMANTYPEPREFIX))

# Link manpage: do not create man.html but correct named file
$(DOTMAN7DSTDIR)/cdist-type%.rst: $(DOTTYPEDIR)/%/man.rst
	ln -sf "$^" $@

dotman: version configskel $(DOTMANTYPES) $(DOCSREF) $(DOCSTYPESREF)
	$(SPHINXM)

################################################################################
# Speeches
#
SPEECHESOURCES=$(SPEECHDIR)/*.tex
SPEECHES=$(SPEECHESOURCES:.tex=.pdf)

# Create speeches and ensure Toc is up-to-date
$(SPEECHDIR)/%.pdf: $(SPEECHDIR)/%.tex
	pdflatex -output-directory $(SPEECHDIR) $^
	pdflatex -output-directory $(SPEECHDIR) $^
	pdflatex -output-directory $(SPEECHDIR) $^

speeches: $(SPEECHES)

################################################################################
# Misc
#
clean: docs-clean
	rm -f $(DOCS_SRC_DIR)/cdist-reference.rst
	rm -f $(DOCS_SRC_DIR)/cdist-types.rst
	rm -f $(DOCS_SRC_DIR)/cdist.cfg.skeleton

	find "$(DOCS_SRC_DIR)" -mindepth 2 -type l \
	| xargs rm -f

	find * -name __pycache__  | xargs rm -rf

	# distutils
	rm -rf ./build

################################################################################
# install
#

install:
	python3 setup.py install

install-user:
	python3 setup.py install --user