Whamcloud - gitweb
4f9e784f412832fd62bd1dcf6976ebaab5bdb7f6
[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 -l ../$(series) -d ../$(patches)
42         cd linux-stage && quilt push -a -q
43 else
44         @cd linux-stage && for i in $$(<../$(series)) ; do \
45                 echo "patch -p1 < ../$(patches)/$$i" ; \
46                 patch -p1 < ../$(patches)/$$i || exit 1 ; \
47         done
48 endif
49         mkdir linux
50         @echo -n "Replacing 'ext3' with 'ldiskfs':"
51         @for i in $(notdir $(ext3_headers) $(ext3_sources)) $(new_sources) ; do \
52                 echo -n " $$i" ; \
53                 sed $(strip $(ldiskfs_sed_flags)) \
54                         linux-stage/fs/ext3/$$i > $$i ; \
55         done
56         @for i in $(subst ext3,,$(notdir $(linux_headers) $(new_headers))) ; do \
57                 echo -n " ext3$$i" ; \
58                 sed $(strip $(ldiskfs_sed_flags)) \
59                         linux-stage/include/linux/ext3$$i \
60                         > linux/ldiskfs$$i ; \
61         done
62         @echo
63         touch sources
64
65 foo-check:
66         @echo "ldiskfs_sources: $(ldiskfs_sources)"
67         @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
68         @echo "ldiskfs_headers: $(ldiskfs_headers)"
69         @echo "ldiskfs_objects: $(ldiskfs_objects)"
70         @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
71         @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
72
73 MOSTLYCLEANFILES = *.o *.ko *.mod.c
74 CLEANFILES = sources $(notdir $(linux_headers) $(ext3_headers) $(ext3_sources) $(new_sources) $(new_headers))
75
76 EXTRA_DIST := lustre_quota_fmt.c lustre_quota_fmt.h quotafmt_test.c
77
78 clean: clean-am
79         rm -rf linux linux-stage