Whamcloud - gitweb
Update buildcvs to use the correct tags for b_hd_kdmu.
[fs/lustre-release.git] / build / Rules.in
1 # Directories building kernel modules should have two files:
2 #
3 # Makefile.in:
4 #
5 # MODULES := <module-name>
6 # <module-name>-objs := file1.o file2.o file3.o
7 # @INCLUDE_RULES@
8 #
9 # and autoMakefile.am:
10 #
11 # if LIBLUSTRE
12 # <liblustre rules>
13 # endif
14 #
15 # if MODULES
16 # modulefs_DATA = <module-name>$(KMODEXT)
17 # endif
18 #
19 # DIST_SOURCES = $(<module-name>-objs:.o=.c) <other sources>
20 # MOSTLYCLEANFILES = *.o *.ko *.mod.c
21
22 ifeq ($(PATCHLEVEL),)
23
24 include autoMakefile
25
26 # The kernel ABI files for the nonfree modules.
27 KABIS := $(NONFREE_MODULES:%$(KMODEXT)=%.kabi)
28
29 all: archive-nonfree-modules
30
31 # Where to archive the nonfree modules for binary distribution.
32 # If this directory has a colon in it, SSH/SCP are used to go out on the network.
33 nonfreedir := $$HOME/nonfree
34 #nonfreedir := moraine.clusterfs.com:/home/lustre-nonfree
35
36 # Put the nonfree modules and corresponding KABI files into the binary
37 # archive.  We assume that if the CVS subdirectory doesn't exist, we
38 # don't want to archive.
39 archive-nonfree-modules: $(KABIS) $(NONFREE_MODULES)
40         test -d CVS || exit 0; \
41         list="$(NONFREE_MODULES)"; for mod in $$list; do \
42           perl $(top_srcdir)/build/kabi -v archive $(nonfreedir) $$mod || exit $$?; \
43         done
44
45 # Generate the Kernel ABI files for the nonfree modules.
46 $(KABIS): $(NONFREE_MODULES)
47         for mod in $(NONFREE_MODULES); do \
48           CC="$(CC)" perl $(top_srcdir)/build/kabi --with-linux="$(LINUX)" module $$mod || exit $$?; \
49         done
50
51 fix-kext-ownership:
52         @if test -d $(DESTDIR)$(kextdir) ; then \
53                 echo chown -R root:wheel $(DESTDIR)$(kextdir) ; \
54                 chown -R root:wheel $(DESTDIR)$(kextdir) || \
55                         echo >&2 "*** WARNING: Could not fix kext ownership for $(DESTDIR)$(kextdir)" ; \
56         fi
57
58 else
59
60 include @LINUX_CONFIG@
61
62 EXTRA_CFLAGS := $(EXTRA_PRE_CFLAGS)
63 EXTRA_CFLAGS += @EXTRA_KCFLAGS@ @UML_CFLAGS@ @CFLAGS@
64 EXTRA_CFLAGS += $(EXTRA_POST_CFLAGS)
65
66 obj-m := $(patsubst %,%.o,$(MODULES))
67
68 ifeq ($(PATCHLEVEL),4)
69 # 2.4 rules
70 O_TARGET := $(firstword $(obj-m))
71 obj-y := $($(firstword $(MODULES))-objs)
72 export-objs := $(obj-y) $(filter-out $(O_TARGET),$(obj-m))
73 include $(TOPDIR)/Rules.make
74 $(MODINCL)/%.ver: %.c
75         @true
76 endif # PATCHLEVEL
77
78 endif # KERNELRELEASE