X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=ldiskfs%2FautoMakefile.am;h=45e266d88a235ed74c4f9418ce8b11475f714f3f;hp=04a00aae801d111c6e4dd4e0b1c898f600e6e53a;hb=fa1bff8f6f3afb858618a563b039af3bbf46153b;hpb=2cf42237b46747308e5ee10cf027fe93a97d3690 diff --git a/ldiskfs/autoMakefile.am b/ldiskfs/autoMakefile.am index 04a00aa..45e266d 100644 --- a/ldiskfs/autoMakefile.am +++ b/ldiskfs/autoMakefile.am @@ -1,23 +1,107 @@ -SUBDIRS := . ldiskfs -SOURCES_SUBDIRS := ldiskfs -DIST_SUBDIRS := ldiskfs - -# this is in fact irrelevant in this file but needed to keep -# autoMakefile.am.toplevel happy -BUILD_TESTS = false - -include build/autoMakefile.am.toplevel - -EXTRA_DIST += kernel_patches - -# this only needs to be done if disting stand-alone (i.e. not as a -# subdir of lustre -module-dist-hook: - if ! grep "AC_INIT(\[Lustre\], \[LUSTRE_VERSION\], \[http:\/\/bugs\.whamcloud\.com\/], \[lustre\])" ../configure.ac; then \ - if [ -f META ]; then \ - cp META $(distdir)/META; \ - else \ - echo -e "I have no idea how to create a META file in $(distdir).\nPlease file a bug at http://bugs.whamcloud.com/"; \ - exit 1; \ - fi; \ +EXTRA_DIST = kernel_patches + +if MODULES +if LDISKFS_ENABLED +all-local: sources + +modulefs_DATA = ldiskfs$(KMODEXT) + +ldiskfs$(KMODEXT): sources +endif +endif + +ldiskfs_linux_headers := $(addprefix linux/,$(subst ext4,ldiskfs,$(notdir $(linux_headers)))) + +$(filter %.c,$(ldiskfs_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources)) + +# Convert LDISKFS_SUPER_MAGIC back to EXT4_SUPER_MAGIC so that the ldiskfs +# code can use the existing kernel headers instead of defining this itself. +ldiskfs_sed_flags = \ + -e "s/dx_hash_info/ext4_dx_hash_info/g" \ + -e "s/DX_HASH/EXT4_DX_HASH/g" \ + -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g" \ + -e "s/LDISKFS_SUPER_MAGIC/EXT4_SUPER_MAGIC/g" + +%.c: linux-stage/fs/ext4/%.c + sed $(strip $(ldiskfs_sed_flags)) $< > $@ + +%.h: linux-stage/fs/ext4/%.h + sed $(strip $(ldiskfs_sed_flags)) $< > $@ + +linux/ldiskfs%.h: linux-stage/include/linux/ext4%.h + sed $(strip $(ldiskfs_sed_flags)) $< > $@ + +series := @top_srcdir@/ldiskfs/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES) +patches := @top_srcdir@/ldiskfs/kernel_patches/patches + +sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series) $(trace_headers) + rm -rf linux-stage linux sources trace $(ldiskfs_SOURCES) + mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \ + linux-stage/include/trace/events + cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4 + if test -n "$(linux_headers)" ; then \ + cp $(linux_headers) linux-stage/include/linux; \ + fi + if test -n "$(trace_headers)" ; then \ + cp $(trace_headers) linux-stage/include/trace/events; \ fi +if USE_QUILT + ln -s ../$(patches) linux-stage/patches + ln -s ../$(series) linux-stage/series + cd linux-stage && quilt push -a -q +else + @echo -n "Applying ext4 patches:" + @cd linux-stage && for i in $$(<../$(series)) ; do \ + echo -n " $$i" ; \ + patch -s -p1 < ../$(patches)/$$i || exit 1 ; \ + done + @echo +endif + mkdir -p linux trace/events + @echo -n "Replacing 'ext4' with 'ldiskfs':" + for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \ + echo -n " $$i" ; \ + sed $(strip $(ldiskfs_sed_flags)) \ + linux-stage/fs/ext4/$$i > $$i ; \ + done + for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \ + if test -f "ext4$$i" ; then \ + echo -n " ext4$$i" ; \ + mv ext4$$i ldiskfs$$i ; \ + fi ; \ + done + for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \ + echo -n " ext4$$i" ; \ + sed $(strip $(ldiskfs_sed_flags)) \ + linux-stage/include/linux/ext4$$i \ + > linux/ldiskfs$$i ; \ + done + for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \ + echo -n " ext4$$i"; \ + sed $(strip $(ldiskfs_sed_flags)) \ + linux-stage/include/trace/events/ext4$$i \ + > trace/events/ldiskfs$$i ; \ + done + for i in $(notdir $(linux_new_headers)) ; do \ + echo -n " $$i"; \ + sed $(strip $(ldiskfs_sed_flags)) \ + linux-stage/include/linux/$$i \ + > linux/$$i ; \ + done + + @echo + touch sources + +foo-check: + @echo "ldiskfs_sources: $(ldiskfs_sources)" + @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)" + @echo "ldiskfs_headers: $(ldiskfs_headers)" + @echo "ldiskfs_objects: $(ldiskfs_objects)" + @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)" + @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)" + +MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ +CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers)) + +clean-local: + rm -rf linux linux-stage ldiskfs*.h trace modules.order