Whamcloud - gitweb
b=3031
[fs/lustre-release.git] / lustre / ldiskfs / autoMakefile.am
1 if MODULES
2 if LDISKFS
3 modulefs_DATA = ldiskfs$(KMODEXT)
4 endif
5 endif
6
7 ldiskfs_linux_headers := $(addprefix linux/,$(subst ext3,ldiskfs,$(notdir $(linux_headers))))
8
9 $(filter %.c,$(ldiskfs_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_sources))
10
11 ldiskfs_sed_flags = \
12         -e "s/dx_hash_info/ext3_dx_hash_info/g" \
13         -e "s/dir_private_info/ext3_dir_private_info/g" \
14         -e "s/DX_HASH/EXT3_DX_HASH/g" \
15         -e "s/EXT3/LDISKFS/g" -e "s/ext3/ldiskfs/g"
16
17 %.c: linux-stage/fs/ext3/%.c
18         sed $(strip $(ldiskfs_sed_flags)) $< > $@
19
20 %.h: linux-stage/fs/ext3/%.h
21         sed $(strip $(ldiskfs_sed_flags)) $< > $@
22
23 linux/ldiskfs%.h: linux-stage/include/linux/ext3%.h
24         sed $(strip $(ldiskfs_sed_flags)) $< > $@
25
26 #
27 # FIXME: we need to grab the series in configure somehow
28 # (see bug 1679)
29 #
30 series := @top_srcdir@/lustre/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES)
31 patches := @top_srcdir@/lustre/kernel_patches/patches
32
33 sources: $(ext3_sources) $(ext3_headers) $(linux_headers) $(series)
34         rm -rf linux-stage linux sources $(ldiskfs_SOURCES)
35         mkdir -p linux-stage/fs/ext3 linux-stage/include/linux
36         cp $(ext3_sources) $(ext3_headers) $(ext3_extra) linux-stage/fs/ext3
37         cp $(linux_headers) linux-stage/include/linux
38 if USE_QUILT
39         cd linux-stage && quilt setup -l ../$(series) -d ../$(patches)
40         cd linux-stage && quilt push -a -q
41 else
42         @echo -n "Applying ext3 patches:"
43         @cd linux-stage && for i in $$(<../$(series)) ; do \
44                echo -n " $$i" ; \
45                patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
46         done
47         @echo
48 endif
49
50         mkdir linux
51         @echo -n "Replacing 'ext3' with 'ldiskfs':"
52         @for i in $(notdir $(ext3_headers) $(ext3_sources)) $(new_sources) ; do \
53                 echo -n " $$i" ; \
54                 sed $(strip $(ldiskfs_sed_flags)) \
55                         linux-stage/fs/ext3/$$i > $$i ; \
56         done
57         @for i in $(subst ext3,,$(notdir $(linux_headers)) $(new_linux_hearders)) ; do \
58                 echo -n " ext3$$i" ; \
59                 sed $(strip $(ldiskfs_sed_flags)) \
60                         linux-stage/include/linux/ext3$$i \
61                         > linux/ldiskfs$$i ; \
62         done
63         @echo
64         touch sources
65
66 foo-check:
67         @echo "ldiskfs_sources: $(ldiskfs_sources)"
68         @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
69         @echo "ldiskfs_headers: $(ldiskfs_headers)"
70         @echo "ldiskfs_objects: $(ldiskfs_objects)"
71         @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
72         @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
73
74 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
75 CLEANFILES = sources *.c *.h
76
77 clean: clean-am
78         rm -rf linux linux-stage