Makefile 4.68 KB
Newer Older
1 2 3 4
INSTALL = install
INSTALL_DIRECTORY = $(INSTALL) -d -m 0755
INSTALL_FILE = $(INSTALL) -m 0644
INSTALL_EXECUTABLE = $(INSTALL) -m 0755
5

6
# semi-standard dirs
7 8 9 10 11 12 13
DESTDIR :=
SYSCONFDIR := $(DESTDIR)/etc
BINDIR := $(DESTDIR)/usr/bin
PKGLIBDIR := $(DESTDIR)/usr/lib/pbuilder
SBINDIR := $(DESTDIR)/usr/sbin
PKGDATADIR := $(DESTDIR)/usr/share/pbuilder

14 15 16 17 18 19 20
define newline


endef

NULL :=

21
ALLDIRS += BASHCOMPLETION
22
BASHCOMPLETIONDIR := $(PKGDATADIR)/../bash-completion/completions/
23 24 25
BASHCOMPLETION_DATA += \
	bash_completion.d/pbuilder \
	$(NULL)
26
CHECK_SCRIPTS += bash_completion.d/pbuilder
27

28 29
ALLDIRS += PBUILDERCONF
PBUILDERCONFDIR := $(SYSCONFDIR)/pbuilder
30 31 32
PBUILDERCONF_DATA += \
	$(NULL)

33
ALLDIRS += BIN
34 35 36 37 38
BIN_SCRIPTS += \
	debuild-pbuilder \
	pdebuild \
	$(NULL)

39
ALLDIRS += PKGLIB
40
PKGLIB_SCRIPTS += \
41
	pbuilder-apt-config \
42
	pbuilder-buildpackage \
43 44 45 46 47 48
	pbuilder-buildpackage-funcs \
	pbuilder-checkparams \
	pbuilder-createbuildenv \
	pbuilder-loadconfig \
	pbuilder-modules \
	pbuilder-runhooks \
49
	pbuilder-satisfydepends-apt \
50
	pbuilder-satisfydepends-aptitude \
51 52
	pbuilder-satisfydepends-checkparams \
	pbuilder-satisfydepends-classic \
53
	pbuilder-satisfydepends-experimental \
54 55
	pbuilder-satisfydepends-funcs \
	pbuilder-satisfydepends-gdebi \
Mattia Rizzolo's avatar
Mattia Rizzolo committed
56
	pbuilder-unshare-wrapper \
57
	pbuilder-updatebuildenv \
58
	pdebuild-checkparams \
59
	pdebuild-internal \
60 61
	$(NULL)

62
ALLDIRS += SBIN
63 64 65 66
SBIN_SCRIPTS += \
	pbuilder \
	$(NULL)

67 68
ALLDIRS += EXAMPLE
EXAMPLEDIR := $(DESTDIR)/usr/share/doc/pbuilder/examples
69 70 71
EXAMPLE_DATA += \
	pbuilderrc \
	$(NULL)
72
CHECK_SCRIPTS += pbuilderrc
73 74 75 76 77 78 79 80
EXAMPLE_SCRIPTS += \
	examples/B90lintian \
	examples/B91dpkg-i \
	examples/B92test-pkg \
	examples/C10shell \
	examples/C11screen \
	examples/D10tmp \
	examples/D20addnonfree \
Junichi Uekawa's avatar
Junichi Uekawa committed
81
	examples/D65various-compiler-support \
82 83 84 85 86
	examples/D80no-man-db-rebuild \
	examples/D90chrootmemo \
	examples/F90chrootmemo \
	examples/B90list-missing \
	examples/B91debc \
87
	examples/B20autopkgtest \
88 89 90 91 92
	examples/execute_installtest.sh \
	examples/execute_paramtest.sh \
	examples/pbuilder-distribution.sh \
	$(NULL)

93 94
ALLDIRS += EXAMPLE_LVMPBUILDER
EXAMPLE_LVMPBUILDERDIR := $(EXAMPLEDIR)/lvmpbuilder
95 96 97 98 99 100 101 102
EXAMPLE_LVMPBUILDER_DATA += \
	examples/lvmpbuilder/README \
	examples/lvmpbuilder/STRATEGY \
	$(NULL)
EXAMPLE_LVMPBUILDER_SCRIPTS += \
	examples/lvmpbuilder/lvmbuilder \
	$(NULL)

103 104
ALLDIRS += EXAMPLE_LVMPBUILDER_LIB
EXAMPLE_LVMPBUILDER_LIBDIR := $(EXAMPLE_LVMPBUILDERDIR)/lib
105
EXAMPLE_LVMPBUILDER_LIB_SCRIPTS += \
106 107 108 109
	examples/lvmpbuilder/lib/lvmbuilder-checkparams \
	examples/lvmpbuilder/lib/lvmbuilder-modules \
	examples/lvmpbuilder/lib/lvmbuilder-unimplemented \
	$(NULL)
110

111 112
ALLDIRS += EXAMPLE_PBUILDERTEST
EXAMPLE_PBUILDERTESTDIR := $(EXAMPLEDIR)/pbuilder-test
113 114 115 116 117 118 119 120 121 122 123 124
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)

125 126
ALLDIRS += EXAMPLE_REBUILD
EXAMPLE_REBUILDDIR := $(EXAMPLEDIR)/rebuild
127 128 129 130 131 132 133 134
EXAMPLE_REBUILD_DATA += \
	examples/rebuild/README \
	$(NULL)
EXAMPLE_REBUILD_SCRIPTS += \
	examples/rebuild/buildall \
	examples/rebuild/getlist \
	$(NULL)

135
ALLDIRS += PKGDATA
136 137 138
PKGDATA_DATA += \
	pbuilderrc \
	$(NULL)
139 140 141
CHECK_SCRIPTS += \
	pbuilderrc \
	$(NULL)
142

Loïc Minier's avatar
Loïc Minier committed
143 144 145 146 147 148 149
NOINST_MANPAGES += \
	debuild-pbuilder.1 \
	pbuilder.8 \
	pbuilderrc.5 \
	pdebuild.1 \
	$(NULL)
CHECK_MANPAGES += $(NOINST_MANPAGES)
150

151
# TODO: check subdirs etc.
152

153
CHECK_SCRIPTS += $(foreach d,$(ALLDIRS),$($(d)_SCRIPTS))
154 155

all:
Loïc Minier's avatar
Loïc Minier committed
156 157
	$(MAKE) -C pbuildd $@
	$(MAKE) -C Documentation $@
Loïc Minier's avatar
Loïc Minier committed
158

159
check: export PBUILDER_CHECKOUT := $(CURDIR)
160
check:
Junichi Uekawa's avatar
Junichi Uekawa committed
161
	# syntax check.
162
	$(foreach script,$(CHECK_SCRIPTS),bash -n $(script)$(newline))
163
	$(foreach mp,$(CHECK_MANPAGES),LANG=C MANWIDTH=80 man --warnings -l $(mp) >/dev/null$(newline))
Junichi Uekawa's avatar
Junichi Uekawa committed
164
	# unit tests.
165
	$(foreach test,$(wildcard ./t/test_*),$(test)$(newline))
166

Loïc Minier's avatar
Loïc Minier committed
167
full-check:
Junichi Uekawa's avatar
Junichi Uekawa committed
168
	# system tests that might take long.
Loïc Minier's avatar
Loïc Minier committed
169
	cd testsuite && ./run-test.sh
170

dancer's avatar
dancer committed
171
clean:
172
	rm -f *.bak *~ TAGS
173 174 175 176
	rm -rfv testsuite/testimage \
		testsuite/testbuild \
		testsuite/testbuild2 \
		testsuite/regression/work
Loïc Minier's avatar
Loïc Minier committed
177 178
	$(MAKE) -C pbuildd $@
	$(MAKE) -C Documentation $@
179 180

TAGS:
dancer's avatar
dancer committed
181
	etags pbuilder-* pbuilder
dancer's avatar
dancer committed
182

183 184 185 186 187 188
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

dancer's avatar
dancer committed
189
install:
190
	$(foreach d,$(ALLDIRS),$(call install_dir_impl,$(d)))
191
	$(INSTALL_DIRECTORY) $(DESTDIR)/var/cache/pbuilder/pbuilder-mnt
192
	# install -aptitude flavour as the default satisfydepends
193
	ln -sf pbuilder-satisfydepends-aptitude $(PKGLIBDIR)/pbuilder-satisfydepends
194 195
	$(MAKE) -C pbuildd $@
	$(MAKE) -C Documentation $@
dancer's avatar
dancer committed
196