From f26508204bf5a51a83af294114f47e7b6c82c958 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 18 Oct 2009 10:26:15 +0200 Subject: maint: factor out duplication in currently unused rules * src/Makefile.am (fs_normalize_perl_subst): Define. (fs-magic, fs-kernel-magic): Use it. --- src/Makefile.am | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 915ea8165..67c29ccb2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -538,6 +538,7 @@ AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = false test # Compare fs.h with the list of file system names/magic-numbers in the # Linux statfs man page. This target prints any new name/number pairs. +# Also compare against /usr/include/linux/magic.h .PHONY: fs-magic-compare fs-magic-compare: fs-magic fs-kernel-magic fs-def join -v1 -t@ fs-magic fs-def @@ -547,24 +548,34 @@ CLEANFILES += fs-def fs-def: fs.h grep '^# *define ' $< > $@-t && mv $@-t $@ +# Massage bits of the statfs man page and definitions from +# /usr/include/linux/magic.h to be in a form consistent with what's in fs.h. +fs_normalize_perl_subst = \ + -e 's/MINIX_SUPER_MAGIC\b/MINIX/;' \ + -e 's/MINIX_SUPER_MAGIC2\b/MINIX_30/;' \ + -e 's/MINIX2_SUPER_MAGIC\b/MINIX_V2/;' \ + -e 's/MINIX2_SUPER_MAGIC2\b/MINIX_V2_30/;' \ + -e 's/MINIX3_SUPER_MAGIC\b/MINIX_V3/;' \ + -e 's/CIFS_MAGIC_NUMBER/CIFS/;' \ + -e 's/(_SUPER)?_MAGIC//;' \ + -e 's/\s+0x(\S+)/" 0x" . uc $$1/e;' \ + -e 's/(\s+0x)(\X{3})\b/$${1}0$$2/;' \ + -e 's/(\s+0x)(\X{6})\b/$${1}00$$2/;' \ + -e 's/(\s+0x)(\X{7})\b/$${1}0$$2/;' \ + -e 's/^\s+//;' \ + -e 's/^\#define\s+//;' \ + -e 's/^_(XIAFS)/$$1/;' \ + -e 's/^USBDEVICE/USBDEVFS/;' \ + -e 's/NTFS_SB/NTFS/;' \ + -e 's/^/\# define S_MAGIC_/;' \ + -e 's,\s*/\* .*? \*/,,;' + CLEANFILES += fs-magic fs-magic: Makefile man statfs \ |perl -ne '/File system types:/.../Nobody kno/ and print' \ |grep 0x | perl -p \ - -e 's/MINIX_SUPER_MAGIC\b/MINIX/;' \ - -e 's/MINIX_SUPER_MAGIC2\b/MINIX_30/;' \ - -e 's/MINIX2_SUPER_MAGIC\b/MINIX_V2/;' \ - -e 's/MINIX2_SUPER_MAGIC2\b/MINIX_V2_30/;' \ - -e 's/CIFS_MAGIC_NUMBER/CIFS/;' \ - -e 's/(_SUPER)?_MAGIC//;' \ - -e 's/\s+0x(\S+)/" 0x" . uc $$1/e;' \ - -e 's/^\s+//;' \ - -e 's/^_(XIAFS)/$$1/;' \ - -e 's/^USBDEVICE/USBDEVFS/;' \ - -e 's/NTFS_SB/NTFS/;' \ - -e 's/^/# define S_MAGIC_/;' \ - -e 's,\s*/\* .*? \*/,,;' \ + $(fs_normalize_perl_subst) \ | grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \ | LC_ALL=C sort \ > $@-t && mv $@-t $@ @@ -573,20 +584,7 @@ CLEANFILES += fs-kernel-magic fs-kernel-magic: Makefile perl -ne '/^#define.*0x/ and print' /usr/include/linux/magic.h \ | perl -p \ - -e 's/MINIX_SUPER_MAGIC\b/MINIX/;' \ - -e 's/MINIX_SUPER_MAGIC2\b/MINIX_30/;' \ - -e 's/MINIX2_SUPER_MAGIC\b/MINIX_V2/;' \ - -e 's/MINIX2_SUPER_MAGIC2\b/MINIX_V2_30/;' \ - -e 's/MINIX3_SUPER_MAGIC\b/MINIX_V3/;' \ - -e 's/(_SUPER)?_MAGIC//;' \ - -e 's/\s+0x(\S+)/" 0x" . uc $$1/e;' \ - -e 's/(\s+0x)(\X{3})\b/$${1}0$$2/;' \ - -e 's/(\s+0x)(\X{6})\b/$${1}00$$2/;' \ - -e 's/(\s+0x)(\X{7})\b/$${1}0$$2/;' \ - -e 's/^#define\s+//;' \ - -e 's/^USBDEVICE/USBDEVFS/;' \ - -e 's/^/# define S_MAGIC_/;' \ - -e 's,\s*/\* .*? \*/,,;' \ + $(fs_normalize_perl_subst) \ | grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \ | LC_ALL=C sort \ > $@-t && mv $@-t $@ -- cgit v1.2.3-54-g00ecf