]> git.ipfire.org Git - thirdparty/kmod.git/blob - Makefile.am
Makefile.am: Add target to all cross-compilation of testsuite
[thirdparty/kmod.git] / Makefile.am
1 SUBDIRS = . libkmod/docs
2
3 if BUILD_MANPAGES
4 SUBDIRS += man
5 endif
6
7 DISTCLEAN_LOCAL_HOOKS =
8 EXTRA_DIST =
9 CLEANFILES =
10 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
11 AM_MAKEFLAGS = --no-print-directory
12
13 AM_CPPFLAGS = \
14 -include $(top_builddir)/config.h \
15 -I$(top_srcdir)/libkmod \
16 -DSYSCONFDIR=\""$(sysconfdir)"\" \
17 -DLIBEXECDIR=\""$(libexecdir)"\" \
18 ${zlib_CFLAGS}
19
20 AM_CFLAGS = $(WARNINGFLAGS)
21 AM_LDFLAGS = $(GCLDFLAGS)
22
23 SED_PROCESS = \
24 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
25 -e 's,@VERSION\@,$(VERSION),g' \
26 -e 's,@prefix\@,$(prefix),g' \
27 -e 's,@exec_prefix\@,$(exec_prefix),g' \
28 -e 's,@libdir\@,$(libdir),g' \
29 -e 's,@includedir\@,$(includedir),g' \
30 -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
31 -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
32 -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
33 -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
34 < $< > $@ || rm $@
35
36 %.pc: %.pc.in Makefile
37 $(SED_PROCESS)
38
39 LIBKMOD_CURRENT=4
40 LIBKMOD_REVISION=5
41 LIBKMOD_AGE=2
42
43 noinst_LTLIBRARIES = libkmod/libkmod-util.la
44 libkmod_libkmod_util_la_SOURCES = libkmod/libkmod-hash.c \
45 libkmod/libkmod-hash.h \
46 libkmod/libkmod-array.c \
47 libkmod/libkmod-array.h \
48 libkmod/libkmod-util.c \
49 libkmod/libkmod-util.h
50
51 include_HEADERS = libkmod/libkmod.h
52 lib_LTLIBRARIES = libkmod/libkmod.la
53
54 libkmod_libkmod_la_SOURCES =\
55 libkmod/libkmod.h \
56 libkmod/libkmod-internal.h \
57 libkmod/macro.h \
58 libkmod/missing.h \
59 libkmod/libkmod.c \
60 libkmod/libkmod-list.c \
61 libkmod/libkmod-config.c \
62 libkmod/libkmod-index.c \
63 libkmod/libkmod-index.h \
64 libkmod/libkmod-module.c \
65 libkmod/libkmod-file.c \
66 libkmod/libkmod-elf.c \
67 libkmod/libkmod-signature.c
68
69 EXTRA_DIST += libkmod/libkmod.sym
70 EXTRA_DIST += libkmod/README libkmod/COPYING testsuite/COPYING COPYING
71
72 libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
73 -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
74 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
75 libkmod_libkmod_la_DEPENDENCIES = libkmod/libkmod-util.la \
76 ${top_srcdir}/libkmod/libkmod.sym
77 libkmod_libkmod_la_LIBADD = libkmod/libkmod-util.la \
78 ${liblzma_LIBS} ${zlib_LIBS}
79
80 noinst_LTLIBRARIES += libkmod/libkmod-internal.la
81 libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
82 libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
83 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
84 libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
85 libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD)
86
87 pkgconfigdir = $(libdir)/pkgconfig
88 pkgconfig_DATA = libkmod/libkmod.pc
89 EXTRA_DIST += libkmod/libkmod.pc.in
90 CLEANFILES += libkmod/libkmod.pc
91
92 bashcompletiondir=@bashcompletiondir@
93 dist_bashcompletion_DATA = \
94 shell-completion/bash/kmod
95
96 install-exec-hook:
97 if test "$(libdir)" != "$(rootlibdir)"; then \
98 $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
99 so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \
100 so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \
101 ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
102 mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
103 fi
104
105 uninstall-hook:
106 rm -f $(DESTDIR)$(rootlibdir)/libkmod.so*
107
108 if BUILD_TOOLS
109 bin_PROGRAMS = tools/kmod
110
111 noinst_SCRIPTS = tools/insmod tools/rmmod tools/lsmod \
112 tools/modprobe tools/modinfo tools/depmod
113
114 tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/lsmod.c \
115 tools/rmmod.c tools/insmod.c \
116 tools/modinfo.c tools/modprobe.c \
117 tools/depmod.c tools/log.h tools/log.c \
118 tools/static-nodes.c
119 tools_kmod_LDADD = libkmod/libkmod-util.la \
120 libkmod/libkmod-internal.la
121
122 ${noinst_SCRIPTS}: tools/kmod
123 $(AM_V_GEN) ($(RM) $@; \
124 $(LN_S) $(notdir $<) $@)
125 endif
126
127 # ------------------------------------------------------------------------------
128 # TESTSUITE
129 # ------------------------------------------------------------------------------
130
131 ROOTFS = testsuite/rootfs
132 ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
133 CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && \
134 cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
135 touch testsuite/stamp-rootfs && \
136 find $(ROOTFS) -type d -exec chmod +w {} \; )
137
138 rootfs:
139 $(CREATE_ROOTFS)
140 .PHONY: rootfs
141
142 $(ROOTFS): $(ROOTFS_PRISTINE)
143 $(CREATE_ROOTFS)
144
145 TESTSUITE_OVERRIDE_LIBS = testsuite/uname.la testsuite/path.la \
146 testsuite/init_module.la \
147 testsuite/delete_module.la
148 TESTSUITE_OVERRIDE_LIBS_LDFLAGS = avoid-version -module -shared -export-dynamic \
149 -rpath /nowhere -ldl
150
151 check-am: rootfs
152
153 check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
154
155 testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
156 testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
157
158 testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
159 testsuite_init_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
160 testsuite_init_module_la_SOURCES = testsuite/init_module.c \
161 testsuite/stripped-module.h
162 testsuite_init_module_la_LIBADD = libkmod/libkmod-internal.la
163
164 TESTSUITE_CPPFLAGS = $(AM_CPPFLAGS) \
165 -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/$(ROOTFS)/\" \
166 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
167 TESTSUITE_LDADD = testsuite/libtestsuite.la libkmod/libkmod-internal.la \
168 libkmod/libkmod-util.la
169
170 check_LTLIBRARIES += testsuite/libtestsuite.la
171 testsuite_libtestsuite_la_SOURCES = testsuite/testsuite.c \
172 testsuite/testsuite.h
173 testsuite_libtestsuite_la_DEPENDENCIES = $(ROOTFS) \
174 $(TESTSUITE_OVERRIDE_LIBS)
175 testsuite_libtestsuite_la_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
176 testsuite_libtestsuite_la_LIBADD = -lrt
177
178 TESTSUITE = testsuite/test-init testsuite/test-testsuite testsuite/test-loaded \
179 testsuite/test-modinfo testsuite/test-alias testsuite/test-new-module \
180 testsuite/test-modprobe testsuite/test-blacklist \
181 testsuite/test-dependencies testsuite/test-depmod
182
183 check_PROGRAMS = $(TESTSUITE)
184 TESTS = $(TESTSUITE)
185
186 testsuite_test_testsuite_LDADD = testsuite/libtestsuite.la libkmod/libkmod-util.la
187 testsuite_test_testsuite_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
188 testsuite_test_init_LDADD = $(TESTSUITE_LDADD)
189 testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
190 testsuite_test_loaded_LDADD = $(TESTSUITE_LDADD)
191 testsuite_test_loaded_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
192 testsuite_test_modinfo_LDADD = $(TESTSUITE_LDADD)
193 testsuite_test_modinfo_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
194 testsuite_test_alias_LDADD = $(TESTSUITE_LDADD)
195 testsuite_test_alias_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
196 testsuite_test_new_module_LDADD = $(TESTSUITE_LDADD)
197 testsuite_test_new_module_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
198 testsuite_test_modprobe_LDADD = $(TESTSUITE_LDADD)
199 testsuite_test_modprobe_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
200 testsuite_test_blacklist_LDADD = $(TESTSUITE_LDADD)
201 testsuite_test_blacklist_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
202 testsuite_test_dependencies_LDADD = $(TESTSUITE_LDADD)
203 testsuite_test_dependencies_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
204 testsuite_test_depmod_LDADD = $(TESTSUITE_LDADD)
205 testsuite_test_depmod_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
206
207 testsuite-distclean:
208 $(RM) -r $(ROOTFS)
209 $(RM) testsuite/stamp-rootfs
210
211 DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
212 EXTRA_DIST += testsuite/rootfs-pristine
213
214 DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --sysconfdir=/etc --with-zlib \
215 --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir)
216
217 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
218
219 buildtest-TESTS:
220 $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
221
222 # ------------------------------------------------------------------------------
223 # custom release helpers
224 # ------------------------------------------------------------------------------
225
226 git-release:
227 head -1 NEWS | grep -q "kmod $(VERSION)"
228 git commit -a -m "kmod $(VERSION)"
229 git tag -m "kmod $(VERSION)" -s v$(VERSION)
230 git gc --prune=0
231
232 kmod-$(VERSION).tar.xz:
233 make distcheck
234
235 kmod-$(VERSION).tar.sign:
236 xz -d -c kmod-$(VERSION).tar.xz | gpg --armor --detach-sign --output kmod-$(VERSION).tar.sign
237
238 tar: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
239
240 tar-sync: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
241 kup put kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign /pub/linux/utils/kernel/kmod/