blob: ab3dd4c592139a960d7954307ec6a5b75b876bb7 [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 Marchif712ebc2011-12-22 03:39:11 -0200105tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/kmod-lsmod.c \
Lucas De Marchi769becb2011-12-22 03:50:54 -0200106 tools/kmod-rmmod.c tools/kmod-insmod.c \
Lucas De Marchif6cf14c2011-12-27 19:56:33 -0200107 tools/kmod-modinfo.c tools/kmod-modprobe.c \
108 tools/kmod-depmod.c
Lucas De Marchi6fcf69e2011-12-22 03:01:45 -0200109tools_kmod_CPPFLAGS = $(AM_CPPFLAGS) -DKMOD_BUNDLE_TOOL=1
Lucas De Marchif6cf14c2011-12-27 19:56:33 -0200110tools_kmod_CFLAGS = $(AM_CFLAGS)
111tools_kmod_LDADD = libkmod/libkmod-util.la \
112 libkmod/libkmod.la
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200113
Lucas De Marchife8b0672012-01-21 15:38:25 -0200114noinst_PROGRAMS = tools/kmod-nolib
Lucas De Marchi0b221792012-01-10 14:06:24 -0200115tools_kmod_nolib_SOURCES = $(tools_kmod_SOURCES)
116tools_kmod_nolib_CPPFLAGS = $(tools_kmod_CPPFLAGS)
117tools_kmod_nolib_CFLAGS = $(tools_kmod_CFLAGS)
118tools_kmod_nolib_LDADD = libkmod/libkmod-util.la \
119 libkmod/libkmod-private.la
120
121${noinst_SCRIPTS}: tools/kmod-nolib
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200122 $(AM_V_GEN) ($(RM) $@; \
123 $(LN_S) $(notdir $<) $@)
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -0200124endif
125
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200126# ------------------------------------------------------------------------------
127# TESTSUITE
128# ------------------------------------------------------------------------------
129
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300130testsuite/rootfs-dirty: $(top_srcdir)/testsuite/rootfs
131 $(AM_V_GEN) cp -r $< $@
132
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200133TESTSUITE_OVERRIDE_LIBS = testsuite/uname.la testsuite/path.la \
Lucas De Marchif6ef5d62012-01-26 16:10:41 -0200134 testsuite/init_module.la \
135 testsuite/delete_module.la
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200136TESTSUITE_OVERRIDE_LIBS_LDFLAGS = avoid-version -module -shared -export-dynamic \
137 -rpath /nowhere -ldl
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200138
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200139check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200140
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200141testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
142testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200143
Lucas De Marchif6ef5d62012-01-26 16:10:41 -0200144testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200145testsuite_init_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
146testsuite_init_module_la_SOURCES = testsuite/init_module.c \
Lucas De Marchid48b8a72012-01-29 16:09:59 -0200147 testsuite/stripped-module.h
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200148testsuite_init_module_la_LIBADD = libkmod/libkmod-private.la
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200149
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200150TESTSUITE_CPPFLAGS = $(AM_CPPFLAGS) \
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300151 -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/testsuite/rootfs-dirty/\" \
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200152 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
Dan McGeed35e8832012-02-03 20:29:09 -0600153TESTSUITE_LDADD = testsuite/libtestsuite.la libkmod/libkmod-private.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200154
Lucas De Marchid2c2b8b2012-01-26 12:18:23 -0200155check_LTLIBRARIES += testsuite/libtestsuite.la
Lucas De Marchi80f9e022012-01-24 20:59:54 -0200156testsuite_libtestsuite_la_SOURCES = testsuite/testsuite.c \
157 testsuite/testsuite.h
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300158testsuite_libtestsuite_la_DEPENDENCIES = testsuite/rootfs-dirty \
Dan McGeed35e8832012-02-03 20:29:09 -0600159 $(TESTSUITE_OVERRIDE_LIBS)
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200160testsuite_libtestsuite_la_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200161
Lucas De Marchi95daea02012-01-25 20:32:48 -0200162TESTSUITE = testsuite/test-init testsuite/test-testsuite testsuite/test-loaded \
Lucas De Marchi976ea8c2012-02-08 01:40:00 -0200163 testsuite/test-modinfo testsuite/test-alias testsuite/test-new-module \
164 testsuite/test-modprobe
Lucas De Marchieebca812012-01-24 21:53:27 -0200165check_PROGRAMS = $(TESTSUITE)
166TESTS = $(TESTSUITE)
167
Lucas De Marchiab253112012-01-24 23:35:18 -0200168testsuite_test_testsuite_LDADD = testsuite/libtestsuite.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200169testsuite_test_testsuite_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600170testsuite_test_init_LDADD = $(TESTSUITE_LDADD)
171testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
172testsuite_test_loaded_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchi61e94332012-01-25 18:16:45 -0200173testsuite_test_loaded_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600174testsuite_test_modinfo_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchi95daea02012-01-25 20:32:48 -0200175testsuite_test_modinfo_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600176testsuite_test_alias_LDADD = $(TESTSUITE_LDADD)
Pedro Pedruzzi760b8962012-01-28 03:22:47 -0200177testsuite_test_alias_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Dan McGeed35e8832012-02-03 20:29:09 -0600178testsuite_test_new_module_LDADD = $(TESTSUITE_LDADD)
Lucas De Marchia9474302012-01-29 15:43:19 -0200179testsuite_test_new_module_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi976ea8c2012-02-08 01:40:00 -0200180testsuite_test_modprobe_LDADD = $(TESTSUITE_LDADD)
181testsuite_test_modprobe_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchieebca812012-01-24 21:53:27 -0200182
Lucas De Marchi452c1dd2012-05-11 00:04:59 -0300183testsuite-distclean:
184 -find testsuite/rootfs-dirty -type d -exec chmod +w {} \;
185 -$(RM) -rf testsuite/rootfs-dirty
186
187DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
Lucas De Marchi9c415962012-05-10 23:42:41 -0300188EXTRA_DIST += testsuite/rootfs
189
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200190DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
Lucas De Marchif4647b62012-01-16 00:42:28 -0200191
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200192distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
Lucas De Marchif4647b62012-01-16 00:42:28 -0200193
194# ------------------------------------------------------------------------------
195# custom release helpers
196# ------------------------------------------------------------------------------
197
198git-release:
199 head -1 NEWS | grep -q "kmod $(VERSION)"
200 git commit -a -m "kmod $(VERSION)"
201 git tag -m "kmod $(VERSION)" -s v$(VERSION)
202 git gc --prune=0
203
204kmod-$(VERSION).tar.xz:
205 make distcheck
206
207kmod-$(VERSION).tar.sign:
208 xz -d -c kmod-$(VERSION).tar.xz | gpg --armor --detach-sign --output kmod-$(VERSION).tar.sign
209
210tar: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
211
212tar-sync: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
Lucas De Marchibb05bc82012-02-24 01:58:20 -0200213 kup put kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign /pub/linux/utils/kernel/kmod/