blob: bf4f32895db75d1223cbd977cd133bbbe18fa46a [file] [log] [blame]
Colin Walters86315522012-07-30 12:27:10 -04001SUBDIRS = . libkmod/docs
2
3if BUILD_MANPAGES
4SUBDIRS += man
5endif
Lucas De Marchi646b83b2012-01-09 04:20:55 -02006
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -02007DISTCLEAN_LOCAL_HOOKS =
Lucas De Marchi85ece202011-12-02 17:53:54 -02008EXTRA_DIST =
Lucas De Marchi3a33a7a2014-03-24 08:27:19 -03009CLEANFILES = $(BUILT_FILES)
10BUILT_FILES =
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020011ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
12AM_MAKEFLAGS = --no-print-directory
13
Mike Autyfd566382014-12-05 00:49:13 +000014GCC_COLORS ?= 'yes'
15export GCC_COLORS
16
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020017AM_CPPFLAGS = \
18 -include $(top_builddir)/config.h \
Lucas De Marchi576dd432014-10-02 22:03:19 -030019 -I$(top_srcdir) \
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020020 -DSYSCONFDIR=\""$(sysconfdir)"\" \
Jan Engelhardt7b3a74f2011-12-24 04:45:22 +010021 ${zlib_CFLAGS}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020022
Lucas De Marchi84aaaed2015-01-02 16:32:03 -020023AM_CFLAGS = $(OUR_CFLAGS)
24AM_LDFLAGS = $(OUR_LDFLAGS)
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020025
Kay Sievers9faa7b32011-12-21 11:48:07 -020026SED_PROCESS = \
27 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
28 -e 's,@VERSION\@,$(VERSION),g' \
29 -e 's,@prefix\@,$(prefix),g' \
30 -e 's,@exec_prefix\@,$(exec_prefix),g' \
31 -e 's,@libdir\@,$(libdir),g' \
32 -e 's,@includedir\@,$(includedir),g' \
Jan Engelhardtb182f8f2011-12-24 14:58:30 +010033 -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
34 -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
Jan Engelhardt7b3a74f2011-12-24 04:45:22 +010035 -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
36 -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
Kay Sievers9faa7b32011-12-21 11:48:07 -020037 < $< > $@ || rm $@
38
39%.pc: %.pc.in Makefile
40 $(SED_PROCESS)
41
Lucas De Marchi40758602012-09-06 16:26:53 -030042LIBKMOD_CURRENT=4
Lucas De Marchif9e21672014-11-16 10:24:50 -020043LIBKMOD_REVISION=9
Lucas De Marchi40758602012-09-06 16:26:53 -030044LIBKMOD_AGE=2
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020045
Lucas De Marchi2c5bc212014-10-09 01:20:35 -030046noinst_LTLIBRARIES = shared/libshared.la
47shared_libshared_la_SOURCES = \
Lucas De Marchi8eded792014-10-03 00:13:49 -030048 shared/macro.h \
Lucas De Marchi74d1df62014-10-03 00:22:36 -030049 shared/missing.h \
50 shared/array.c \
51 shared/array.h \
Lucas De Marchi0db718e2014-10-03 00:29:18 -030052 shared/hash.c \
53 shared/hash.h \
Lucas De Marchib4d1f442014-10-11 13:03:21 -030054 shared/strbuf.c \
55 shared/strbuf.h \
Lucas De Marchi8eded792014-10-03 00:13:49 -030056 shared/util.c \
Lucas De Marchif4e8c162014-10-09 01:14:16 -030057 shared/util.h
Lucas De Marchi529148e2011-12-27 12:26:51 -020058
Lucas De Marchi586fc302011-11-21 14:35:35 -020059include_HEADERS = libkmod/libkmod.h
60lib_LTLIBRARIES = libkmod/libkmod.la
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020061
Lucas De Marchi8eded792014-10-03 00:13:49 -030062libkmod_libkmod_la_SOURCES = \
Lucas De Marchi586fc302011-11-21 14:35:35 -020063 libkmod/libkmod.h \
Lucas De Marchi83b855a2013-07-04 16:13:11 -030064 libkmod/libkmod-internal.h \
Lucas De Marchi6924e472011-11-22 05:38:28 -020065 libkmod/libkmod.c \
Lucas De Marchi53697972011-11-22 05:42:09 -020066 libkmod/libkmod-list.c \
Lucas De Marchi7c2ab352011-11-29 18:07:43 -020067 libkmod/libkmod-config.c \
Lucas De Marchie8847fd2011-11-30 15:23:28 -020068 libkmod/libkmod-index.c \
69 libkmod/libkmod-index.h \
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020070 libkmod/libkmod-module.c \
Gustavo Sverzut Barbieri708624a2011-12-18 01:25:06 -020071 libkmod/libkmod-file.c \
Michal Marek8fe16812013-01-16 09:52:01 +010072 libkmod/libkmod-elf.c \
73 libkmod/libkmod-signature.c
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020074
Lucas De Marchi586fc302011-11-21 14:35:35 -020075EXTRA_DIST += libkmod/libkmod.sym
Lucas De Marchi1a075592014-10-07 23:23:11 -030076EXTRA_DIST += libkmod/README \
77 libkmod/COPYING testsuite/COPYING tools/COPYING COPYING
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020078
Lucas De Marchi586fc302011-11-21 14:35:35 -020079libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
80 -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
81 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
Lucas De Marchi8eded792014-10-03 00:13:49 -030082libkmod_libkmod_la_DEPENDENCIES = \
Lucas De Marchi2c5bc212014-10-09 01:20:35 -030083 shared/libshared.la \
Lucas De Marchi8eded792014-10-03 00:13:49 -030084 ${top_srcdir}/libkmod/libkmod.sym
85libkmod_libkmod_la_LIBADD = \
Lucas De Marchi2c5bc212014-10-09 01:20:35 -030086 shared/libshared.la \
Lucas De Marchi8eded792014-10-03 00:13:49 -030087 ${liblzma_LIBS} ${zlib_LIBS}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020088
Lucas De Marchi83b855a2013-07-04 16:13:11 -030089noinst_LTLIBRARIES += libkmod/libkmod-internal.la
90libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
91libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
Lucas De Marchi39baaec2012-01-10 16:22:59 -020092 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
Lucas De Marchi83b855a2013-07-04 16:13:11 -030093libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
94libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD)
Lucas De Marchi39baaec2012-01-10 16:22:59 -020095
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020096pkgconfigdir = $(libdir)/pkgconfig
Lucas De Marchi586fc302011-11-21 14:35:35 -020097pkgconfig_DATA = libkmod/libkmod.pc
Kay Sievers9faa7b32011-12-21 11:48:07 -020098EXTRA_DIST += libkmod/libkmod.pc.in
99CLEANFILES += libkmod/libkmod.pc
Lucas De Marchiecd40ee2011-11-21 12:35:15 -0200100
Lucas De Marchi80cf2c82013-07-30 03:47:19 -0300101bashcompletiondir=@bashcompletiondir@
102dist_bashcompletion_DATA = \
103 shell-completion/bash/kmod
104
Kay Sieverse79bf832011-12-22 15:40:24 +0100105install-exec-hook:
106 if test "$(libdir)" != "$(rootlibdir)"; then \
Lucas De Marchi6a4fa8d2011-12-23 01:59:31 -0200107 $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
Kay Sieverse79bf832011-12-22 15:40:24 +0100108 so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \
109 so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \
110 ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
111 mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
112 fi
113
114uninstall-hook:
115 rm -f $(DESTDIR)$(rootlibdir)/libkmod.so*
116
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -0200117if BUILD_TOOLS
Lucas De Marchi8d750532012-01-04 08:58:19 -0200118bin_PROGRAMS = tools/kmod
119
Lucas De Marchi8eded792014-10-03 00:13:49 -0300120noinst_SCRIPTS = \
121 tools/insmod tools/rmmod tools/lsmod \
122 tools/modprobe tools/modinfo tools/depmod
Lucas De Marchi8900b912011-12-22 02:33:36 -0200123
Lucas De Marchi8eded792014-10-03 00:13:49 -0300124tools_kmod_SOURCES = \
125 tools/kmod.c tools/kmod.h tools/lsmod.c \
126 tools/rmmod.c tools/insmod.c \
127 tools/modinfo.c tools/modprobe.c \
128 tools/depmod.c tools/log.h tools/log.c \
129 tools/static-nodes.c
130tools_kmod_LDADD = \
Lucas De Marchi2c5bc212014-10-09 01:20:35 -0300131 shared/libshared.la \
Lucas De Marchi8eded792014-10-03 00:13:49 -0300132 libkmod/libkmod-internal.la
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200133
Lucas De Marchib6adccd2013-07-04 16:01:55 -0300134${noinst_SCRIPTS}: tools/kmod
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200135 $(AM_V_GEN) ($(RM) $@; \
136 $(LN_S) $(notdir $<) $@)
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -0200137endif
138
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200139# ------------------------------------------------------------------------------
Lucas De Marchi3a33a7a2014-03-24 08:27:19 -0300140# PYTHON BINDINGS
141# ------------------------------------------------------------------------------
142
143CYTHON_FLAGS_VERBOSE_ =
144CYTHON_FLAGS_VERBOSE_0 =
145CYTHON_FLAGS_VERBOSE_1 = -v
146CYTHON_FLAGS = $(CYTHON_FLAGS_VERBOSE_$(V))
147AM_V_CYTHON = $(am__v_CYTHON_$(V))
148am__v_CYTHON_ = $(am__v_CYTHON_$(AM_DEFAULT_VERBOSITY))
149am__v_CYTHON_0 = @echo " CYTHON " $@;
150
151.pyx.c:
152 $(AM_V_CYTHON)$(CYTHON) -o $@ $<
153
154%.py: %.py.in Makefile
155 $(SED_PROCESS)
156
157# Remove some warnings for generated code
158PYTHON_NOWARN = -Wno-redundant-decls -Wno-shadow -Wno-strict-aliasing
159
Lucas De Marchi8eded792014-10-03 00:13:49 -0300160CPYTHON_MODULE_CFLAGS = \
161 $(AM_CFLAGS) -DCPYTHON_COMPILING_IN_PYPY=0 \
162 $(PYTHON_NOWARN) $(PYTHON_CFLAGS) \
163 -fvisibility=default
Lucas De Marchi3a33a7a2014-03-24 08:27:19 -0300164CPYTHON_MODULE_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared
165
166if BUILD_PYTHON
Lucas De Marchi8eded792014-10-03 00:13:49 -0300167pkgpyexec_LTLIBRARIES = \
168 libkmod/python/kmod/kmod.la \
169 libkmod/python/kmod/list.la \
170 libkmod/python/kmod/module.la \
171 libkmod/python/kmod/_util.la
Lucas De Marchi3a33a7a2014-03-24 08:27:19 -0300172
173libkmod_python_kmod_kmod_la_SOURCES = libkmod/python/kmod/kmod.c
174libkmod_python_kmod_kmod_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
175libkmod_python_kmod_kmod_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
176libkmod_python_kmod_kmod_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
177
178libkmod_python_kmod_list_la_SOURCES = libkmod/python/kmod/list.c
179libkmod_python_kmod_list_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
180libkmod_python_kmod_list_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
181libkmod_python_kmod_list_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
182
183libkmod_python_kmod_module_la_SOURCES = libkmod/python/kmod/module.c
184libkmod_python_kmod_module_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
185libkmod_python_kmod_module_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
186libkmod_python_kmod_module_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
187
188libkmod_python_kmod__util_la_SOURCES = libkmod/python/kmod/_util.c
189libkmod_python_kmod__util_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
190libkmod_python_kmod__util_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
191libkmod_python_kmod__util_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
192
Lucas De Marchi8eded792014-10-03 00:13:49 -0300193BUILT_FILES += \
194 $(libkmod_python_kmod_kmod_la_SOURCES) \
195 $(libkmod_python_kmod_list_la_SOURCES) \
196 $(libkmod_python_kmod_module_la_SOURCES) \
197 $(libkmod_python_kmod__util_la_SOURCES)
Lucas De Marchi3a33a7a2014-03-24 08:27:19 -0300198
Lucas De Marchi8eded792014-10-03 00:13:49 -0300199dist_pkgpyexec_PYTHON = \
200 libkmod/python/kmod/error.py \
201 libkmod/python/kmod/__init__.py \
202 libkmod/python/kmod/version.py
Lucas De Marchi3a33a7a2014-03-24 08:27:19 -0300203
204BUILT_FILES += libkmod/python/kmod/version.py
205
206endif
207# ------------------------------------------------------------------------------
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200208# TESTSUITE
209# ------------------------------------------------------------------------------
210
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300211ROOTFS = testsuite/rootfs
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300212ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
Saul Wold518daf42013-10-09 23:49:48 -0700213CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) && \
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300214 cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
Lucas De Marchi33202e82012-06-19 13:09:23 -0300215 touch testsuite/stamp-rootfs && \
216 find $(ROOTFS) -type d -exec chmod +w {} \; )
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300217
Dave Reisner84afccb2012-09-08 11:50:56 -0400218rootfs:
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300219 $(CREATE_ROOTFS)
Dave Reisner2588e3d2012-06-28 11:16:36 -0400220.PHONY: rootfs
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300221
222$(ROOTFS): $(ROOTFS_PRISTINE)
223 $(CREATE_ROOTFS)
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300224
Lucas De Marchi8eded792014-10-03 00:13:49 -0300225TESTSUITE_OVERRIDE_LIBS = \
226 testsuite/uname.la testsuite/path.la \
227 testsuite/init_module.la \
228 testsuite/delete_module.la
229TESTSUITE_OVERRIDE_LIBS_LDFLAGS = \
230 avoid-version -module -shared -export-dynamic -rpath /nowhere -ldl
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200231
Michal Marek9324bb52014-04-04 11:30:07 +0200232check-sysconfdir:
233 $(AM_V_at)if test "$(sysconfdir)" != "/etc" -a "$(sysconfdir)" != "/etc/"; then \
234 echo "warning: Some tests will fail without --sysconfdir=/etc" >&2; \
235 fi
236.PHONY: check-sysconfdir
237
238check-am: rootfs check-sysconfdir
239
Dave Reisner2588e3d2012-06-28 11:16:36 -0400240
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200241check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200242
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200243testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
Lucas De Marchi8ff7f002015-01-07 19:14:20 -0200244testsuite_path_la_CPPFLAGS = $(AM_CPPFLAGS) \
245 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200246testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200247
Lucas De Marchif6ef5d62012-01-26 16:10:41 -0200248testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200249testsuite_init_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
250testsuite_init_module_la_SOURCES = testsuite/init_module.c \
Lucas De Marchid48b8a72012-01-29 16:09:59 -0200251 testsuite/stripped-module.h
Lucas De Marchi83b855a2013-07-04 16:13:11 -0300252testsuite_init_module_la_LIBADD = libkmod/libkmod-internal.la
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200253
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200254TESTSUITE_CPPFLAGS = $(AM_CPPFLAGS) \
Lucas De Marchi8eded792014-10-03 00:13:49 -0300255 -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/$(ROOTFS)/\" \
256 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
257TESTSUITE_LDADD = \
258 testsuite/libtestsuite.la libkmod/libkmod-internal.la \
Lucas De Marchi2c5bc212014-10-09 01:20:35 -0300259 shared/libshared.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200260
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200261check_LTLIBRARIES += testsuite/libtestsuite.la
Lucas De Marchi8eded792014-10-03 00:13:49 -0300262testsuite_libtestsuite_la_SOURCES = \
263 testsuite/testsuite.c testsuite/testsuite.h
264testsuite_libtestsuite_la_DEPENDENCIES = \
265 $(ROOTFS) $(TESTSUITE_OVERRIDE_LIBS)
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200266testsuite_libtestsuite_la_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchib8e344a2012-06-06 01:03:15 -0300267testsuite_libtestsuite_la_LIBADD = -lrt
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200268
Lucas De Marchi8eded792014-10-03 00:13:49 -0300269TESTSUITE = \
270 testsuite/test-hash \
Lucas De Marchifdafa6b2014-10-08 01:12:15 -0300271 testsuite/test-array \
Lucas De Marchi48e4d182014-10-13 18:42:01 -0300272 testsuite/test-strbuf \
Lucas De Marchi8eded792014-10-03 00:13:49 -0300273 testsuite/test-init testsuite/test-testsuite testsuite/test-loaded \
274 testsuite/test-modinfo testsuite/test-util testsuite/test-new-module \
275 testsuite/test-modprobe testsuite/test-blacklist \
276 testsuite/test-dependencies testsuite/test-depmod
Lucas De Marchib0c9fc82012-10-04 01:08:13 -0300277
Lucas De Marchieebca812012-01-24 21:53:27 -0200278check_PROGRAMS = $(TESTSUITE)
279TESTS = $(TESTSUITE)
280
Lucas De Marchi8eded792014-10-03 00:13:49 -0300281testsuite_test_testsuite_LDADD = \
Lucas De Marchi2c5bc212014-10-09 01:20:35 -0300282 testsuite/libtestsuite.la shared/libshared.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200283testsuite_test_testsuite_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi5963c362014-06-06 02:22:43 -0300284
285testsuite_test_hash_LDADD = $(TESTSUITE_LDADD)
286testsuite_test_hash_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
287
Lucas De Marchifdafa6b2014-10-08 01:12:15 -0300288testsuite_test_array_LDADD = $(TESTSUITE_LDADD)
289testsuite_test_array_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
290
Lucas De Marchi48e4d182014-10-13 18:42:01 -0300291testsuite_test_strbuf_LDADD = $(TESTSUITE_LDADD)
292testsuite_test_strbuf_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
293
Dan McGeed35e8832012-02-03 20:29:09 -0600294testsuite_test_init_LDADD = $(TESTSUITE_LDADD)
295testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
296testsuite_test_loaded_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchi61e94332012-01-25 18:16:45 -0200297testsuite_test_loaded_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600298testsuite_test_modinfo_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchi95daea02012-01-25 20:32:48 -0200299testsuite_test_modinfo_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi807c6012013-11-18 04:32:45 -0200300testsuite_test_util_LDADD = $(TESTSUITE_LDADD)
301testsuite_test_util_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600302testsuite_test_new_module_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchia9474302012-01-29 15:43:19 -0200303testsuite_test_new_module_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi976ea8c2012-02-08 01:40:00 -0200304testsuite_test_modprobe_LDADD = $(TESTSUITE_LDADD)
305testsuite_test_modprobe_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeebcca1b92012-02-22 23:56:58 -0600306testsuite_test_blacklist_LDADD = $(TESTSUITE_LDADD)
307testsuite_test_blacklist_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeec88aec72012-02-22 23:56:59 -0600308testsuite_test_dependencies_LDADD = $(TESTSUITE_LDADD)
309testsuite_test_dependencies_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchib0c9fc82012-10-04 01:08:13 -0300310testsuite_test_depmod_LDADD = $(TESTSUITE_LDADD)
311testsuite_test_depmod_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchieebca812012-01-24 21:53:27 -0200312
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300313testsuite-distclean:
Dave Reisner86bbd052012-09-08 11:43:54 -0400314 $(RM) -r $(ROOTFS)
315 $(RM) testsuite/stamp-rootfs
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300316
317DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300318EXTRA_DIST += testsuite/rootfs-pristine
Lucas De Marchi9c415962012-05-10 23:42:41 -0300319
Lucas De Marchi3a33a7a2014-03-24 08:27:19 -0300320DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-python --sysconfdir=/etc \
321 --with-zlib \
Lucas De Marchi80cf2c82013-07-30 03:47:19 -0300322 --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir)
Lucas De Marchif4647b62012-01-16 00:42:28 -0200323
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200324distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
Lucas De Marchif4647b62012-01-16 00:42:28 -0200325
Saul Wold16535ab2013-10-09 18:09:52 -0700326buildtest-TESTS:
327 $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
328
Lucas De Marchif4647b62012-01-16 00:42:28 -0200329# ------------------------------------------------------------------------------
Lucas De Marchie9b0d1b2015-01-07 19:17:15 -0200330# coverage
331# ------------------------------------------------------------------------------
332
333# .PHONY so it always rebuilds it
334.PHONY: coverage lcov-run lcov-report coverage-sync
335
336# run lcov from scratch, always
337coverage: all
338 $(MAKE) lcov-run
339 $(MAKE) lcov-report
340
341coverage_dir = coverage
342coverage_opts = --base-directory $(srcdir) --directory $(builddir) \
343 --rc 'geninfo_adjust_src_path=$(abspath $(srcdir))=>$(abspath $(builddir))'
344
345if ENABLE_COVERAGE
346# reset run coverage tests
347lcov-run:
348 @rm -rf $(coverage_dir)
349 lcov $(coverage_opts) --zerocounters
350 -$(MAKE) check
351
352# generate report based on current coverage data
353lcov-report:
354 $(MKDIR_P) $(coverage_dir)
355 lcov $(coverage_opts) --capture --no-external --ignore-errors graph \
356 | sed 's|$(abspath $(builddir))|$(abspath $(srcdir))|' > $(coverage_dir)/.lcov.info
357 lcov --remove $(coverage_dir)/.lcov.info --output-file $(coverage_dir)/.lcov-clean.info 'test-*'
358 genhtml -t "kmod test coverage" -o $(coverage_dir) $(coverage_dir)/.lcov-clean.info
359 @echo "Coverage report generated in $(abs_builddir)/$(coverage_dir)/index.html"
360
361else
362
363lcov-run lcov-report:
364 echo "Need to reconfigure with --enable-coverage"
365
366endif
367
368# ------------------------------------------------------------------------------
Lucas De Marchif4647b62012-01-16 00:42:28 -0200369# custom release helpers
370# ------------------------------------------------------------------------------
371
372git-release:
373 head -1 NEWS | grep -q "kmod $(VERSION)"
374 git commit -a -m "kmod $(VERSION)"
375 git tag -m "kmod $(VERSION)" -s v$(VERSION)
376 git gc --prune=0
377
378kmod-$(VERSION).tar.xz:
379 make distcheck
380
381kmod-$(VERSION).tar.sign:
382 xz -d -c kmod-$(VERSION).tar.xz | gpg --armor --detach-sign --output kmod-$(VERSION).tar.sign
383
384tar: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
385
386tar-sync: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
Lucas De Marchibb05bc82012-02-24 01:58:20 -0200387 kup put kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign /pub/linux/utils/kernel/kmod/