aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e077af284b791433f5cfe4450d4d3a25d9818ee7 (plain)
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
INSTALL = install
INSTALL_DIRECTORY = $(INSTALL) -d -m 0755
INSTALL_FILE = $(INSTALL) -m 0644
INSTALL_EXECUTABLE = $(INSTALL) -m 0755

# semi-standard dirs
DESTDIR :=
SYSCONFDIR := $(DESTDIR)/etc
BINDIR := $(DESTDIR)/usr/bin
PKGLIBDIR := $(DESTDIR)/usr/lib/pbuilder
SBINDIR := $(DESTDIR)/usr/sbin
PKGDATADIR := $(DESTDIR)/usr/share/pbuilder

define newline


endef

NULL :=

ALLDIRS += BASHCOMPLETION
BASHCOMPLETIONDIR := $(SYSCONFDIR)/bash_completion.d
BASHCOMPLETION_DATA += \
	bash_completion.d/pbuilder \
	$(NULL)
CHECK_SCRIPTS += bash_completion.d/pbuilder

ALLDIRS += PBUILDERCONF
PBUILDERCONFDIR := $(SYSCONFDIR)/pbuilder
PBUILDERCONF_DATA += \
	pbuilder-uml.conf \
	$(NULL)
CHECK_SCRIPTS += pbuilder-uml.conf

ALLDIRS += BIN
BIN_SCRIPTS += \
	debuild-pbuilder \
	pbuilder-user-mode-linux \
	pdebuild \
	pdebuild-user-mode-linux \
	$(NULL)

ALLDIRS += PKGLIB
PKGLIB_SCRIPTS += \
	pbuilder-apt-config \
	pbuilder-buildpackage \
	pbuilder-buildpackage-funcs \
	pbuilder-checkparams \
	pbuilder-createbuildenv \
	pbuilder-loadconfig \
	pbuilder-modules \
	pbuilder-runhooks \
	pbuilder-satisfydepends-aptitude \
	pbuilder-satisfydepends-checkparams \
	pbuilder-satisfydepends-classic \
	pbuilder-satisfydepends-experimental \
	pbuilder-satisfydepends-funcs \
	pbuilder-satisfydepends-gdebi \
	pbuilder-selftest \
	pbuilder-uml-checkparams \
	pbuilder-unshare-wrapper \
	pbuilder-updatebuildenv \
	pdebuild-checkparams \
	pdebuild-internal \
	pdebuild-uml-checkparams \
	testlib.sh \
	test_pbuilder-apt-config \
	test_pbuilder-checkparams \
	test_pbuilder-modules \
	test_pbuilder-satisfydepends-checkparams \
	test_pbuilder-satisfydepends-classic \
	test_pbuilder-satisfydepends-funcs \
	test_testlib.sh \
	$(NULL)

ALLDIRS += SBIN
SBIN_SCRIPTS += \
	pbuilder \
	$(NULL)

ALLDIRS += EXAMPLE
EXAMPLEDIR := $(DESTDIR)/usr/share/doc/pbuilder/examples
EXAMPLE_DATA += \
	pbuilderrc \
	$(NULL)
CHECK_SCRIPTS += pbuilderrc
EXAMPLE_SCRIPTS += \
	examples/B90lintian \
	examples/B91dpkg-i \
	examples/B92test-pkg \
	examples/C10shell \
	examples/C11screen \
	examples/D10tmp \
	examples/D20addnonfree \
	examples/D65various-compiler-support \
	examples/D80no-man-db-rebuild \
	examples/D90chrootmemo \
	examples/F90chrootmemo \
	examples/B90list-missing \
	examples/B91debc \
	examples/execute_installtest.sh \
	examples/execute_paramtest.sh \
	examples/pbuilder-distribution.sh \
	$(NULL)

ALLDIRS += EXAMPLE_LVMPBUILDER
EXAMPLE_LVMPBUILDERDIR := $(EXAMPLEDIR)/lvmpbuilder
EXAMPLE_LVMPBUILDER_DATA += \
	examples/lvmpbuilder/README \
	examples/lvmpbuilder/STRATEGY \
	$(NULL)
EXAMPLE_LVMPBUILDER_SCRIPTS += \
	examples/lvmpbuilder/lvmbuilder \
	$(NULL)

ALLDIRS += EXAMPLE_LVMPBUILDER_LIB
EXAMPLE_LVMPBUILDER_LIBDIR := $(EXAMPLE_LVMPBUILDERDIR)/lib
EXAMPLE_LVMPBUILDER_LIB_SCRIPTS += \
	examples/lvmpbuilder/lib/lvmbuilder-checkparams \
	examples/lvmpbuilder/lib/lvmbuilder-modules \
	examples/lvmpbuilder/lib/lvmbuilder-unimplemented \
	$(NULL)

ALLDIRS += EXAMPLE_PBUILDERTEST
EXAMPLE_PBUILDERTESTDIR := $(EXAMPLEDIR)/pbuilder-test
EXAMPLE_PBUILDERTEST_DATA += \
	examples/pbuilder-test/README \
	examples/pbuilder-test/002_sample.c \
	$(NULL)
EXAMPLE_PBUILDERTEST_SCRIPTS += \
	examples/pbuilder-test/000_prepinstall \
	examples/pbuilder-test/001_apprun \
	examples/pbuilder-test/002_libfile \
	examples/pbuilder-test/003_makecheck \
	examples/pbuilder-test/004_ldd \
	$(NULL)

ALLDIRS += EXAMPLE_REBUILD
EXAMPLE_REBUILDDIR := $(EXAMPLEDIR)/rebuild
EXAMPLE_REBUILD_DATA += \
	examples/rebuild/README \
	$(NULL)
EXAMPLE_REBUILD_SCRIPTS += \
	examples/rebuild/buildall \
	examples/rebuild/getlist \
	$(NULL)

ALLDIRS += EXAMPLE_WORKAROUND
EXAMPLE_WORKAROUNDDIR := $(EXAMPLEDIR)/workaround
EXAMPLE_WORKAROUND_SCRIPTS += \
	$(NULL)

ALLDIRS += PKGDATA
PKGDATA_DATA += \
	pbuilderrc \
	pbuilder-uml.conf \
	$(NULL)
CHECK_SCRIPTS += \
	pbuilderrc \
	pbuilder-uml.conf \
	$(NULL)

NOINST_MANPAGES += \
	debuild-pbuilder.1 \
	pbuilder.8 \
	pbuilderrc.5 \
	pdebuild.1 \
	$(NULL)
CHECK_MANPAGES += $(NOINST_MANPAGES)

# TODO: check subdirs etc.

CHECK_SCRIPTS += $(foreach d,$(ALLDIRS),$($(d)_SCRIPTS))

all:
	$(MAKE) -C pbuildd $@
	$(MAKE) -C Documentation $@

check: export PBUILDER_CHECKOUT := $(CURDIR)
check:
	# syntax check.
	$(foreach script,$(CHECK_SCRIPTS),bash -n $(script)$(newline))
	$(foreach mp,$(CHECK_MANPAGES),LANG=C MANWIDTH=80 man --warnings -l $(mp) >/dev/null$(newline))
	# unit tests.
	$(foreach test,$(wildcard ./test_*),$(test)$(newline))

full-check:
	# system tests that might take long.
	cd testsuite && ./run-test.sh

clean:
	rm -f *.bak *~ TAGS
	rm -rfv testsuite/testimage \
		testsuite/testbuild \
		testsuite/testbuild2 \
		testsuite/regression/work
	$(MAKE) -C pbuildd $@
	$(MAKE) -C Documentation $@

TAGS:
	etags pbuilder-* pbuilder

define install_dir_impl
$(INSTALL_DIRECTORY) $($(1)DIR)$(newline)
$(foreach file,$($(1)_DATA),$(INSTALL_FILE) $(file) $($(1)DIR)$(newline))
$(foreach script,$($(1)_SCRIPTS),$(INSTALL_EXECUTABLE) $(script) $($(1)DIR)$(newline))
endef

install:
	$(foreach d,$(ALLDIRS),$(call install_dir_impl,$(d)))
	$(INSTALL_DIRECTORY) $(DESTDIR)/var/cache/pbuilder/pbuilder-mnt
	$(INSTALL_DIRECTORY) $(DESTDIR)/var/cache/pbuilder/pbuilder-umlresult
	# install -aptitude flavour as the default satisfydepends
	ln -sf pbuilder-satisfydepends-aptitude $(PKGLIBDIR)/pbuilder-satisfydepends
	$(MAKE) -C pbuildd $@
	$(MAKE) -C Documentation $@