Whamcloud - gitweb
218094043757812e3027300e27146f6d5c01b79e
[fs/lustre-release.git] / lustre / 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 ($(KERNELRELEASE),)
23
24 include autoMakefile
25
26 ifeq (@MODULES_TRUE@,)
27 $(foreach MODULE,$(MODULES),$(MODULE)@KMODEXT@): FORCE
28         $(MAKE) @ARCH_UM@ -C $(LINUX) SUBDIRS=$(PWD) modules
29 FORCE:
30 endif
31
32 else
33
34 # we want to use -O0 for UML, unless it's already set (ie, in the
35 # socknal where we need to build with -O2 so that htonl etc. are
36 # linked correctly
37 ifeq ($(filter -O%,$(EXTRA_CFLAGS)),)
38 EXTRA_CFLAGS += @UML_CFLAGS@
39 endif
40 EXTRA_CFLAGS += @EXTRA_KCFLAGS@
41
42 obj-m := $(patsubst %,%.o,$(MODULES))
43
44 ifeq ($(PATCHLEVEL),4)
45 # 2.4 rules
46 O_TARGET := $(firstword $(obj-m))
47 obj-y := $($(firstword $(MODULES))-objs)
48 export-objs := $(obj-y) $(filter-out $(O_TARGET),$(obj-m))
49 include $(TOPDIR)/Rules.make
50 endif # PATCHLEVEL
51
52 endif # KERNELRELEASE