release: bump release to 3.15
[module-init-tools.git] / Makefile.am
blob3e699e509c710abf33dd7c69bf8eae58197f4232
1 ACLOCAL_AMFLAGS = -I m4
3 insmod_SOURCES = insmod.c testing.h
4 lsmod_SOURCES = lsmod.c testing.h
5 modprobe_SOURCES = modprobe.c zlibsupport.c zlibsupport.h testing.h
6 rmmod_SOURCES = rmmod.c testing.h
7 depmod_SOURCES = depmod.c zlibsupport.c tables.c \
8         zlibsupport.h tables.h testing.h
9 modinfo_SOURCES = modinfo.c zlibsupport.c zlibsupport.h testing.h
10 modindex_SOURCES = modindex.c zlibsupport.c zlibsupport.h testing.h
12 insmod_static_SOURCES = insmod.c
13 insmod_static_LDFLAGS = -static
14 # We don't want the $(zlib_flags) here: that makes a dynamic executable
15 insmod_static_LDADD = libmodtools.a
17 EXTRA_insmod_SOURCES =
18 EXTRA_lsmod_SOURCES =
19 EXTRA_modprobe_SOURCES = 
20 EXTRA_rmmod_SOURCES =
21 EXTRA_insmod_static_SOURCES =
22 EXTRA_depmod_SOURCES =
23 EXTRA_modinfo_SOURCES =
25 libmodtools_a_SOURCES = util.c logging.c index.c config_filter.c elfops.c \
26         util.h depmod.h logging.h index.h list.h config_filter.h elfops.h
27 libmodtools_a_CFLAGS = -ffunction-sections
29 EXTRA_libmodtools_a_SOURCES = elfops_core.c
31 insmod_LDADD = $(LDADD) libmodtools.a
32 lsmod_LDADD = $(LDADD) libmodtools.a
33 modprobe_LDADD = $(LDADD) libmodtools.a
34 rmmod_LDADD = $(LDADD) libmodtools.a
35 depmod_LDADD = $(LDADD) libmodtools.a
36 modinfo_LDADD = $(LDADD) libmodtools.a
37 modindex_LDADD = $(LDADD) libmodtools.a
39 MAN5 = depmod.conf.5 depmod.d.5 modprobe.conf.5 modprobe.d.5 \
40         modules.dep.5 modules.dep.bin.5
41 MAN8 = depmod.8 insmod.8 lsmod.8 rmmod.8 modprobe.8 modinfo.8
42 SGML = $(addprefix doc/,  $(MAN5:%.5=%.sgml) $(MAN8:%.8=%.sgml))
43 dist_man_MANS = $(MAN5) $(MAN8)
44 # If they haven't overridden mandir, fix it (never /man!)
45 mandir =$(shell if [ @mandir@ = $(prefix)/man ]; then if [ $(prefix) = / ]; then echo /usr/share/man; else echo $(prefix)/share/man; fi; else echo @mandir@; fi)
47 TESTSUITE := $(shell test -e @srcdir@/tests && find @srcdir@/tests -type f ! -name '*~')
49 EXTRA_DIST = generate-modprobe.conf FAQ CODING stress_modules.sh install-with-care $(SGML) $(man_MANS) $(TESTSUITE)
51 sbin_PROGRAMS = insmod modprobe rmmod depmod modinfo
52 if BUILD_STATIC_UTILS
53 sbin_PROGRAMS += insmod.static
54 endif
55 bin_PROGRAMS = lsmod
56 noinst_PROGRAMS=modindex
57 noinst_LIBRARIES = libmodtools.a
58 INSTALL = $(SHELL) $(top_srcdir)/install-with-care
60 DIST_DIR := /data/work/releases/module-init-tools/
62 GIT_RELEASE_REMOTE := origin
63 GIT_RELEASE_BRANCH := master
64 SCP_RELEASE_URL := "jcm@master.kernel.org:/pub/linux/utils/kernel/module-init-tools/"
67 MAINTAINERCLEANFILES := $(man_MANS)
69 # docbook2man writes file itself, doesn't do stdout.
70 %.8: doc/%.sgml
71         if [ "$(DOCBOOKTOMAN)" = "docbook2man" ]; then                     \
72             $(DOCBOOKTOMAN) $< > /dev/null 2>&1;                           \
73         else                                                               \
74             $(DOCBOOKTOMAN) $< 2>&1 > $@ | sed 's/^[^:]*://';              \
75         fi
77 %.5: doc/%.sgml
78         if [ -h $< ]; then                                                 \
79             ln -s $$(basename $$(readlink $<) .sgml).5 $@;                 \
80         elif [ "$(DOCBOOKTOMAN)" = "docbook2man" ]; then                   \
81             $(DOCBOOKTOMAN) $< > /dev/null 2>&1;                           \
82         else                                                               \
83             $(DOCBOOKTOMAN) $< 2>&1 > $@ | sed 's/^[^:]*://';              \
84         fi
86 # docbook2man creates extra crap files which need cleaning.
87 distclean-local: killbuildmanpages
89 killbuildmanpages:
90         rm -f doc/*.tmp manpage.refs manpage.links
92 tarball: $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz
94 #$(DIST_DIR)/module-init-tools-$(VERSION).tar.gz: dist
95 #       mv module-init-tools-$(VERSION).tar.gz $@
97 # git based version
98 $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz:
99         cd $$(git rev-parse --show-toplevel) && git archive --format=tar --prefix=module-init-tools-$(VERSION)/ v$(VERSION) | (cd $(DIST_DIR) && tar xv)
100         cd $(DIST_DIR)/module-init-tools-$(VERSION) && aclocal -I m4 && automake --add-missing --copy && autoconf
101         cd $(DIST_DIR) && tar cvfz module-init-tools-$(VERSION).tar.gz module-init-tools-$(VERSION)
103 $(DIST_DIR)/.pushed/module-init-tools-$(VERSION).tar.gz:
104         mkdir -p $(DIST_DIR)/.pushed
105         ln -s $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz $(DIST_DIR)/.pushed/module-init-tools-$(VERSION).tar.gz
107 gpg-tarball: $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz.sign
109 $(DIST_DIR)/.pushed/module-init-tools-$(VERSION).tar.gz.sign:
110         mkdir -p $(DIST_DIR)/.pushed
111         ln -s $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz.sign $(DIST_DIR)/.pushed/module-init-tools-$(VERSION).tar.gz.sign
113 $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz.sign: tarball
114         cd $(DIST_DIR) && gpg -a -b -s -o module-init-tools-$(VERSION).tar.gz.sign module-init-tools-$(VERSION).tar.gz
116 srpm: $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz
117         ln -sf $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz /usr/src/rpm/SOURCES/
118         set -e; RELEASE=`grep '^Release:' /usr/src/rpm/SPECS/modutils.spec | awk '{ print $$2 }'`; \
119         if [ "`grep '%define mit_ver' /usr/src/rpm/SPECS/modutils.spec | awk '{print $$3}'`" != $(VERSION) ]; then \
120                 sed -e "s/Release: $$RELEASE/Release: `expr $$RELEASE + 1`/" -e 's/%define mit_ver.*/%define mit_ver $(VERSION)/' < /usr/src/rpm/SPECS/modutils.spec > /tmp/modutils.spec; \
121                 rpm -ba /tmp/modutils.spec; \
122                 mv /usr/src/rpm/SRPMS/modutils-2.4.21-`expr $$RELEASE + 1`.src.rpm $(DIST_DIR); \
123                 mv /tmp/modutils.spec /usr/src/rpm/SPECS/modutils.spec; \
124         else \
125                 rpm -ba /usr/src/rpm/SPECS/modutils.spec; \
126                 mv /usr/src/rpm/SRPMS/modutils-2.4.21-$$RELEASE.src.rpm $(DIST_DIR); \
127         fi
129 # No testsuite?
130 tests/runtests:
131         mkdir tests
132         echo '#! /bin/sh' > $@
133         echo '# Install the testsuite over this dir. ' >> $@
134         chmod a+x $@
136 $(DIST_DIR)/module-init-tools-testsuite-$(VERSION).tar.gz:
137         ln -sfn `pwd` /tmp/module-init-tools-$(VERSION) 
138         cd /tmp && tar --exclude '*~' -c -z -f $@ module-init-tools-$(VERSION)/tests
139         rm /tmp/module-init-tools-$(VERSION)
141 old-release: check clean tarball
143 # git based release
144 git-clean:
145         git gc
146         git prune
148 git-tag:
149         if [ "xv$(VERSION)" != x$$(git tag -l v$(VERSION)) ]; \
150         then \
151                 git tag v$(VERSION); \
152         fi
154 git-push:
155         git push $(GIT_RELEASE_REMOTE) $(GIT_RELEASE_BRANCH) --tags
157 scp-tarball: $(DIST_DIR)/.pushed/module-init-tools-$(VERSION).tar.gz $(DIST_DIR)/.pushed/module-init-tools-$(VERSION).tar.gz.sign
158         cd $(DIST_DIR) && scp -C module-init-tools-$(VERSION).tar.gz module-init-tools-$(VERSION).tar.gz.sign $(SCP_RELEASE_URL)
160 git-release: git-clean git-tag
162 release: git-release
164 sign-release: git-release gpg-tarball
166 push-release: sign-release git-push scp-tarball
168 push: push-release