blob: d681118c39017c45328cbfb83cbcfedaa852d4c1 [file] [log] [blame]
Lucas De Marchi904b57d2012-01-12 11:48:21 -02001SUBDIRS = . libkmod/docs man
Lucas De Marchi646b83b2012-01-09 04:20:55 -02002
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -02003DISTCLEAN_LOCAL_HOOKS =
Lucas De Marchi85ece202011-12-02 17:53:54 -02004EXTRA_DIST =
5CLEANFILES =
Lucas De Marchiecd40ee2011-11-21 12:35:15 -02006ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
7AM_MAKEFLAGS = --no-print-directory
8
9AM_CPPFLAGS = \
10 -include $(top_builddir)/config.h \
Lucas De Marchi586fc302011-11-21 14:35:35 -020011 -I$(top_srcdir)/libkmod \
Kay Sieversa308abe2011-12-20 17:58:05 +010012 -DROOTPREFIX=\""$(rootprefix)"\" \
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020013 -DSYSCONFDIR=\""$(sysconfdir)"\" \
Jan Engelhardt7b3a74f2011-12-24 04:45:22 +010014 -DLIBEXECDIR=\""$(libexecdir)"\" \
15 ${zlib_CFLAGS}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020016
Lucas De Marchie48f3762012-03-17 15:12:44 -030017AM_CFLAGS = $(WARNINGFLAGS)
18AM_LDFLAGS = $(GCLDFLAGS)
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020019
Kay Sievers9faa7b32011-12-21 11:48:07 -020020SED_PROCESS = \
21 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
22 -e 's,@VERSION\@,$(VERSION),g' \
23 -e 's,@prefix\@,$(prefix),g' \
24 -e 's,@exec_prefix\@,$(exec_prefix),g' \
25 -e 's,@libdir\@,$(libdir),g' \
26 -e 's,@includedir\@,$(includedir),g' \
Jan Engelhardtb182f8f2011-12-24 14:58:30 +010027 -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
28 -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
Jan Engelhardt7b3a74f2011-12-24 04:45:22 +010029 -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
30 -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
Kay Sievers9faa7b32011-12-21 11:48:07 -020031 < $< > $@ || rm $@
32
33%.pc: %.pc.in Makefile
34 $(SED_PROCESS)
35
Lucas De Marchi26906fe2012-03-02 22:34:36 -030036LIBKMOD_CURRENT=3
Lucas De Marchi46684bc2012-04-19 11:21:00 -030037LIBKMOD_REVISION=2
Lucas De Marchi26906fe2012-03-02 22:34:36 -030038LIBKMOD_AGE=1
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020039
Lucas De Marchi529148e2011-12-27 12:26:51 -020040noinst_LTLIBRARIES = libkmod/libkmod-util.la
41libkmod_libkmod_util_la_SOURCES = libkmod/libkmod-hash.c \
Lucas De Marchi6670c632011-12-28 12:53:37 -020042 libkmod/libkmod-hash.h \
43 libkmod/libkmod-array.c \
Lucas De Marchi0c010fa2011-12-28 13:33:26 -020044 libkmod/libkmod-array.h \
45 libkmod/libkmod-util.c \
46 libkmod/libkmod-util.h
Lucas De Marchi529148e2011-12-27 12:26:51 -020047
Lucas De Marchi586fc302011-11-21 14:35:35 -020048include_HEADERS = libkmod/libkmod.h
49lib_LTLIBRARIES = libkmod/libkmod.la
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020050
Lucas De Marchi586fc302011-11-21 14:35:35 -020051libkmod_libkmod_la_SOURCES =\
52 libkmod/libkmod.h \
53 libkmod/libkmod-private.h \
Lucas De Marchi88e9c122011-11-23 12:23:46 -020054 libkmod/macro.h \
Lucas De Marchi6924e472011-11-22 05:38:28 -020055 libkmod/libkmod.c \
Lucas De Marchi53697972011-11-22 05:42:09 -020056 libkmod/libkmod-list.c \
Lucas De Marchi7c2ab352011-11-29 18:07:43 -020057 libkmod/libkmod-config.c \
Lucas De Marchie8847fd2011-11-30 15:23:28 -020058 libkmod/libkmod-index.c \
59 libkmod/libkmod-index.h \
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020060 libkmod/libkmod-module.c \
Gustavo Sverzut Barbieri708624a2011-12-18 01:25:06 -020061 libkmod/libkmod-file.c \
62 libkmod/libkmod-elf.c
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020063
Lucas De Marchi586fc302011-11-21 14:35:35 -020064EXTRA_DIST += libkmod/libkmod.sym
Lucas De Marchie269a842011-12-15 15:37:41 -020065EXTRA_DIST += libkmod/COPYING libkmod/README
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020066
Lucas De Marchi586fc302011-11-21 14:35:35 -020067libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
68 -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
69 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
Lucas De Marchi529148e2011-12-27 12:26:51 -020070libkmod_libkmod_la_DEPENDENCIES = libkmod/libkmod-util.la \
71 ${top_srcdir}/libkmod/libkmod.sym
72libkmod_libkmod_la_LIBADD = libkmod/libkmod-util.la \
73 ${liblzma_LIBS} ${zlib_LIBS}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020074
Lucas De Marchi39baaec2012-01-10 16:22:59 -020075noinst_LTLIBRARIES += libkmod/libkmod-private.la
76libkmod_libkmod_private_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
77libkmod_libkmod_private_la_LDFLAGS = $(AM_LDFLAGS) \
78 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
79libkmod_libkmod_private_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
80libkmod_libkmod_private_la_LIBADD = $(libkmod_libkmod_la_LIBADD)
81
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020082pkgconfigdir = $(libdir)/pkgconfig
Lucas De Marchi586fc302011-11-21 14:35:35 -020083pkgconfig_DATA = libkmod/libkmod.pc
Kay Sievers9faa7b32011-12-21 11:48:07 -020084EXTRA_DIST += libkmod/libkmod.pc.in
85CLEANFILES += libkmod/libkmod.pc
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020086
Kay Sieverse79bf832011-12-22 15:40:24 +010087install-exec-hook:
88 if test "$(libdir)" != "$(rootlibdir)"; then \
Lucas De Marchi6a4fa8d2011-12-23 01:59:31 -020089 $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
Kay Sieverse79bf832011-12-22 15:40:24 +010090 so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \
91 so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \
92 ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
93 mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
94 fi
95
96uninstall-hook:
97 rm -f $(DESTDIR)$(rootlibdir)/libkmod.so*
98
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -020099if BUILD_TOOLS
Lucas De Marchi8d750532012-01-04 08:58:19 -0200100bin_PROGRAMS = tools/kmod
101
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200102noinst_SCRIPTS = tools/insmod tools/rmmod tools/lsmod \
103 tools/modprobe tools/modinfo tools/depmod
Lucas De Marchi8900b912011-12-22 02:33:36 -0200104
Lucas De Marchiac78e102012-06-14 16:29:28 -0300105tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/lsmod.c \
106 tools/rmmod.c tools/insmod.c \
107 tools/modinfo.c tools/modprobe.c \
108 tools/depmod.c
Lucas De Marchif6cf14c2011-12-27 19:56:33 -0200109tools_kmod_LDADD = libkmod/libkmod-util.la \
110 libkmod/libkmod.la
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200111
Lucas De Marchife8b0672012-01-21 15:38:25 -0200112noinst_PROGRAMS = tools/kmod-nolib
Lucas De Marchi0b221792012-01-10 14:06:24 -0200113tools_kmod_nolib_SOURCES = $(tools_kmod_SOURCES)
Lucas De Marchi0b221792012-01-10 14:06:24 -0200114tools_kmod_nolib_LDADD = libkmod/libkmod-util.la \
115 libkmod/libkmod-private.la
116
117${noinst_SCRIPTS}: tools/kmod-nolib
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200118 $(AM_V_GEN) ($(RM) $@; \
119 $(LN_S) $(notdir $<) $@)
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -0200120endif
121
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200122# ------------------------------------------------------------------------------
123# TESTSUITE
124# ------------------------------------------------------------------------------
125
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300126ROOTFS = testsuite/rootfs
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300127ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
128CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && \
129 cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
Lucas De Marchi33202e82012-06-19 13:09:23 -0300130 touch testsuite/stamp-rootfs && \
131 find $(ROOTFS) -type d -exec chmod +w {} \; )
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300132
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300133rootfs:
134 $(CREATE_ROOTFS)
135
136$(ROOTFS): $(ROOTFS_PRISTINE)
137 $(CREATE_ROOTFS)
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300138
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200139TESTSUITE_OVERRIDE_LIBS = testsuite/uname.la testsuite/path.la \
Lucas De Marchif6ef5d62012-01-26 16:10:41 -0200140 testsuite/init_module.la \
141 testsuite/delete_module.la
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200142TESTSUITE_OVERRIDE_LIBS_LDFLAGS = avoid-version -module -shared -export-dynamic \
143 -rpath /nowhere -ldl
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200144
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200145check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200146
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200147testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
148testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200149
Lucas De Marchif6ef5d62012-01-26 16:10:41 -0200150testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200151testsuite_init_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
152testsuite_init_module_la_SOURCES = testsuite/init_module.c \
Lucas De Marchifd0d8062012-06-14 16:58:46 -0300153 testsuite/mkdir.c testsuite/mkdir.h \
Lucas De Marchid48b8a72012-01-29 16:09:59 -0200154 testsuite/stripped-module.h
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200155testsuite_init_module_la_LIBADD = libkmod/libkmod-private.la
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200156
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200157TESTSUITE_CPPFLAGS = $(AM_CPPFLAGS) \
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300158 -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/$(ROOTFS)/\" \
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200159 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300160TESTSUITE_LDADD = testsuite/libtestsuite.la libkmod/libkmod-private.la \
161 libkmod/libkmod-util.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200162
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200163check_LTLIBRARIES += testsuite/libtestsuite.la
Lucas De Marchi80f9e022012-01-24 20:59:54 -0200164testsuite_libtestsuite_la_SOURCES = testsuite/testsuite.c \
165 testsuite/testsuite.h
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300166testsuite_libtestsuite_la_DEPENDENCIES = $(ROOTFS) \
167 $(TESTSUITE_OVERRIDE_LIBS)
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200168testsuite_libtestsuite_la_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchib8e344a2012-06-06 01:03:15 -0300169testsuite_libtestsuite_la_LIBADD = -lrt
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200170
Lucas De Marchi95daea02012-01-25 20:32:48 -0200171TESTSUITE = testsuite/test-init testsuite/test-testsuite testsuite/test-loaded \
Lucas De Marchi976ea8c2012-02-08 01:40:00 -0200172 testsuite/test-modinfo testsuite/test-alias testsuite/test-new-module \
Dan McGeec88aec72012-02-22 23:56:59 -0600173 testsuite/test-modprobe testsuite/test-blacklist testsuite/test-dependencies
Lucas De Marchieebca812012-01-24 21:53:27 -0200174check_PROGRAMS = $(TESTSUITE)
175TESTS = $(TESTSUITE)
176
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300177testsuite_test_testsuite_LDADD = testsuite/libtestsuite.la libkmod/libkmod-util.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200178testsuite_test_testsuite_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600179testsuite_test_init_LDADD = $(TESTSUITE_LDADD)
180testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
181testsuite_test_loaded_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchi61e94332012-01-25 18:16:45 -0200182testsuite_test_loaded_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600183testsuite_test_modinfo_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchi95daea02012-01-25 20:32:48 -0200184testsuite_test_modinfo_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600185testsuite_test_alias_LDADD = $(TESTSUITE_LDADD)
Pedro Pedruzzi760b8962012-01-28 03:22:47 -0200186testsuite_test_alias_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600187testsuite_test_new_module_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchia9474302012-01-29 15:43:19 -0200188testsuite_test_new_module_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi976ea8c2012-02-08 01:40:00 -0200189testsuite_test_modprobe_LDADD = $(TESTSUITE_LDADD)
190testsuite_test_modprobe_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeebcca1b92012-02-22 23:56:58 -0600191testsuite_test_blacklist_LDADD = $(TESTSUITE_LDADD)
192testsuite_test_blacklist_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeec88aec72012-02-22 23:56:59 -0600193testsuite_test_dependencies_LDADD = $(TESTSUITE_LDADD)
194testsuite_test_dependencies_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchieebca812012-01-24 21:53:27 -0200195
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300196testsuite-distclean:
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300197 -$(RM) -rf $(ROOTFS)
Lucas De Marchi0de690c2012-05-24 01:31:36 -0300198 -$(RM) testsuite/stamp-rootfs
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300199
200DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
Lucas De Marchie2ee7d92012-05-23 23:04:44 -0300201EXTRA_DIST += testsuite/rootfs-pristine
Lucas De Marchi9c415962012-05-10 23:42:41 -0300202
Lucas De Marchi851ee752012-05-23 23:05:04 -0300203DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --sysconfdir=/etc
Lucas De Marchif4647b62012-01-16 00:42:28 -0200204
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200205distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
Lucas De Marchif4647b62012-01-16 00:42:28 -0200206
207# ------------------------------------------------------------------------------
208# custom release helpers
209# ------------------------------------------------------------------------------
210
211git-release:
212 head -1 NEWS | grep -q "kmod $(VERSION)"
213 git commit -a -m "kmod $(VERSION)"
214 git tag -m "kmod $(VERSION)" -s v$(VERSION)
215 git gc --prune=0
216
217kmod-$(VERSION).tar.xz:
218 make distcheck
219
220kmod-$(VERSION).tar.sign:
221 xz -d -c kmod-$(VERSION).tar.xz | gpg --armor --detach-sign --output kmod-$(VERSION).tar.sign
222
223tar: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
224
225tar-sync: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
Lucas De Marchibb05bc82012-02-24 01:58:20 -0200226 kup put kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign /pub/linux/utils/kernel/kmod/