blob: 0ccad6231e27f7c708a8eef67ab8af272cd4021b [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
17AM_CFLAGS = \
18 -fvisibility=hidden \
19 -ffunction-sections \
20 -fdata-sections
21
22AM_LDFLAGS = \
23 -Wl,--gc-sections \
24 -Wl,--as-needed
25
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 Marchib53b7e32012-01-16 16:53:04 -020042LIBKMOD_CURRENT=4
Lucas De Marchi586fc302011-11-21 14:35:35 -020043LIBKMOD_REVISION=0
Lucas De Marchib53b7e32012-01-16 16:53:04 -020044LIBKMOD_AGE=3
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020045
Lucas De Marchi529148e2011-12-27 12:26:51 -020046noinst_LTLIBRARIES = libkmod/libkmod-util.la
47libkmod_libkmod_util_la_SOURCES = libkmod/libkmod-hash.c \
Lucas De Marchi6670c632011-12-28 12:53:37 -020048 libkmod/libkmod-hash.h \
49 libkmod/libkmod-array.c \
Lucas De Marchi0c010fa2011-12-28 13:33:26 -020050 libkmod/libkmod-array.h \
51 libkmod/libkmod-util.c \
52 libkmod/libkmod-util.h
Lucas De Marchi529148e2011-12-27 12:26:51 -020053
Lucas De Marchi586fc302011-11-21 14:35:35 -020054include_HEADERS = libkmod/libkmod.h
55lib_LTLIBRARIES = libkmod/libkmod.la
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020056
Lucas De Marchi586fc302011-11-21 14:35:35 -020057libkmod_libkmod_la_SOURCES =\
58 libkmod/libkmod.h \
59 libkmod/libkmod-private.h \
Lucas De Marchi88e9c122011-11-23 12:23:46 -020060 libkmod/macro.h \
Lucas De Marchi6924e472011-11-22 05:38:28 -020061 libkmod/libkmod.c \
Lucas De Marchi53697972011-11-22 05:42:09 -020062 libkmod/libkmod-list.c \
Lucas De Marchi7c2ab352011-11-29 18:07:43 -020063 libkmod/libkmod-config.c \
Lucas De Marchie8847fd2011-11-30 15:23:28 -020064 libkmod/libkmod-index.c \
65 libkmod/libkmod-index.h \
Gustavo Sverzut Barbieri3d8226e2011-12-16 16:08:53 -020066 libkmod/libkmod-module.c \
Gustavo Sverzut Barbieri708624a2011-12-18 01:25:06 -020067 libkmod/libkmod-file.c \
68 libkmod/libkmod-elf.c
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020069
Lucas De Marchi586fc302011-11-21 14:35:35 -020070EXTRA_DIST += libkmod/libkmod.sym
Lucas De Marchie269a842011-12-15 15:37:41 -020071EXTRA_DIST += libkmod/COPYING libkmod/README
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020072
Lucas De Marchi586fc302011-11-21 14:35:35 -020073libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
74 -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
75 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
Lucas De Marchi529148e2011-12-27 12:26:51 -020076libkmod_libkmod_la_DEPENDENCIES = libkmod/libkmod-util.la \
77 ${top_srcdir}/libkmod/libkmod.sym
78libkmod_libkmod_la_LIBADD = libkmod/libkmod-util.la \
79 ${liblzma_LIBS} ${zlib_LIBS}
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020080
Lucas De Marchi39baaec2012-01-10 16:22:59 -020081noinst_LTLIBRARIES += libkmod/libkmod-private.la
82libkmod_libkmod_private_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
83libkmod_libkmod_private_la_LDFLAGS = $(AM_LDFLAGS) \
84 -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
85libkmod_libkmod_private_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
86libkmod_libkmod_private_la_LIBADD = $(libkmod_libkmod_la_LIBADD)
87
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020088pkgconfigdir = $(libdir)/pkgconfig
Lucas De Marchi586fc302011-11-21 14:35:35 -020089pkgconfig_DATA = libkmod/libkmod.pc
Kay Sievers9faa7b32011-12-21 11:48:07 -020090EXTRA_DIST += libkmod/libkmod.pc.in
91CLEANFILES += libkmod/libkmod.pc
Lucas De Marchiecd40ee2011-11-21 12:35:15 -020092
Kay Sieverse79bf832011-12-22 15:40:24 +010093install-exec-hook:
94 if test "$(libdir)" != "$(rootlibdir)"; then \
Lucas De Marchi6a4fa8d2011-12-23 01:59:31 -020095 $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
Kay Sieverse79bf832011-12-22 15:40:24 +010096 so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \
97 so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \
98 ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
99 mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
100 fi
101
102uninstall-hook:
103 rm -f $(DESTDIR)$(rootlibdir)/libkmod.so*
104
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -0200105if BUILD_TOOLS
Lucas De Marchi8d750532012-01-04 08:58:19 -0200106bin_PROGRAMS = tools/kmod
107
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200108noinst_SCRIPTS = tools/insmod tools/rmmod tools/lsmod \
109 tools/modprobe tools/modinfo tools/depmod
Lucas De Marchi8900b912011-12-22 02:33:36 -0200110
Lucas De Marchif712ebc2011-12-22 03:39:11 -0200111tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/kmod-lsmod.c \
Lucas De Marchi769becb2011-12-22 03:50:54 -0200112 tools/kmod-rmmod.c tools/kmod-insmod.c \
Lucas De Marchif6cf14c2011-12-27 19:56:33 -0200113 tools/kmod-modinfo.c tools/kmod-modprobe.c \
114 tools/kmod-depmod.c
Lucas De Marchi6fcf69e2011-12-22 03:01:45 -0200115tools_kmod_CPPFLAGS = $(AM_CPPFLAGS) -DKMOD_BUNDLE_TOOL=1
Lucas De Marchif6cf14c2011-12-27 19:56:33 -0200116tools_kmod_CFLAGS = $(AM_CFLAGS)
117tools_kmod_LDADD = libkmod/libkmod-util.la \
118 libkmod/libkmod.la
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200119
Lucas De Marchife8b0672012-01-21 15:38:25 -0200120noinst_PROGRAMS = tools/kmod-nolib
Lucas De Marchi0b221792012-01-10 14:06:24 -0200121tools_kmod_nolib_SOURCES = $(tools_kmod_SOURCES)
122tools_kmod_nolib_CPPFLAGS = $(tools_kmod_CPPFLAGS)
123tools_kmod_nolib_CFLAGS = $(tools_kmod_CFLAGS)
124tools_kmod_nolib_LDADD = libkmod/libkmod-util.la \
125 libkmod/libkmod-private.la
126
127${noinst_SCRIPTS}: tools/kmod-nolib
Lucas De Marchi00fc9262012-01-10 11:15:19 -0200128 $(AM_V_GEN) ($(RM) $@; \
129 $(LN_S) $(notdir $<) $@)
Gustavo Sverzut Barbieri72c51a92011-12-10 22:19:41 -0200130endif
131
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200132# ------------------------------------------------------------------------------
133# TESTSUITE
134# ------------------------------------------------------------------------------
135
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200136# libtool will not create a shared library that is not installed. Workaround
137# this by creating it by ourselves
138CREATE_SHARED_OVERRIDE_LIB = \
139 $(AM_V_CCLD)gcc -fPIC $(AM_CPPFLAGS) $(AM_CFLAGS) -shared $^ \
140 -o $@ $(AM_LDFLAGS) -ldl
141
142testsuite/uname.so: testsuite/uname.c
143 $(CREATE_SHARED_OVERRIDE_LIB)
144
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200145testsuite/path.so: testsuite/path.c
146 $(CREATE_SHARED_OVERRIDE_LIB)
147
Lucas De Marchi53646fc2012-01-26 02:09:28 -0200148testsuite/init_module.so: testsuite/init_module.c $(abs_top_builddir)/libkmod/.libs/libkmod-private.a
149 $(CREATE_SHARED_OVERRIDE_LIB)
150
151EXTRA_DIST += testsuite/uname.c testsuite/path.c testsuite/init_module.c
152CLEANFILES += testsuite/uname.so testsuite/path.so testsuite/init_module.so
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200153
154testsuite/rootfs:
155 $(AM_V_GEN) tar -C testsuite/ \
156 -xJf $(top_srcdir)/testsuite/rootfs.tar.xz
157
158testsuite-distclean:
159 -rm -rf testsuite/rootfs
160
161DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
162EXTRA_DIST += testsuite/rootfs.tar.xz
Lucas De Marchi68cc4492012-01-24 22:04:46 -0200163
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200164TESTSUITE_CPPFLAGS = $(AM_CPPFLAGS) \
165 -DTESTSUITE_ROOTFS=\"$(abs_top_builddir)/testsuite/rootfs/\" \
166 -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
167
Lucas De Marchi80f9e022012-01-24 20:59:54 -0200168check_LTLIBRARIES = testsuite/libtestsuite.la
169testsuite_libtestsuite_la_SOURCES = testsuite/testsuite.c \
170 testsuite/testsuite.h
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200171testsuite_libtestsuite_la_DEPENDENCIES = testsuite/uname.so \
172 testsuite/path.so \
Lucas De Marchi53646fc2012-01-26 02:09:28 -0200173 testsuite/init_module.so \
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200174 testsuite/rootfs
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200175testsuite_libtestsuite_la_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200176
Lucas De Marchi95daea02012-01-25 20:32:48 -0200177TESTSUITE = testsuite/test-init testsuite/test-testsuite testsuite/test-loaded \
178 testsuite/test-modinfo
Lucas De Marchieebca812012-01-24 21:53:27 -0200179check_PROGRAMS = $(TESTSUITE)
180TESTS = $(TESTSUITE)
181
182testsuite_test_init_LDADD = testsuite/libtestsuite.la libkmod/libkmod-private.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200183testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchiab253112012-01-24 23:35:18 -0200184testsuite_test_testsuite_LDADD = testsuite/libtestsuite.la
Lucas De Marchi6b88ef32012-01-25 15:13:45 -0200185testsuite_test_testsuite_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi61e94332012-01-25 18:16:45 -0200186testsuite_test_loaded_LDADD = testsuite/libtestsuite.la libkmod/libkmod-private.la
187testsuite_test_loaded_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi95daea02012-01-25 20:32:48 -0200188testsuite_test_modinfo_LDADD = testsuite/libtestsuite.la
189testsuite_test_modinfo_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
Lucas De Marchi61e94332012-01-25 18:16:45 -0200190
Lucas De Marchieebca812012-01-24 21:53:27 -0200191
Lucas De Marchi646b83b2012-01-09 04:20:55 -0200192DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
Lucas De Marchif4647b62012-01-16 00:42:28 -0200193
Lucas De Marchi6afc9cd2012-01-25 02:44:45 -0200194distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
Lucas De Marchif4647b62012-01-16 00:42:28 -0200195
196# ------------------------------------------------------------------------------
197# custom release helpers
198# ------------------------------------------------------------------------------
199
200git-release:
201 head -1 NEWS | grep -q "kmod $(VERSION)"
202 git commit -a -m "kmod $(VERSION)"
203 git tag -m "kmod $(VERSION)" -s v$(VERSION)
204 git gc --prune=0
205
206kmod-$(VERSION).tar.xz:
207 make distcheck
208
209kmod-$(VERSION).tar.sign:
210 xz -d -c kmod-$(VERSION).tar.xz | gpg --armor --detach-sign --output kmod-$(VERSION).tar.sign
211
212tar: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
213
214tar-sync: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
215 scp $^ packages.profusion.mobi:/var/www/packages/kmod/