Whamcloud - gitweb
Small change: for replacing "Ext3" with "Ldiskfs".
[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_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_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/reserve_window/ext3_reserve_window/g" \
16         -e "s/rsv_window_add/ext3_rsv_window_add/g" \
17         -e "s/EXT3/LDISKFS/g" \
18         -e "s/ext3/ldiskfs/g" \
19         -e "s/Ext3/Ldiskfs/g"
20
21 %.c: linux-stage/fs/ext3/%.c
22         sed $(strip $(ldiskfs_sed_flags)) $< > $@
23
24 %.h: linux-stage/fs/ext3/%.h
25         sed $(strip $(ldiskfs_sed_flags)) $< > $@
26
27 linux/ldiskfs%.h: linux-stage/include/linux/ext3%.h
28         sed $(strip $(ldiskfs_sed_flags)) $< > $@
29
30 #
31 # FIXME: we need to grab the series in configure somehow
32 # (see bug 1679)
33 #
34 series := @top_srcdir@/lustre/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES)
35 patches := @top_srcdir@/lustre/kernel_patches/patches
36
37 sources: $(ext3_sources) $(ext3_headers) $(linux_headers) $(series)
38         rm -rf linux-stage linux sources $(ldiskfs_SOURCES)
39         mkdir -p linux-stage/fs/ext3 linux-stage/include/linux
40         cp $(ext3_sources) $(ext3_headers) $(ext3_extra) linux-stage/fs/ext3
41         cp $(linux_headers) linux-stage/include/linux
42 if USE_QUILT
43         ln -s ../$(patches) linux-stage/patches
44         ln -s ../$(series) linux-stage/series
45         cd linux-stage && quilt push -a -q
46 else
47         @echo -n "Applying ext3 patches:"
48         @cd linux-stage && for i in $$(<../$(series)) ; do \
49                 echo -n " $$i" ; \
50                 patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
51         done
52         @echo
53 endif
54         mkdir linux
55         @echo -n "Replacing 'ext3' with 'ldiskfs':"
56         @for i in $(notdir $(ext3_headers) $(ext3_sources)) $(new_sources) ; do \
57                 echo -n " $$i" ; \
58                 sed $(strip $(ldiskfs_sed_flags)) \
59                         linux-stage/fs/ext3/$$i > $$i ; \
60         done
61         @for i in $(subst ext3,,$(notdir $(linux_headers) $(new_headers))) ; do \
62                 echo -n " ext3$$i" ; \
63                 sed $(strip $(ldiskfs_sed_flags)) \
64                         linux-stage/include/linux/ext3$$i \
65                         > linux/ldiskfs$$i ; \
66         done
67         sed $(strip $(ldiskfs_sed_flags)) \
68         linux-stage/include/linux/lustre_iam.h \
69         > linux/lustre_iam.h
70         @echo
71         touch sources
72
73 foo-check:
74         @echo "ldiskfs_sources: $(ldiskfs_sources)"
75         @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
76         @echo "ldiskfs_headers: $(ldiskfs_headers)"
77         @echo "ldiskfs_objects: $(ldiskfs_objects)"
78         @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
79         @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
80
81 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
82 CLEANFILES = sources $(notdir $(linux_headers) $(ext3_headers) $(ext3_sources) $(new_sources) $(new_headers))
83
84 EXTRA_DIST := lustre_quota_fmt.c lustre_quota_fmt.h quotafmt_test.c
85
86 clean: clean-am
87         rm -rf linux linux-stage