File: Makefile

package info (click to toggle)
piuparts 0.62
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 1,692 kB
  • sloc: python: 6,823; sh: 2,194; makefile: 126
file content (162 lines) | stat: -rw-r--r-- 5,883 bytes parent folder | download | duplicates (2)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
prefix = /usr/local
sbindir = $(prefix)/sbin
sharedir = $(prefix)/share
mandir = $(sharedir)/man
man1dir = $(mandir)/man1
man8dir = $(mandir)/man8
libdir = $(prefix)/lib
docdir = $(prefix)/share/doc/piuparts/
site27 = $(libdir)/python2.7/dist-packages
htdocsdir	 = $(sharedir)/piuparts/htdocs
etcdir = $(prefix)/etc

distribution=${shell dpkg-parsechangelog | sed -n 's/^Distribution: *//p'}
ifeq ($(distribution),UNRELEASED)
version		:= ${shell echo "`dpkg-parsechangelog | sed -n 's/^Version: *//p'`~`date +%Y%m%d%H%M`~`git describe --dirty`"}
else
version		:= ${shell dpkg-parsechangelog | sed -n 's/^Version: *//p'}
endif


# generate several scripts, conffiles, ... from templates (*.in, *.py)
# by substituting placeholders
SCRIPTS_TEMPLATES	 = $(wildcard *.in master-bin/*.in slave-bin/*.in conf/*.in)
SCRIPTS_PYTHON_BINARY	 = $(wildcard *.py master-bin/*.py slave-bin/*.py)
SCRIPTS_GENERATED	 = $(SCRIPTS_TEMPLATES:.in=) $(SCRIPTS_PYTHON_BINARY:.py=)
DOCS_GENERATED		 = piuparts.1 piuparts.1.html piuparts_slave_run.8 piuparts_slave_join.8 README.html README_server.html

define placeholder_substitution
	sed -r \
	-e 's/__PIUPARTS_VERSION__/$(version)/g' \
	-e 's%@sharedir@%$(sharedir)%g' \
	$< > $@
endef

%: %.in Makefile
	$(placeholder_substitution)

%: %.py Makefile
	$(placeholder_substitution)


all: build

python_scripts	 = $(wildcard *.py piupartslib/*.py master-bin/*.py slave-bin/*.py)
python-syntax-check:
	@set -e -x; $(foreach py,$(python_scripts),python -m py_compile $(py);)
	$(RM) $(python_scripts:=c)

build: build-stamp

build-stamp: $(SCRIPTS_GENERATED) $(DOCS_GENERATED) Makefile
	$(MAKE) python-syntax-check
	touch $@

build-doc: $(DOCS_GENERATED)

README.html: README.txt
	a2x --copy -a toc -a toclevels=3 -f xhtml -r /etc/asciidoc/ README.txt

README_server.html: README_server.txt
	a2x --copy -a toc -a toclevels=3 -f xhtml -r /etc/asciidoc/ README_server.txt

piuparts.1: piuparts.1.txt
	a2x -f manpage piuparts.1.txt

piuparts_slave_run.8: piuparts_slave_run.8.txt
	a2x -f manpage piuparts_slave_run.8.txt

piuparts_slave_join.8: piuparts_slave_join.8.txt
	a2x -f manpage piuparts_slave_join.8.txt

piuparts.1.html: piuparts.1.txt
	a2x --copy -f xhtml piuparts.1.txt

install-doc: build-stamp
	install -d $(DESTDIR)$(docdir)/
	install -m 0644 README.txt README.html README_server.txt README_server.html docbook-xsl.css $(DESTDIR)$(docdir)/
	install -d $(DESTDIR)$(man1dir)
	install -m 0644 piuparts.1 $(DESTDIR)$(man1dir)/
	install -d $(DESTDIR)$(man8dir)
	install -m 0644 piuparts_slave_run.8 piuparts_slave_join.8 $(DESTDIR)$(man8dir)/
	gzip -9f $(DESTDIR)$(man1dir)/piuparts.1
	gzip -9f $(DESTDIR)$(man8dir)/piuparts_slave_run.8
	gzip -9f $(DESTDIR)$(man8dir)/piuparts_slave_join.8
	install -m 0644 piuparts.1.html $(DESTDIR)$(docdir)/

install-conf: build-stamp
	install -d $(DESTDIR)$(etcdir)/piuparts
	install -m 0644 conf/piuparts.conf.sample $(DESTDIR)$(etcdir)/piuparts/piuparts.conf
	install -m 0644 conf/distros.conf $(DESTDIR)$(etcdir)/piuparts/
	install -d $(DESTDIR)$(etcdir)/apache2/conf-available
	install -m 0644 conf/piuparts-master.conf $(DESTDIR)$(etcdir)/apache2/conf-available/

install-conf-4-running-from-git: build-stamp
	install -d $(DESTDIR)$(etcdir)/piuparts
	install -m 0644 conf/crontab-master $(DESTDIR)$(etcdir)/piuparts/
	install -m 0644 conf/crontab-slave $(DESTDIR)$(etcdir)/piuparts/
	install -m 0644 conf/distros.conf $(DESTDIR)$(etcdir)/piuparts/
	install -m 0644 instances/piuparts.conf.* $(DESTDIR)$(etcdir)/piuparts/
	install -d $(DESTDIR)$(sharedir)/piuparts/slave
	install -m 0755 update-piuparts-slave-setup $(DESTDIR)$(sharedir)/piuparts/slave/
	install -d $(DESTDIR)$(sharedir)/piuparts/master
	install -m 0755 update-piuparts-master-setup $(DESTDIR)$(sharedir)/piuparts/master/

install: build-stamp
	install -d $(DESTDIR)$(sbindir)
	install -m 0755 piuparts $(DESTDIR)$(sbindir)/

	install -d $(DESTDIR)$(sharedir)/piuparts
	install -m 0755 piuparts-slave piuparts-master piuparts-master-backend piuparts-report piuparts-analyze $(DESTDIR)$(sharedir)/piuparts/

	install -d $(DESTDIR)$(site27)/piupartslib
	install -m 0644 piupartslib/*.py $(DESTDIR)$(site27)/piupartslib/

	install -d $(DESTDIR)$(sharedir)/piuparts/lib
	install -m 0644 lib/*.sh $(DESTDIR)$(sharedir)/piuparts/lib/

	# do not install the templates (*.in, *.py)
	install -d $(DESTDIR)$(sharedir)/piuparts/master
	install -m 0755 $(filter-out %.in %.py,$(wildcard master-bin/*)) $(DESTDIR)$(sharedir)/piuparts/master/

	install -d $(DESTDIR)$(sharedir)/piuparts/known_problems
	install -m 0644 known_problems/*.conf $(DESTDIR)$(sharedir)/piuparts/known_problems/

	# do not install the templates (*.in, *.py)
	install -d $(DESTDIR)$(sharedir)/piuparts/slave
	install -m 0755 $(filter-out %.in %.py,$(wildcard slave-bin/*)) $(DESTDIR)$(sharedir)/piuparts/slave/

	install -d $(DESTDIR)$(htdocsdir)
	install -m 0644 htdocs/*.* $(DESTDIR)$(htdocsdir)/

	install -d $(DESTDIR)$(htdocsdir)/images
	install -m 0644 htdocs/images/*.* $(DESTDIR)$(htdocsdir)/images/

	install -d $(DESTDIR)$(htdocsdir)/templates/mail
	install -m 0644 bug-templates/*.mail $(DESTDIR)$(htdocsdir)/templates/mail/

	install -d $(DESTDIR)$(etcdir)/piuparts
	@set -e -x ; \
	for d in $$(ls custom-scripts) ; do \
		install -d $(DESTDIR)$(etcdir)/piuparts/$$d ; \
		install -m 0755 custom-scripts/$$d/* $(DESTDIR)$(etcdir)/piuparts/$$d/ ; done

	#install -d $(DESTDIR)$(etcdir)/piuparts/known_problems
	#install -m 0644 known_problems/*.conf $(DESTDIR)$(etcdir)/piuparts/known_problems/


check:
	nosetests --verbose

clean:
	rm -f build-stamp
	rm -f $(DOCS_GENERATED)
	rm -f piuparts.1.xml README.xml README_server.xml docbook-xsl.css piuparts.html
	rm -f *.pyc piupartslib/*.pyc master-bin/*.pyc slave-bin/*.pyc tests/*.pyc
	rm -f $(SCRIPTS_GENERATED)


# for maintainer convenience only
tg-deps:
	tg summary --graphviz | dot -T png -o deps.png
	xli deps.png &