]> git.ipfire.org Git - thirdparty/kmod.git/blame - Makefile.am
testsuite: add check for kmod_load_resources
[thirdparty/kmod.git] / Makefile.am
CommitLineData
8631552d
CW
1SUBDIRS = . libkmod/docs
2
3if BUILD_MANPAGES
4SUBDIRS += man
5endif
646b83b8 6
6afc9cd6 7DISTCLEAN_LOCAL_HOOKS =
85ece204 8EXTRA_DIST =
3a33a7a5 9CLEANFILES = $(BUILT_FILES)
9cc8a20d 10DISTCLEANFILES =
3a33a7a5 11BUILT_FILES =
ecd40ee4
LDM
12ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
13AM_MAKEFLAGS = --no-print-directory
14
fd56638a
MA
15GCC_COLORS ?= 'yes'
16export GCC_COLORS
17
ecd40ee4
LDM
18AM_CPPFLAGS = \
19 -include $(top_builddir)/config.h \
576dd439 20 -I$(top_srcdir) \
ecd40ee4 21 -DSYSCONFDIR=\""$(sysconfdir)"\" \
7b3a74fc 22 ${zlib_CFLAGS}
ecd40ee4 23
84aaaedf
LDM
24AM_CFLAGS = $(OUR_CFLAGS)
25AM_LDFLAGS = $(OUR_LDFLAGS)
ecd40ee4 26
9faa7b37
KS
27SED_PROCESS = \
28 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
29 -e 's,@VERSION\@,$(VERSION),g' \
30 -e 's,@prefix\@,$(prefix),g' \
31 -e 's,@exec_prefix\@,$(exec_prefix),g' \
32 -e 's,@libdir\@,$(libdir),g' \
33 -e 's,@includedir\@,$(includedir),g' \
b182f8fb
JE
34 -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
35 -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
7b3a74fc
JE
36 -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
37 -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
8e266b9e
DR
38 -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
39 -e 's,@libcrypto_LIBS\@,${libcrypto_LIBS},g' \
9faa7b37
KS
40 < $< > $@ || rm $@
41
42%.pc: %.pc.in Makefile
43 $(SED_PROCESS)
44
42f32b8a 45LIBKMOD_CURRENT=5
819a125c 46LIBKMOD_REVISION=5
42f32b8a 47LIBKMOD_AGE=3
ecd40ee4 48
2c5bc218
LDM
49noinst_LTLIBRARIES = shared/libshared.la
50shared_libshared_la_SOURCES = \
8eded79c 51 shared/macro.h \
74d1df66
LDM
52 shared/missing.h \
53 shared/array.c \
54 shared/array.h \
0db718ed
LDM
55 shared/hash.c \
56 shared/hash.h \
780a4e97 57 shared/scratchbuf.c \
527658ad 58 shared/scratchbuf.h \
b4d1f44a
LDM
59 shared/strbuf.c \
60 shared/strbuf.h \
8eded79c 61 shared/util.c \
f4e8c162 62 shared/util.h
529148ea 63
586fc304
LDM
64include_HEADERS = libkmod/libkmod.h
65lib_LTLIBRARIES = libkmod/libkmod.la
ecd40ee4 66
8eded79c 67libkmod_libkmod_la_SOURCES = \
586fc304 68 libkmod/libkmod.h \
83b855a6 69 libkmod/libkmod-internal.h \
6924e47a 70 libkmod/libkmod.c \
60084cf1 71 libkmod/libkmod-builtin.c \
5369797d 72 libkmod/libkmod-list.c \
7c2ab358 73 libkmod/libkmod-config.c \
e8847fd2
LDM
74 libkmod/libkmod-index.c \
75 libkmod/libkmod-index.h \
3d8226ed 76 libkmod/libkmod-module.c \
708624a4 77 libkmod/libkmod-file.c \
8fe1681c
MM
78 libkmod/libkmod-elf.c \
79 libkmod/libkmod-signature.c
ecd40ee4 80
586fc304 81EXTRA_DIST += libkmod/libkmod.sym
1a07559a
LDM
82EXTRA_DIST += libkmod/README \
83 libkmod/COPYING testsuite/COPYING tools/COPYING COPYING
ecd40ee4 84
586fc304
LDM
85libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
86 -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
87 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
8eded79c 88libkmod_libkmod_la_DEPENDENCIES = \
2c5bc218 89 shared/libshared.la \
8eded79c
LDM
90 ${top_srcdir}/libkmod/libkmod.sym
91libkmod_libkmod_la_LIBADD = \
2c5bc218 92 shared/libshared.la \
8e266b9e 93 ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
ecd40ee4 94
83b855a6
LDM
95noinst_LTLIBRARIES += libkmod/libkmod-internal.la
96libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
97libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
39baaec1 98 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
83b855a6
LDM
99libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
100libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD)
39baaec1 101
ecd40ee4 102pkgconfigdir = $(libdir)/pkgconfig
586fc304 103pkgconfig_DATA = libkmod/libkmod.pc
9faa7b37
KS
104EXTRA_DIST += libkmod/libkmod.pc.in
105CLEANFILES += libkmod/libkmod.pc
ecd40ee4 106
80cf2c8f
LDM
107bashcompletiondir=@bashcompletiondir@
108dist_bashcompletion_DATA = \
109 shell-completion/bash/kmod
110
e79bf83b
KS
111install-exec-hook:
112 if test "$(libdir)" != "$(rootlibdir)"; then \
6a4fa8d8 113 $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
e79bf83b 114 so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \
90a6e798 115 so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \
e79bf83b
KS
116 ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
117 mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
118 fi
119
120uninstall-hook:
121 rm -f $(DESTDIR)$(rootlibdir)/libkmod.so*
122
72c51a9e 123if BUILD_TOOLS
8d75053e
LDM
124bin_PROGRAMS = tools/kmod
125
8eded79c
LDM
126noinst_SCRIPTS = \
127 tools/insmod tools/rmmod tools/lsmod \
128 tools/modprobe tools/modinfo tools/depmod
8900b916 129
8eded79c
LDM
130tools_kmod_SOURCES = \
131 tools/kmod.c tools/kmod.h tools/lsmod.c \
132 tools/rmmod.c tools/insmod.c \
133 tools/modinfo.c tools/modprobe.c \
134 tools/depmod.c tools/log.h tools/log.c \
135 tools/static-nodes.c
013e8550
LDM
136
137if BUILD_EXPERIMENTAL
138tools_kmod_SOURCES += \
139 tools/insert.c \
140 tools/remove.c
141endif
142
8eded79c 143tools_kmod_LDADD = \
2c5bc218 144 shared/libshared.la \
8eded79c 145 libkmod/libkmod-internal.la
00fc926c 146
b6adccd6 147${noinst_SCRIPTS}: tools/kmod
00fc926c
LDM
148 $(AM_V_GEN) ($(RM) $@; \
149 $(LN_S) $(notdir $<) $@)
72c51a9e
GSB
150endif
151
3a33a7a5
LDM
152# ------------------------------------------------------------------------------
153# PYTHON BINDINGS
154# ------------------------------------------------------------------------------
155
156CYTHON_FLAGS_VERBOSE_ =
157CYTHON_FLAGS_VERBOSE_0 =
158CYTHON_FLAGS_VERBOSE_1 = -v
159CYTHON_FLAGS = $(CYTHON_FLAGS_VERBOSE_$(V))
160AM_V_CYTHON = $(am__v_CYTHON_$(V))
161am__v_CYTHON_ = $(am__v_CYTHON_$(AM_DEFAULT_VERBOSITY))
162am__v_CYTHON_0 = @echo " CYTHON " $@;
163
164.pyx.c:
165 $(AM_V_CYTHON)$(CYTHON) -o $@ $<
166
167%.py: %.py.in Makefile
168 $(SED_PROCESS)
169
170# Remove some warnings for generated code
171PYTHON_NOWARN = -Wno-redundant-decls -Wno-shadow -Wno-strict-aliasing
172
8eded79c
LDM
173CPYTHON_MODULE_CFLAGS = \
174 $(AM_CFLAGS) -DCPYTHON_COMPILING_IN_PYPY=0 \
175 $(PYTHON_NOWARN) $(PYTHON_CFLAGS) \
176 -fvisibility=default
8aa52bf2
FF
177# Filter -Wl,--no-undefined to fix build with python 3.8
178comma = ,
179CPYTHON_MODULE_LDFLAGS = $(subst -Wl$(comma)--no-undefined,,$(AM_LDFLAGS))
180CPYTHON_MODULE_LDFLAGS += -module -avoid-version -shared
3a33a7a5
LDM
181
182if BUILD_PYTHON
8eded79c
LDM
183pkgpyexec_LTLIBRARIES = \
184 libkmod/python/kmod/kmod.la \
185 libkmod/python/kmod/list.la \
186 libkmod/python/kmod/module.la \
187 libkmod/python/kmod/_util.la
3a33a7a5
LDM
188
189libkmod_python_kmod_kmod_la_SOURCES = libkmod/python/kmod/kmod.c
190libkmod_python_kmod_kmod_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
191libkmod_python_kmod_kmod_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
192libkmod_python_kmod_kmod_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
193
194libkmod_python_kmod_list_la_SOURCES = libkmod/python/kmod/list.c
195libkmod_python_kmod_list_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
196libkmod_python_kmod_list_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
197libkmod_python_kmod_list_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
198
199libkmod_python_kmod_module_la_SOURCES = libkmod/python/kmod/module.c
200libkmod_python_kmod_module_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
201libkmod_python_kmod_module_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
202libkmod_python_kmod_module_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
203
204libkmod_python_kmod__util_la_SOURCES = libkmod/python/kmod/_util.c
205libkmod_python_kmod__util_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
206libkmod_python_kmod__util_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
207libkmod_python_kmod__util_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
208
8eded79c
LDM
209BUILT_FILES += \
210 $(libkmod_python_kmod_kmod_la_SOURCES) \
211 $(libkmod_python_kmod_list_la_SOURCES) \
212 $(libkmod_python_kmod_module_la_SOURCES) \
213 $(libkmod_python_kmod__util_la_SOURCES)
3a33a7a5 214
8eded79c
LDM
215dist_pkgpyexec_PYTHON = \
216 libkmod/python/kmod/error.py \
217 libkmod/python/kmod/__init__.py \
218 libkmod/python/kmod/version.py
3a33a7a5
LDM
219
220BUILT_FILES += libkmod/python/kmod/version.py
221
222endif
6afc9cd6
LDM
223# ------------------------------------------------------------------------------
224# TESTSUITE
225# ------------------------------------------------------------------------------
226
4002d77a
LDM
227EXTRA_DIST += testsuite/populate-modules.sh
228
229MODULE_PLAYGROUND = testsuite/module-playground
e2ee7d9b 230ROOTFS = testsuite/rootfs
0de690c9 231ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
518daf4f 232CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) && \
0de690c9 233 cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
4002d77a 234 find $(ROOTFS) -type d -exec chmod +w {} \; && \
0f079cba 235 find $(ROOTFS) -type f -name .gitignore -exec rm -f {} \; && \
4002d77a 236 $(top_srcdir)/testsuite/populate-modules.sh \
0e68c625
LDM
237 $(MODULE_PLAYGROUND) $(ROOTFS) ) && \
238 touch testsuite/stamp-rootfs
4002d77a
LDM
239
240build-module-playground:
241 $(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
242 $(RM) -rf testsuite/module-playground && \
243 cp -r $(top_srcdir)/$(MODULE_PLAYGROUND) $(top_builddir)/$(MODULE_PLAYGROUND) && \
244 find $(top_builddir)/$(MODULE_PLAYGROUND) -type d -exec chmod +w {} \; ; \
245 fi
23603f1f 246if BUILD_MODULES
4002d77a 247 $(MAKE) -C $(MODULE_PLAYGROUND)
23603f1f
LDM
248else
249 $(MAKE) -C $(MODULE_PLAYGROUND) FAKE_BUILD=1
250endif
251
4002d77a
LDM
252
253rootfs: build-module-playground
0de690c9 254 $(CREATE_ROOTFS)
4002d77a
LDM
255
256.PHONY: rootfs build-playground
0de690c9
LDM
257
258$(ROOTFS): $(ROOTFS_PRISTINE)
259 $(CREATE_ROOTFS)
452c1dde 260
8eded79c
LDM
261TESTSUITE_OVERRIDE_LIBS = \
262 testsuite/uname.la testsuite/path.la \
263 testsuite/init_module.la \
264 testsuite/delete_module.la
265TESTSUITE_OVERRIDE_LIBS_LDFLAGS = \
266 avoid-version -module -shared -export-dynamic -rpath /nowhere -ldl
68cc4493 267
9324bb52
MM
268check-sysconfdir:
269 $(AM_V_at)if test "$(sysconfdir)" != "/etc" -a "$(sysconfdir)" != "/etc/"; then \
270 echo "warning: Some tests will fail without --sysconfdir=/etc" >&2; \
271 fi
272.PHONY: check-sysconfdir
273
274check-am: rootfs check-sysconfdir
275
2588e3df 276
80f6ab5c 277EXTRA_DIST += \
fc1bc815 278 testsuite/module-playground/cache \
9a015bcd 279 testsuite/module-playground/dummy.pkcs7 \
80f6ab5c
LDM
280 testsuite/module-playground/dummy.sha1 \
281 testsuite/module-playground/dummy.sha256 \
282 testsuite/module-playground/Makefile \
283 testsuite/module-playground/Makefile.arch \
284 testsuite/module-playground/mod-fake-cciss.c \
285 testsuite/module-playground/mod-fake-hpsa.c \
286 testsuite/module-playground/mod-fake-scsi-mod.c \
287 testsuite/module-playground/mod-foo-a.c \
288 testsuite/module-playground/mod-foo-b.c \
289 testsuite/module-playground/mod-foo.c \
290 testsuite/module-playground/mod-foo-c.c \
291 testsuite/module-playground/mod-loop-a.c \
292 testsuite/module-playground/mod-loop-b.c \
293 testsuite/module-playground/mod-loop-c.c \
294 testsuite/module-playground/mod-loop-d.c \
295 testsuite/module-playground/mod-loop-e.c \
67d15343
LDM
296 testsuite/module-playground/mod-loop-f.c \
297 testsuite/module-playground/mod-loop-g.c \
9be03c52
YK
298 testsuite/module-playground/mod-loop-h.c \
299 testsuite/module-playground/mod-loop-i.c \
300 testsuite/module-playground/mod-loop-j.c \
301 testsuite/module-playground/mod-loop-k.c \
80f6ab5c
LDM
302 testsuite/module-playground/mod-loop.h \
303 testsuite/module-playground/mod-simple.c \
304 testsuite/module-playground/mod-simple-i386.ko \
305 testsuite/module-playground/mod-simple-sparc64.ko \
306 testsuite/module-playground/mod-simple-x86_64.ko \
307 testsuite/module-playground/README
4002d77a 308
d2c2b8b5 309check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
68cc4493 310
d2c2b8b5 311testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
8ff7f008
LDM
312testsuite_path_la_CPPFLAGS = $(AM_CPPFLAGS) \
313 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
d2c2b8b5 314testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
6afc9cd6 315
f6ef5d6b 316testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
d2c2b8b5
LDM
317testsuite_init_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
318testsuite_init_module_la_SOURCES = testsuite/init_module.c \
d48b8a79 319 testsuite/stripped-module.h
83b855a6 320testsuite_init_module_la_LIBADD = libkmod/libkmod-internal.la
6afc9cd6 321
6b88ef3e 322TESTSUITE_CPPFLAGS = $(AM_CPPFLAGS) \
8eded79c
LDM
323 -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/$(ROOTFS)/\" \
324 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
325TESTSUITE_LDADD = \
326 testsuite/libtestsuite.la libkmod/libkmod-internal.la \
2c5bc218 327 shared/libshared.la
6b88ef3e 328
d2c2b8b5 329check_LTLIBRARIES += testsuite/libtestsuite.la
8eded79c
LDM
330testsuite_libtestsuite_la_SOURCES = \
331 testsuite/testsuite.c testsuite/testsuite.h
332testsuite_libtestsuite_la_DEPENDENCIES = \
333 $(ROOTFS) $(TESTSUITE_OVERRIDE_LIBS)
6b88ef3e 334testsuite_libtestsuite_la_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
b8e344a6 335testsuite_libtestsuite_la_LIBADD = -lrt
646b83b8 336
8eded79c
LDM
337TESTSUITE = \
338 testsuite/test-hash \
fdafa6b6 339 testsuite/test-array \
780a4e97 340 testsuite/test-scratchbuf \
48e4d181 341 testsuite/test-strbuf \
dbf90dc3
LDM
342 testsuite/test-init \
343 testsuite/test-initstate \
344 testsuite/test-testsuite testsuite/test-loaded \
8eded79c
LDM
345 testsuite/test-modinfo testsuite/test-util testsuite/test-new-module \
346 testsuite/test-modprobe testsuite/test-blacklist \
2200a448 347 testsuite/test-dependencies testsuite/test-depmod \
013e8550
LDM
348 testsuite/test-list
349
350if BUILD_EXPERIMENTAL
351TESTSUITE += \
03761881 352 testsuite/test-tools
013e8550 353endif
b0c9fc85 354
eebca81e
LDM
355check_PROGRAMS = $(TESTSUITE)
356TESTS = $(TESTSUITE)
357
8eded79c 358testsuite_test_testsuite_LDADD = \
2c5bc218 359 testsuite/libtestsuite.la shared/libshared.la
6b88ef3e 360testsuite_test_testsuite_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
5963c36d
LDM
361
362testsuite_test_hash_LDADD = $(TESTSUITE_LDADD)
363testsuite_test_hash_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
364
fdafa6b6
LDM
365testsuite_test_array_LDADD = $(TESTSUITE_LDADD)
366testsuite_test_array_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
367
780a4e97
LDM
368testsuite_test_scratchbuf_LDADD = $(TESTSUITE_LDADD)
369testsuite_test_scratchbuf_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
370
48e4d181
LDM
371testsuite_test_strbuf_LDADD = $(TESTSUITE_LDADD)
372testsuite_test_strbuf_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
373
d35e8832
DM
374testsuite_test_init_LDADD = $(TESTSUITE_LDADD)
375testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
dbf90dc3
LDM
376testsuite_test_initstate_LDADD = $(TESTSUITE_LDADD)
377testsuite_test_initstate_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
d35e8832 378testsuite_test_loaded_LDADD = $(TESTSUITE_LDADD)
61e9433f 379testsuite_test_loaded_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
d35e8832 380testsuite_test_modinfo_LDADD = $(TESTSUITE_LDADD)
95daea07 381testsuite_test_modinfo_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
807c601d
LDM
382testsuite_test_util_LDADD = $(TESTSUITE_LDADD)
383testsuite_test_util_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
d35e8832 384testsuite_test_new_module_LDADD = $(TESTSUITE_LDADD)
a9474303 385testsuite_test_new_module_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
976ea8c3
LDM
386testsuite_test_modprobe_LDADD = $(TESTSUITE_LDADD)
387testsuite_test_modprobe_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
bcca1b95
DM
388testsuite_test_blacklist_LDADD = $(TESTSUITE_LDADD)
389testsuite_test_blacklist_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
c88aec70
DM
390testsuite_test_dependencies_LDADD = $(TESTSUITE_LDADD)
391testsuite_test_dependencies_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
b0c9fc85
LDM
392testsuite_test_depmod_LDADD = $(TESTSUITE_LDADD)
393testsuite_test_depmod_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
2200a448
CMOF
394testsuite_test_list_LDADD = $(TESTSUITE_LDADD)
395testsuite_test_list_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
013e8550
LDM
396
397if BUILD_EXPERIMENTAL
03761881
CMOF
398testsuite_test_tools_LDADD = $(TESTSUITE_LDADD)
399testsuite_test_tools_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
013e8550 400endif
eebca81e 401
452c1dde 402testsuite-distclean:
86bbd053
DR
403 $(RM) -r $(ROOTFS)
404 $(RM) testsuite/stamp-rootfs
4002d77a
LDM
405 $(MAKE) -C testsuite/module-playground/ clean
406 if test "$(top_srcdir)" != "$(top_builddir)"; then \
407 $(RM) -rf testsuite/module-playground; \
408 fi
452c1dde
LDM
409
410DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
e2ee7d9b 411EXTRA_DIST += testsuite/rootfs-pristine
9c41596e 412
3a33a7a5 413DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-python --sysconfdir=/etc \
9a015bcd 414 --with-zlib --with-openssl \
80cf2c8f 415 --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir)
f4647b63 416
6afc9cd6 417distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
f4647b63 418
16535abe
SW
419buildtest-TESTS:
420 $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
421
e9b0d1b4
LDM
422# ------------------------------------------------------------------------------
423# coverage
424# ------------------------------------------------------------------------------
425
426# .PHONY so it always rebuilds it
427.PHONY: coverage lcov-run lcov-report coverage-sync
428
429# run lcov from scratch, always
430coverage: all
431 $(MAKE) lcov-run
432 $(MAKE) lcov-report
433
434coverage_dir = coverage
435coverage_opts = --base-directory $(srcdir) --directory $(builddir) \
436 --rc 'geninfo_adjust_src_path=$(abspath $(srcdir))=>$(abspath $(builddir))'
437
438if ENABLE_COVERAGE
439# reset run coverage tests
440lcov-run:
441 @rm -rf $(coverage_dir)
442 lcov $(coverage_opts) --zerocounters
443 -$(MAKE) check
444
445# generate report based on current coverage data
446lcov-report:
447 $(MKDIR_P) $(coverage_dir)
448 lcov $(coverage_opts) --capture --no-external --ignore-errors graph \
449 | sed 's|$(abspath $(builddir))|$(abspath $(srcdir))|' > $(coverage_dir)/.lcov.info
450 lcov --remove $(coverage_dir)/.lcov.info --output-file $(coverage_dir)/.lcov-clean.info 'test-*'
451 genhtml -t "kmod test coverage" -o $(coverage_dir) $(coverage_dir)/.lcov-clean.info
452 @echo "Coverage report generated in $(abs_builddir)/$(coverage_dir)/index.html"
453
454else
455
456lcov-run lcov-report:
457 echo "Need to reconfigure with --enable-coverage"
458
459endif
460
0bcdef97
LDM
461# ------------------------------------------------------------------------------
462# coverity
463# ------------------------------------------------------------------------------
464
465kmod-coverity-%.tar.xz:
466 rm -rf $< cov-int
028d4df3 467 ./autogen.sh c --disable-python --disable-manpages
0bcdef97
LDM
468 make clean
469 cov-build --dir cov-int make -j 4
470 tar caf $@ cov-int
471
681c623e 472coverity-tar: kmod-coverity-$(shell git describe 2>/dev/null).tar.xz
0bcdef97 473
681c623e 474coverity-sync: kmod-coverity-$(shell git describe 2>/dev/null).tar.xz
0bcdef97
LDM
475 @echo "uploading coverity tarball"
476 @curl --form token=$(COVERITY_KMOD_TOKEN) \
477 --form email=lucas.de.marchi@gmail.com \
478 --form file=@$< \
479 --form version="$(shell git describe)" \
480 --form description="" \
481 https://scan.coverity.com/builds?project=kmod
482
483coverity-clean:
484 rm -rf kmod-coverity-*.tar.xz cov-int
485
f4647b63
LDM
486# ------------------------------------------------------------------------------
487# custom release helpers
488# ------------------------------------------------------------------------------
489
490git-release:
491 head -1 NEWS | grep -q "kmod $(VERSION)"
492 git commit -a -m "kmod $(VERSION)"
493 git tag -m "kmod $(VERSION)" -s v$(VERSION)
494 git gc --prune=0
495
496kmod-$(VERSION).tar.xz:
497 make distcheck
498
499kmod-$(VERSION).tar.sign:
500 xz -d -c kmod-$(VERSION).tar.xz | gpg --armor --detach-sign --output kmod-$(VERSION).tar.sign
501
502tar: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
503
504tar-sync: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
bb05bc8a 505 kup put kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign /pub/linux/utils/kernel/kmod/
cc71e0a5
LDM
506
507# ------------------------------------------------------------------------------
508# mkosi
509# ------------------------------------------------------------------------------
510
7bc6b67d
LDM
511DISTRO ?= "arch"
512
cc71e0a5 513mkosi:
8d9c7e37 514 -$(MKDIR_P) $(top_srcdir)/testsuite/mkosi/mkosi.cache
7bc6b67d 515 $(MKOSI) -C $(top_srcdir)/testsuite/mkosi --build-sources ../../ --default mkosi.${DISTRO} -fi