1 # Directories building kernel modules should have two files:
5 # MODULES := <module-name>
6 # <module-name>-objs := file1.o file2.o file3.o
16 # modulefs_DATA = <module-name>$(KMODEXT)
19 # DIST_SOURCES = $(<module-name>-objs:.o=.c) <other sources>
20 # MOSTLYCLEANFILES = *.o *.ko *.mod.c
26 # The kernel ABI files for the nonfree modules.
27 KABIS := $(NONFREE_MODULES:%$(KMODEXT)=%.kabi)
29 all: archive-nonfree-modules
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
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 $$?; \
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 $$?; \
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)" ; \
60 include @LINUX_CONFIG@
62 EXTRA_CFLAGS := $(EXTRA_PRE_CFLAGS)
63 EXTRA_CFLAGS += @EXTRA_KCFLAGS@ @UML_CFLAGS@ @CFLAGS@
64 EXTRA_CFLAGS += $(EXTRA_POST_CFLAGS)
66 obj-m := $(patsubst %,%.o,$(MODULES))
68 ifeq ($(PATCHLEVEL),4)
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