[PATCH] module-init-tools : insmod_correct_argv0_computation
[mit.git] / Makefile.am
blob849188384556f7afa6ad0c9f4ea186e4cdab7ef9
1 insmod_SOURCES = insmod.c testing.h
2 lsmod_SOURCES = lsmod.c testing.h
3 modprobe_SOURCES = modprobe.c zlibsupport.c testing.h zlibsupport.h
4 rmmod_SOURCES = rmmod.c testing.h
5 depmod_SOURCES = depmod.c moduleops.c tables.c zlibsupport.c depmod.h moduleops.h tables.h list.h testing.h  zlibsupport.h
6 modinfo_SOURCES = modinfo.c zlibsupport.c testing.h zlibsupport.h
8 insmod_static_SOURCES = insmod.c
9 insmod_static_LDFLAGS = -static
10 # We don't want the $(zlib_flags) here: that makes a dynamic executable
11 insmod_static_LDADD = 
13 EXTRA_insmod_SOURCES = backwards_compat.c
14 EXTRA_lsmod_SOURCES = backwards_compat.c
15 EXTRA_modprobe_SOURCES = backwards_compat.c
16 EXTRA_rmmod_SOURCES = backwards_compat.c
17 EXTRA_insmod_static_SOURCES = backwards_compat.c
18 EXTRA_depmod_SOURCES = moduleops_core.c
19 EXTRA_modinfo_SOURCES = backwards_compat.c
21 MAN5 = modprobe.conf.5 modules.dep.5 depmod.conf.5
22 MAN8 = depmod.8 insmod.8 lsmod.8 rmmod.8 modprobe.8 modinfo.8
23 SGML = $(addprefix doc/,  $(MAN5:%.5=%.sgml) $(MAN8:%.8=%.sgml))
24 man_MANS = $(MAN5) $(MAN8)
25 # If they haven't overridden mandir, fix it (never /man!)
26 mandir =$(shell if [ @mandir@ = $(prefix)/man ]; then if [ $(prefix) = / ]; then echo /usr/share/man; else echo $(prefix)/share/man; fi; else echo @mandir@; fi)
28 TESTSUITE := $(shell find tests -type f ! -name '*~') tests/vg-suppressions
30 EXTRA_DIST = generate-modprobe.conf modprobe.devfs FAQ CODING stress_modules.sh install-with-care $(SGML) $(man_MANS) $(TESTSUITE)
32 sbin_PROGRAMS = insmod modprobe rmmod depmod modinfo insmod.static
33 bin_PROGRAMS = lsmod
34 sbin_SCRIPTS = generate-modprobe.conf
35 INSTALL = $(SHELL) $(top_srcdir)/install-with-care
37 TESTS = tests/runtests
39 DIST_DIR := /home/rusty/devel/kernel/www/modules/
41 MAINTAINERCLEANFILES := $(man_MANS)
43 # According to Warren Togami, RH has docbook2man in the docbook-utils rpm.
44 DOCBOOKTOMAN := $(shell if command -v docbook-to-man >/dev/null 2>&1; then echo docbook-to-man; else echo docbook2man; fi)
46 # docbook2man writes file itself, doesn't do stdout.
47 %.8: doc/%.sgml
48         if [ "$(DOCBOOKTOMAN)" = "docbook2man" ]; then                     \
49             $(DOCBOOKTOMAN) $< > /dev/null 2>&1;                       \
50         else                                                               \
51             $(DOCBOOKTOMAN) $< 2>&1 > $@ | sed 's/^[^:]*://';              \
52         fi
54 %.5: doc/%.sgml
55         if [ "$(DOCBOOKTOMAN)" = "docbook2man" ]; then                     \
56             $(DOCBOOKTOMAN) $< > /dev/null 2>&1;                       \
57         else                                                               \
58             $(DOCBOOKTOMAN) $< 2>&1 > $@ | sed 's/^[^:]*://';              \
59         fi
61 # docbook2man creates extra crap files which need cleaning.
62 distclean: killbuildmanpages
64 killbuildmanpages:
65         rm -f doc/*.tmp manpage.refs manpage.links
67 tarball: $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz
69 $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz: dist
70         mv module-init-tools-$(VERSION).tar.gz $@
72 srpm: $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz
73         ln -sf $(DIST_DIR)/module-init-tools-$(VERSION).tar.gz /usr/src/rpm/SOURCES/
74         set -e; RELEASE=`grep '^Release:' /usr/src/rpm/SPECS/modutils.spec | awk '{ print $$2 }'`; \
75         if [ "`grep '%define mit_ver' /usr/src/rpm/SPECS/modutils.spec | awk '{print $$3}'`" != $(VERSION) ]; then \
76                 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; \
77                 rpm -ba /tmp/modutils.spec; \
78                 mv /usr/src/rpm/SRPMS/modutils-2.4.21-`expr $$RELEASE + 1`.src.rpm $(DIST_DIR); \
79                 mv /tmp/modutils.spec /usr/src/rpm/SPECS/modutils.spec; \
80         else \
81                 rpm -ba /usr/src/rpm/SPECS/modutils.spec; \
82                 mv /usr/src/rpm/SRPMS/modutils-2.4.21-$$RELEASE.src.rpm $(DIST_DIR); \
83         fi
85 # No testsuite?
86 tests/runtests:
87         mkdir tests
88         echo '#! /bin/sh' > $@
89         echo '# Install the testsuite over this dir. ' >> $@
90         chmod a+x $@
92 $(DIST_DIR)/module-init-tools-testsuite-$(VERSION).tar.gz:
93         ln -sfn `pwd` /tmp/module-init-tools-$(VERSION) 
94         cd /tmp && tar --exclude '*~' -c -z -f $@ module-init-tools-$(VERSION)/tests
95         rm /tmp/module-init-tools-$(VERSION)
97 release: check clean tarball
99 moveold: check-for-sbin check-for-old move-old-targets
101 check-for-sbin:
102         if [ "`echo $(DESTDIR)$(sbindir) | tr -s / /`" = /sbin ]; then :;    \
103         else                                                                 \
104                 echo moveold usually only makes sense when installing into /sbin; \
105                 exit 1;                                                      \
106         fi
108 check-for-old:
109         if [ -f /sbin/lsmod.old ]; then                                 \
110                 echo Someone already moved old versions. >&2; exit 1;   \
111         fi
113 # Don't just move symlinks, reset them to point to xxx.old.
114 # RedHat 8.0 doesn't ship with readlink by default.  Use ls -l.
115 # Also, make symlink from /bin to /sbin for lsmod (FHS compliant).
116 move-old-targets:
117         for f in lsmod modprobe rmmod depmod insmod modinfo; do             \
118             if [ -L /sbin/$$f ]; then                                       \
119                 ln -sf `ls -l /sbin/$$f | sed 's/.* -> //'`.old /sbin/$$f;  \
120             fi;                                                             \
121             mv /sbin/$$f /sbin/$$f.old;                                     \
122             if [ -f /usr/share/man/man8/$$f.8.gz ]; then                    \
123                 mv /usr/share/man/man8/$$f.8.gz                             \
124                         /usr/share/man/man8/$$f.old.8.gz;                   \
125             elif [ -f /usr/share/man/man8/$$f.8.bz2 ]; then                 \
126                 mv /usr/share/man/man8/$$f.8.bz2                            \
127                         /usr/share/man/man8/$$f.old.8.bz2;                  \
128             else                                                            \
129                 mv /usr/share/man/man8/$$f.8 /usr/share/man/man8/$$f.old.8; \
130             fi;                                                             \
131         done
132         for f in kallsyms ksyms; do                                         \
133             if [ -L /sbin/$$f ]; then                                       \
134                 ln -sf `ls -l /sbin/$$f | sed 's/.* -> //'`.old /sbin/$$f;  \
135             fi;                                                             \
136         done
137         ln -s /sbin/lsmod.old /bin/lsmod.old
139 # For installs in /usr/local/sbin
140 links:
141         for f in insmod modprobe rmmod depmod; do ln -s /sbin/$$f $(DESTDIR)$(sbindir)/$$f.old; done
142         for f in  lsmod; do ln -s /sbin/$$f $(DESTDIR)$(bindir)/$$f.old; done