1 EXTRA_DIST = kernel_patches
7 modulefs_DATA = ldiskfs$(KMODEXT)
9 ldiskfs$(KMODEXT): sources
13 ldiskfs_linux_headers := $(addprefix linux/,$(subst ext4,ldiskfs,$(notdir $(linux_headers))))
15 $(filter %.c,$(ldiskfs_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources))
17 # Convert LDISKFS_SUPER_MAGIC back to EXT4_SUPER_MAGIC so that the ldiskfs
18 # code can use the existing kernel headers instead of defining this itself.
20 -e "s/dx_hash_info/ext4_dx_hash_info/g" \
21 -e "s/DX_HASH/EXT4_DX_HASH/g" \
22 -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g" \
23 -e "s/LDISKFS_SUPER_MAGIC/EXT4_SUPER_MAGIC/g"
25 %.c: linux-stage/fs/ext4/%.c
26 sed $(strip $(ldiskfs_sed_flags)) $< > $@
28 %.h: linux-stage/fs/ext4/%.h
29 sed $(strip $(ldiskfs_sed_flags)) $< > $@
31 linux/ldiskfs%.h: linux-stage/include/linux/ext4%.h
32 sed $(strip $(ldiskfs_sed_flags)) $< > $@
34 series := @top_srcdir@/ldiskfs/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES)
35 patches := @top_srcdir@/ldiskfs/kernel_patches/patches
37 sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series) $(trace_headers)
38 rm -rf linux-stage linux sources trace $(ldiskfs_SOURCES)
39 mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \
40 linux-stage/include/trace/events
41 cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4
42 if test -n "$(linux_headers)" ; then \
43 cp $(linux_headers) linux-stage/include/linux; \
45 if test -n "$(trace_headers)" ; then \
46 cp $(trace_headers) linux-stage/include/trace/events; \
49 ln -s ../$(patches) linux-stage/patches
50 ln -s ../$(series) linux-stage/series
51 cd linux-stage && quilt push -a -q
53 @echo -n "Applying ext4 patches:"
54 @cd linux-stage && for i in $$(<../$(series)) ; do \
56 patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
60 mkdir -p linux trace/events
61 @echo -n "Replacing 'ext4' with 'ldiskfs':"
62 for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
64 sed $(strip $(ldiskfs_sed_flags)) \
65 linux-stage/fs/ext4/$$i > $$i ; \
67 for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \
68 if test -f "ext4$$i" ; then \
69 echo -n " ext4$$i" ; \
70 mv ext4$$i ldiskfs$$i ; \
73 for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \
74 echo -n " ext4$$i" ; \
75 sed $(strip $(ldiskfs_sed_flags)) \
76 linux-stage/include/linux/ext4$$i \
77 > linux/ldiskfs$$i ; \
79 for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \
81 sed $(strip $(ldiskfs_sed_flags)) \
82 linux-stage/include/trace/events/ext4$$i \
83 > trace/events/ldiskfs$$i ; \
85 for i in $(notdir $(linux_new_headers)) ; do \
87 sed $(strip $(ldiskfs_sed_flags)) \
88 linux-stage/include/linux/$$i \
96 @echo "ldiskfs_sources: $(ldiskfs_sources)"
97 @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
98 @echo "ldiskfs_headers: $(ldiskfs_headers)"
99 @echo "ldiskfs_objects: $(ldiskfs_objects)"
100 @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
101 @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
103 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
104 CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers))
107 rm -rf linux linux-stage ldiskfs*.h trace modules.order