Whamcloud - gitweb
LU-2302 scripts: fix lfs_migrate with non-English locale
[fs/lustre-release.git] / ldiskfs / ldiskfs / autoMakefile.am
1 modulefs_DATA = ldiskfs$(KMODEXT)
2
3 ldiskfs_linux_headers := $(addprefix linux/,$(subst ext4,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/ext4_dx_hash_info/g" \
9         -e "s/DX_HASH/EXT4_DX_HASH/g" \
10         -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g"
11
12 %.c: linux-stage/fs/ext4/%.c
13         sed $(strip $(ldiskfs_sed_flags)) $< > $@
14
15 %.h: linux-stage/fs/ext4/%.h
16         sed $(strip $(ldiskfs_sed_flags)) $< > $@
17
18 linux/ldiskfs%.h: linux-stage/include/linux/ext4%.h
19         sed $(strip $(ldiskfs_sed_flags)) $< > $@
20
21 series := @top_srcdir@/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES)
22 patches := @top_srcdir@/kernel_patches/patches
23
24 sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series) $(trace_headers)
25         rm -rf linux-stage linux sources trace $(ldiskfs_SOURCES)
26         mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \
27                  linux-stage/include/trace/events
28         cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4
29         if test -n "$(linux_headers)" ; then \
30                 cp $(linux_headers) linux-stage/include/linux; \
31         fi
32         if test -n "$(trace_headers)" ; then \
33                 cp $(trace_headers) linux-stage/include/trace/events; \
34         fi
35 if USE_QUILT
36         ln -s ../$(patches) linux-stage/patches
37         ln -s ../$(series) linux-stage/series
38         cd linux-stage && quilt push -a -q
39 else
40         @echo -n "Applying ext4 patches:"
41         @cd linux-stage && for i in $$(<../$(series)) ; do \
42                 echo -n " $$i" ; \
43                 patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
44         done
45         @echo
46 endif
47         mkdir -p linux trace/events
48         @echo -n "Replacing 'ext4' with 'ldiskfs':"
49         for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
50                 echo -n " $$i" ; \
51                 sed $(strip $(ldiskfs_sed_flags)) \
52                         linux-stage/fs/ext4/$$i > $$i ; \
53         done
54         for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \
55                 if test -f "ext4$$i" ; then \
56                         echo -n " ext4$$i" ; \
57                         mv ext4$$i ldiskfs$$i ; \
58                 fi ; \
59         done
60         for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \
61                 echo -n " ext4$$i" ; \
62                 sed $(strip $(ldiskfs_sed_flags)) \
63                         linux-stage/include/linux/ext4$$i \
64                         > linux/ldiskfs$$i ; \
65         done
66         for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \
67                 echo -n " ext4$$i"; \
68                 sed $(strip $(ldiskfs_sed_flags)) \
69                         linux-stage/include/trace/events/ext4$$i \
70                         > trace/events/ldiskfs$$i ; \
71         done
72         for i in $(notdir $(linux_new_headers)) ; do \
73                 echo -n " $$i"; \
74                 sed $(strip $(ldiskfs_sed_flags)) \
75                 linux-stage/include/linux/$$i \
76                 > linux/$$i ; \
77         done
78
79         @echo
80         touch sources
81
82 foo-check:
83         @echo "ldiskfs_sources: $(ldiskfs_sources)"
84         @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
85         @echo "ldiskfs_headers: $(ldiskfs_headers)"
86         @echo "ldiskfs_objects: $(ldiskfs_objects)"
87         @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
88         @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
89
90 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
91 CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers))
92
93 clean: clean-am
94         rm -rf linux linux-stage ldiskfs*.h trace