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