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