Hi Linus,

this patch converts the Makefiles in the drivers, net and fs subdirectories
to the new list-style syntax. The format for subdirectories is new and
has been discussed on linux-kbuild. The only link-order change by this
patch is that the cdrom/ subdirectory of drivers/ is now more at the beginning
because it is always entered (this simplyfies the Makefile).

726 lines removed
209 lines added

Please apply.

        Christoph

-- 
Always remember that you are unique.  Just like everyone else.


diff -uNr linux.orig/Documentation/kbuild/makefiles.txt 
linux/Documentation/kbuild/makefiles.txt
--- linux.orig/Documentation/kbuild/makefiles.txt       Wed Sep 27 16:21:33 2000
+++ linux/Documentation/kbuild/makefiles.txt    Wed Sep 27 16:41:00 2000
@@ -1146,6 +1146,48 @@
        But until that happens, the subdirectory Makefile needs to define
        these rules explicitly.
 
+    subdir-y subdir-m subdir-n subdir-
+
+       These variables replace $(ALL_SUB_DIRS), $(SUB_DIRS) and
+       $(MOD_SUB_DIRS).
+
+       Example:
+
+               # drivers/Makefile
+               subdir-$(CONFIG_PCI)            += pci
+               subdir-$(CONFIG_PCMCIA)         += pcmcia
+               subdir-$(CONFIG_MTD)            += mtd
+               subdir-$(CONFIG_SBUS)           += sbus
+
+       These variables work similar to obj-*, but are used for
+       subdirectories instead of object files.
+
+       After executing all of the assignments, the subdirectory
+       Makefile has built up four lists: $(subdir-y), $(subdir-m),
+       $(subdir-n), and $(subdir-).
+
+       $(subdir-y) is a list of directories that should be entered
+               for making vmlinux.
+       $(subdir-m) is a list of directories that should be entered
+               for making modules.
+       $(subdir-n) and $(subdir-) are only used for collecting a list
+               of all subdirectories of this directory.
+
+       Each list besides subdir-y may contain duplicates items; duplicates
+       are automatically removed later.
+
+    mod-subdirs
+
+       $(mod-subdirs) is a list of all the the subdirectories that should
+       be added to $(subdir-m), too if they appear in $(subdir-y)
+
+       Example:
+
+               # fs/Makefile
+               mod-subdirs :=  nls
+
+       This means nls should be added to (subdir-y) and $(subdir-m) if
+       CONFIG_NFS = y.
 
 
 === 9 Compatibility with Linux Kernel 2.2
diff -uNr linux.orig/drivers/Makefile linux/drivers/Makefile
--- linux.orig/drivers/Makefile Wed Sep 27 16:21:36 2000
+++ linux/drivers/Makefile      Wed Sep 27 16:34:46 2000
@@ -1,214 +1,59 @@
 #
 # Makefile for the Linux kernel device drivers.
 #
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (not a .c file).
+# 15 Sep 2000, Christoph Hellwig <[EMAIL PROTECTED]>
+# Rewritten to use lists instead of if-statements.
 #
-# Note 2! The CFLAGS definitions are now in the main makefile.
 
-SUB_DIRS     := block char net parport sound misc media
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS) pci sgi ide scsi sbus cdrom isdn pnp i2o \
-                               ieee1394 macintosh video dio zorro fc4 \
-                               usb nubus tc atm pcmcia i2c telephony \
-                               acpi mtd input md
-
-ifdef CONFIG_DIO
-SUB_DIRS += dio
-MOD_SUB_DIRS += dio
-endif
-
-ifdef CONFIG_PCI
-SUB_DIRS += pci
-endif
-
-ifeq ($(CONFIG_PCMCIA),y)
-SUB_DIRS += pcmcia
-else
-  ifeq ($(CONFIG_PCMCIA),m)
-  MOD_SUB_DIRS += pcmcia
-  endif
-endif
-
-ifdef CONFIG_MTD
-SUB_DIRS += mtd
-MOD_SUB_DIRS += mtd
-endif
-
-ifdef CONFIG_SBUS
-SUB_DIRS += sbus
-MOD_SUB_DIRS += sbus
-endif
-
-ifdef CONFIG_ZORRO
-SUB_DIRS += zorro
-endif
-
-ifdef CONFIG_NUBUS
-SUB_DIRS += nubus
-endif
-
-ifdef CONFIG_TC
-SUB_DIRS += tc
-endif
-
-ifdef CONFIG_VT
-SUB_DIRS += video
-MOD_SUB_DIRS += video
-endif
-
-ifdef CONFIG_MAC
-SUB_DIRS += macintosh
-MOD_SUB_DIRS += macintosh
-endif
-
-ifdef CONFIG_ALL_PPC
-SUB_DIRS += macintosh
-MOD_SUB_DIRS += macintosh
-endif
-
-ifeq ($(CONFIG_USB),y)
-SUB_DIRS += usb
-MOD_SUB_DIRS += usb
-else
-  ifeq ($(CONFIG_USB),m)
-  MOD_SUB_DIRS += usb
-  endif
-endif 
-
-ifeq ($(CONFIG_INPUT),y)
-SUB_DIRS += input
-MOD_SUB_DIRS += input
-else
-  ifeq ($(CONFIG_INPUT),m)
-  MOD_SUB_DIRS += input
-  endif
-endif 
-
-ifeq ($(CONFIG_PHONE),y)
-SUB_DIRS += telephony
-MOD_SUB_DIRS += telephony
-else
-  ifeq ($(CONFIG_PHONE),m)
-  MOD_SUB_DIRS += telephony
-  endif
-endif 
-
-ifdef CONFIG_SGI
-SUB_DIRS += sgi
-MOD_SUB_DIRS += sgi
-endif
-
-ifeq ($(CONFIG_I2O),y)
-SUB_DIRS += i2o
-MOD_SUB_DIRS += i2o
-else
-  ifeq ($(CONFIG_I2O),m)
-  MOD_SUB_DIRS += i2o
-  endif
-endif 
-
-# If CONFIG_IDE is set, the core of ATA support will be added to the kernel,
-# but some of the low-level things may also be modules.
-ifeq ($(CONFIG_IDE),y)
-SUB_DIRS += ide
-MOD_SUB_DIRS += ide
-else
-  ifeq ($(CONFIG_IDE),m)
-  MOD_SUB_DIRS += ide
-  endif
-endif
-
-# If CONFIG_SCSI is set, the core of SCSI support will be added to the kernel,
-# but some of the low-level things may also be modules.
-ifeq ($(CONFIG_SCSI),y)
-SUB_DIRS += scsi
-MOD_SUB_DIRS += scsi
-else
-  ifeq ($(CONFIG_SCSI),m)
-  MOD_SUB_DIRS += scsi
-  endif
-endif
-
-ifeq ($(CONFIG_BLK_DEV_MD),y)
-SUB_DIRS += md
-MOD_SUB_DIRS += md
-else
-  ifeq ($(CONFIG_BLK_DEV_MD),m)
-  MOD_SUB_DIRS += md
-  endif
-endif
-
-ifeq ($(CONFIG_IEEE1394),y)
-SUB_DIRS += ieee1394
-MOD_SUB_DIRS += ieee1394
-else
-  ifeq ($(CONFIG_IEEE1394),m)
-  MOD_SUB_DIRS += ieee1394
-  endif
-endif
-
-ifeq ($(CONFIG_PNP),y)
-SUB_DIRS += pnp
-MOD_SUB_DIRS += pnp
-else
-  ifeq ($(CONFIG_PNP),m)
-  MOD_SUB_DIRS += pnp
-  endif
-endif
-
-ifneq 
($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
-SUB_DIRS += cdrom
-MOD_SUB_DIRS += cdrom
-endif
-
-ifeq ($(CONFIG_ISDN),y)
-SUB_DIRS += isdn
-MOD_SUB_DIRS += isdn
-else
-  ifeq ($(CONFIG_ISDN),m)
-  MOD_SUB_DIRS += isdn
-  endif
-endif
-
-ifdef CONFIG_ATM
-SUB_DIRS += atm
-MOD_SUB_DIRS += atm
-endif
-
-ifeq ($(CONFIG_FC4),y)
-SUB_DIRS += fc4
-MOD_SUB_DIRS += fc4
-else
-  ifeq ($(CONFIG_FC4),m)
-  MOD_SUB_DIRS += fc4
-  endif
-endif
-
-# When MOD_LIST_NAME is set, make will try to add $(MOD_SUB_DIRS).o to
-# modules/MOD_LIST_NAME.  We don't have hamradio.o and Linus
-# sort of insisted on making hamradio/ a subdirectory of drivers/net/.
-# #FIXME# MOD_LIST_NAME doesn't exist any more -- does this comment
-# #FIXME# still mean anything?
-
-ifeq ($(CONFIG_HAMRADIO),y)
-  SUB_DIRS += net/hamradio
-  MOD_SUB_DIRS += net/hamradio
-endif
-
-ifeq ($(CONFIG_I2C),y)
-SUB_DIRS += i2c
-MOD_SUB_DIRS += i2c
-else
-  ifeq ($(CONFIG_I2C),m)
-  MOD_SUB_DIRS += i2c
-  endif
-endif
-
-ifeq ($(CONFIG_ACPI),y)
-SUB_DIRS += acpi
-MOD_SUB_DIRS += acpi
-endif
+
+mod-subdirs := dio mtd sbus video macintosh usb input telephony sgi i2o ide \
+               scsi md ieee1394 pnp isdn atm fc4 net/hamradio i2c acpi
+
+subdir-y :=    block char net parport sound misc media cdrom
+subdir-m :=    $(subdir-y)
+
+
+subdir-$(CONFIG_DIO)           += dio
+subdir-$(CONFIG_PCI)           += pci
+subdir-$(CONFIG_PCMCIA)                += pcmcia
+subdir-$(CONFIG_MTD)           += mtd
+subdir-$(CONFIG_SBUS)          += sbus
+subdir-$(CONFIG_ZORRO)         += zorro
+subdir-$(CONFIG_NUBUS)         += nubus
+subdir-$(CONFIG_TC)            += tc
+subdir-$(CONFIG_VT)            += video
+subdir-$(CONFIG_MAC)           += macintosh
+subdir-$(CONFIG_ALL_PPC)       += macintosh
+subdir-$(CONFIG_USB)           += usb
+subdir-$(CONFIG_INPUT)         += input
+subdir-$(CONFIG_PHONE)         += telephony
+subdir-$(CONFIG_SGI)           += sgi
+subdir-$(CONFIG_I2O)           += i2o
+subdir-$(CONFIG_IDE)           += ide
+subdir-$(CONFIG_SCSI)          += scsi
+subdir-$(CONFIG_MD)            += md
+subdir-$(CONFIG_IEEE1394)      += ieee1394
+subdir-$(CONFIG_PNP)           += pnp
+subdir-$(CONFIG_ISDN)          += isdn
+subdir-$(CONFIG_ATM)           += atm
+subdir-$(CONFIG_FC4)           += fc4
+
+# CONFIG_HAMRADIO can be set without CONFIG_NETDEVICE being set  -- ch
+subdir-$(CONFIG_HAMRADIO)      += net/hamradio
+subdir-$(CONFIG_I2C)           += i2c
+subdir-$(CONFIG_ACPI)          += acpi
+
+
+# Subdirectories that should be entered when MAKING_MODULES=1, even if set to 'y'.
+both-m         := $(filter $(mod-subdirs), $(subdir-y))
+
+# Translate to Rules.make lists.
+SUB_DIRS       := $(subdir-y)
+MOD_SUB_DIRS   := $(sort $(subdir-m) $(both-m))
+ALL_SUB_DIRS   := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
+
+# net/hamradio is already in ALL_SUB_DIRS of drivers/net/Makefile
+ALL_SUB_DIRS   := $(filter-out net/hamradio, $(ALL_SUB_DIRS))
 
 include $(TOPDIR)/Rules.make
+
diff -uNr linux.orig/fs/Makefile linux/fs/Makefile
--- linux.orig/fs/Makefile      Wed Sep 27 16:21:44 2000
+++ linux/fs/Makefile   Wed Sep 27 16:34:28 2000
@@ -1,348 +1,91 @@
 #
 # Makefile for the Linux filesystems.
 #
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (not a .c file).
-#
-# Note 2! The CFLAGS definitions are now in the main makefile.
+# 14 Sep 2000, Christoph Hellwig <[EMAIL PROTECTED]>
+# Rewritten to use lists instead of if-statements.
+# 
 
-FILESYSTEMS = $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
 O_TARGET := fs.o
-O_OBJS    = open.o read_write.o devices.o file_table.o buffer.o \
+
+export-objs := filesystems.o
+mod-subdirs := nls
+
+obj-y :=       open.o read_write.o devices.o file_table.o buffer.o \
                super.o  block_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
                ioctl.o readdir.o select.o fifo.o locks.o \
                dcache.o inode.o attr.o bad_inode.o file.o iobuf.o dnotify.o \
-               $(BINFMTS) $(FILESYSTEMS)
-OX_OBJS := filesystems.o
-
-ALL_SUB_DIRS := coda minix ext2 fat msdos vfat proc isofs nfs umsdos ntfs \
-               hpfs sysv smbfs ncpfs ufs efs affs romfs autofs hfs lockd \
-               nfsd nls devpts devfs adfs partitions qnx4 udf bfs cramfs \
-               openpromfs autofs4 ramfs jffs
-
-SUB_DIRS :=
+               filesystems.o
 
 ifeq ($(CONFIG_QUOTA),y)
-O_OBJS += dquot.o
+obj­y += dquot.o
 else
-O_OBJS += noquot.o
-endif
-
-ifdef CONFIG_PROC_FS
-SUB_DIRS += proc
+obj-y += noquot.o
 endif
 
-SUB_DIRS += partitions
+subdir-$(CONFIG_PROC_FS)       += proc
+subdir-y                       += partitions
 
 # Do not add any filesystems before this line
+subdir-$(CONFIG_EXT2_FS)       += ext2
+subdir-$(CONFIG_CRAMFS)                += cramfs
+subdir-$(CONFIG_RAMFS)         += ramfs
+subdir-$(CONFIG_CODA_FS)       += coda
+subdir-$(CONFIG_MINIX_FS)      += minix
+subdir-$(CONFIG_FAT_FS)                += fat
+subdir-$(CONFIG_MSDOS_FS)      += msdos
+subdir-$(CONFIG_VFAT_FS)       += vfat
+subdir-$(CONFIG_BFS_FS)                += bfs
+subdir-$(CONFIG_ISO9660_FS)    += isofs
+subdir-$(CONFIG_DEVFS_FS)      += devfs
+subdir-$(CONFIG_HFS_FS)                += hfs
+subdir-$(CONFIG_NFS_FS)                += nfs
+subdir-$(CONFIG_NFSD)          += nfsd
+subdir-$(CONFIG_LOCKD)         += lockd
+subdir-$(CONFIG_NLS)           += nls
+subdir-$(CONFIG_UMSDOS_FS)     += umsdos
+subdir-$(CONFIG_SYSV_FS)       += sysv
+subdir-$(CONFIG_SMB_FS)                += smbfs
+subdir-$(CONFIG_NCP_FS)                += ncpfs
+subdir-$(CONFIG_HPFS_FS)       += hpfs
+subdir-$(CONFIG_NTFS_FS)       += ntfs
+subdir-$(CONFIG_UFS_FS)                += ufs
+subdir-$(CONFIG_EFS_FS)                += efs
+subdir-$(CONFIG_JFFS_FS)       += jffs
+subdir-$(CONFIG_AFFS_FS)       += affs
+subdir-$(CONFIG_ROMFS_FS)      += romfs
+subdir-$(CONFIG_QNX4FS_FS)     += qnx4
+subdir-$(CONFIG_UDF_FS)                += udf
+subdir-$(CONFIG_AUTOFS_FS)     += autofs
+subdir-$(CONFIG_AUTOFS4_FS)    += autofs4
+subdir-$(CONFIG_ADFS_FS)       += adfs
+subdir-$(CONFIG_DEVPTS_FS)     += devpts
+subdir-$(CONFIG_SUN_OPENPROMFS)        += openpromfs
+
+
+obj-$(CONFIG_BINFMT_AOUT)      += binfmt_aout.o
+obj-$(CONFIG_BINFMT_EM86)      += binfmt_em86.o
+obj-$(CONFIG_BINFMT_MISC)      += binfmt_misc.o
 
-ifeq ($(CONFIG_EXT2_FS),y)
-SUB_DIRS += ext2
-else
-  ifeq ($(CONFIG_EXT2_FS),m)
-  MOD_SUB_DIRS += ext2
-  endif
-endif
-
-ifeq ($(CONFIG_CRAMFS),y)
-SUB_DIRS += cramfs
-else
-  ifeq ($(CONFIG_CRAMFS),m)
-  MOD_SUB_DIRS += cramfs
-  endif
-endif
-
-ifeq ($(CONFIG_RAMFS),y)
-SUB_DIRS += ramfs
-else
-  ifeq ($(CONFIG_RAMFS),m)
-  MOD_SUB_DIRS += ramfs
-  endif
-endif
-
-ifeq ($(CONFIG_CODA_FS),y)
-SUB_DIRS += coda
-else
-  ifeq ($(CONFIG_CODA_FS),m)
-  MOD_SUB_DIRS += coda
-  endif
-endif
-
-ifeq ($(CONFIG_MINIX_FS),y)
-SUB_DIRS += minix
-else
-  ifeq ($(CONFIG_MINIX_FS),m)
-  MOD_SUB_DIRS += minix
-  endif
-endif
-
-ifeq ($(CONFIG_FAT_FS),y)
-SUB_DIRS += fat
-else
-  ifeq ($(CONFIG_FAT_FS),m)
-  MOD_SUB_DIRS += fat
-  endif
-endif
-
-ifeq ($(CONFIG_MSDOS_FS),y)
-SUB_DIRS += msdos
-else
-  ifeq ($(CONFIG_MSDOS_FS),m)
-  MOD_SUB_DIRS += msdos
-  endif
-endif
-
-ifeq ($(CONFIG_VFAT_FS),y)
-SUB_DIRS += vfat
-else
-  ifeq ($(CONFIG_VFAT_FS),m)
-  MOD_SUB_DIRS += vfat
-  endif
-endif
-
-ifeq ($(CONFIG_BFS_FS),y)
-SUB_DIRS += bfs
-else
-  ifeq ($(CONFIG_BFS_FS),m)
-  MOD_SUB_DIRS += bfs
-  endif
-endif
- 
-ifeq ($(CONFIG_ISO9660_FS),y)
-SUB_DIRS += isofs
-else
-  ifeq ($(CONFIG_ISO9660_FS),m)
-  MOD_SUB_DIRS += isofs
-  endif
-endif
-
-ifdef CONFIG_DEVFS_FS
-SUB_DIRS += devfs
-endif
-
-ifeq ($(CONFIG_HFS_FS),y)
-SUB_DIRS += hfs
-else
-  ifeq ($(CONFIG_HFS_FS),m)
-  MOD_SUB_DIRS += hfs
-  endif
-endif
-
-ifeq ($(CONFIG_NFS_FS),y)
-SUB_DIRS += nfs
-else
-  ifeq ($(CONFIG_NFS_FS),m)
-  MOD_SUB_DIRS += nfs
-  endif
-endif
-
-ifeq ($(CONFIG_NFSD),y)
-CONFIG_LOCKD := y
-SUB_DIRS += nfsd
-else
-  ifeq ($(CONFIG_NFSD),m)
-  MOD_SUB_DIRS += nfsd
-  endif
-endif
-
-ifeq ($(CONFIG_LOCKD),y)
-SUB_DIRS += lockd
-else
-  ifeq ($(CONFIG_LOCKD),m)
-  MOD_SUB_DIRS := lockd $(MOD_SUB_DIRS)
-  endif
-endif
-
-# Since CONFIG_NLS might be set to y while there are modules
-# to be build in the nls/ directory, we need to enter the nls
-# directory every time, but with different rules.
-ifeq ($(CONFIG_NLS),y)
-SUB_DIRS += nls
-MOD_IN_SUB_DIRS += nls
-else
-  ifeq ($(CONFIG_NLS),m)
-  MOD_SUB_DIRS += nls
-  endif
-endif
-
-ifeq ($(CONFIG_UMSDOS_FS),y)
-SUB_DIRS += umsdos
-else
-  ifeq ($(CONFIG_UMSDOS_FS),m)
-  MOD_SUB_DIRS += umsdos
-  endif
-endif
-
-ifeq ($(CONFIG_SYSV_FS),y)
-SUB_DIRS += sysv
-else
-  ifeq ($(CONFIG_SYSV_FS),m)
-  MOD_SUB_DIRS += sysv
-  endif
-endif
-
-ifeq ($(CONFIG_SMB_FS),y)
-SUB_DIRS += smbfs
-else
-  ifeq ($(CONFIG_SMB_FS),m)
-  MOD_SUB_DIRS += smbfs
-  endif
-endif
-
-ifeq ($(CONFIG_NCP_FS),y)
-SUB_DIRS += ncpfs
-else
-  ifeq ($(CONFIG_NCP_FS),m)
-  MOD_SUB_DIRS += ncpfs
-  endif
-endif
-
-ifeq ($(CONFIG_HPFS_FS),y)
-SUB_DIRS += hpfs
-else
-  ifeq ($(CONFIG_HPFS_FS),m)
-  MOD_SUB_DIRS += hpfs
-  endif
-endif
-
-ifeq ($(CONFIG_NTFS_FS),y)
-SUB_DIRS += ntfs
-else
-  ifeq ($(CONFIG_NTFS_FS),m)
-  MOD_SUB_DIRS += ntfs
-  endif
-endif
-
-ifeq ($(CONFIG_UFS_FS),y)
-SUB_DIRS += ufs
-else
-  ifeq ($(CONFIG_UFS_FS),m)
-  MOD_SUB_DIRS += ufs
-  endif
-endif
-
-ifeq ($(CONFIG_EFS_FS),y)
-SUB_DIRS += efs
-else
-  ifeq ($(CONFIG_EFS_FS),m)
-  MOD_SUB_DIRS += efs
-  endif
-endif
-
-ifeq ($(CONFIG_JFFS_FS),y)
-SUB_DIRS += jffs
-else
-  ifeq ($(CONFIG_JFFS_FS),m)
-  MOD_SUB_DIRS += jffs
-  endif
-endif
-
-ifeq ($(CONFIG_AFFS_FS),y)
-SUB_DIRS += affs
-else
-  ifeq ($(CONFIG_AFFS_FS),m)
-  MOD_SUB_DIRS += affs
-  endif
-endif
-
-ifeq ($(CONFIG_ROMFS_FS),y)
-SUB_DIRS += romfs
-else
-  ifeq ($(CONFIG_ROMFS_FS),m)
-  MOD_SUB_DIRS += romfs
-  endif
-endif
-
-ifeq ($(CONFIG_QNX4FS_FS),y)
-SUB_DIRS += qnx4
-else
-  ifeq ($(CONFIG_QNX4FS_FS),m)
-  MOD_SUB_DIRS += qnx4
-  endif
-endif
-
-ifeq ($(CONFIG_UDF_FS),y)
-SUB_DIRS += udf
-else
-  ifeq ($(CONFIG_UDF_FS),m)
-  MOD_SUB_DIRS += udf
-  endif
-endif
-
-ifeq ($(CONFIG_AUTOFS_FS),y)
-SUB_DIRS += autofs
-else
-  ifeq ($(CONFIG_AUTOFS_FS),m)
-  MOD_SUB_DIRS += autofs
-  endif
-endif
-
-ifeq ($(CONFIG_AUTOFS4_FS),y)
-SUB_DIRS += autofs4
-else
-  ifeq ($(CONFIG_AUTOFS4_FS),m)
-  MOD_SUB_DIRS += autofs4
-  endif
-endif
-
-ifeq ($(CONFIG_ADFS_FS),y)
-SUB_DIRS += adfs
-else
-  ifeq ($(CONFIG_ADFS_FS),m)
-  MOD_SUB_DIRS += adfs
-  endif
-endif
-
-ifeq ($(CONFIG_DEVPTS_FS),y)
-SUB_DIRS += devpts
-else
-  ifeq ($(CONFIG_DEVPTS_FS),m)
-  MOD_SUB_DIRS += devpts
-  endif
-endif
+# binfmt_script is always there
+obj-y                          += binfmt_script.o
 
-ifeq ($(CONFIG_SUN_OPENPROMFS),y)
-SUB_DIRS += openpromfs
-else
-  ifeq ($(CONFIG_SUN_OPENPROMFS),m)
-  MOD_SUB_DIRS += openpromfs
-  endif
-endif
+obj-$(CONFIG_BINFMT_ELF)       += binfmt_elf.o
 
-ifeq ($(CONFIG_BINFMT_AOUT),y)
-BINFMTS += binfmt_aout.o
-else
-  ifeq ($(CONFIG_BINFMT_AOUT),m)
-  M_OBJS += binfmt_aout.o
-  endif
-endif
+# persistent filesystems
+obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o))
 
-ifeq ($(CONFIG_BINFMT_EM86),y)
-BINFMTS += binfmt_em86.o
-else
-  ifeq ($(CONFIG_BINFMT_EM86),m)
-  M_OBJS += binfmt_em86.o
-  endif
-endif
 
-ifeq ($(CONFIG_BINFMT_MISC),y)
-BINFMTS += binfmt_misc.o
-else
-  ifeq ($(CONFIG_BINFMT_MISC),m)
-  M_OBJS += binfmt_misc.o
-  endif
-endif
+# Subdirectories that should be entered when MAKING_MODULES=1, even if set to 'y'.
+both-m         := $(filter $(mod-subdirs), $(subdir-y))
 
-# binfmt_script is always there
-BINFMTS += binfmt_script.o
+# Translate to Rules.make lists.
+O_OBJS         := $(filter-out $(export-objs), $(obj-y))
+OX_OBJS                := $(filter     $(export-objs), $(obj-y))
+M_OBJS         := $(sort $(filter-out  $(export-objs), $(obj-m)))
+MX_OBJS                := $(sort $(filter      $(export-objs), $(obj-m)))
 
-ifeq ($(CONFIG_BINFMT_ELF),y)
-BINFMTS += binfmt_elf.o
-else
-  ifeq ($(CONFIG_BINFMT_ELF),m)
-  M_OBJS += binfmt_elf.o
-  endif
-endif
+SUB_DIRS       := $(subdir-y)
+MOD_SUB_DIRS   := $(sort $(subdir-m) $(both-m))
+ALL_SUB_DIRS   := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
 
 include $(TOPDIR)/Rules.make
diff -uNr linux.orig/net/Makefile linux/net/Makefile
--- linux.orig/net/Makefile     Sun Aug  6 20:23:41 2000
+++ linux/net/Makefile  Wed Sep 27 16:34:38 2000
@@ -1,217 +1,70 @@
 #
 # Makefile for the linux networking.
 #
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
+# 2 Sep 2000, Christoph Hellwig <[EMAIL PROTECTED]>
+# Rewritten to use lists instead of if-statements.
 #
-# Note 2! The CFLAGS definition is now in the main makefile...
 
-MOD_SUB_DIRS := ipv4
-ALL_SUB_DIRS := 802 ax25 bridge core ethernet ipv4 ipv6 ipx unix appletalk \
-               netrom rose lapb x25 wanrouter netlink sched packet sunrpc \
-               econet irda decnet atm khttpd ipv4/netfilter ipv6/netfilter
-SUB_DIRS     := core ethernet
+O_TARGET :=    network.o
 
-ifeq ($(CONFIG_NET),y)
-SUB_DIRS += 802 sched
-endif
-
-ifeq ($(CONFIG_INET),y)
-SUB_DIRS += ipv4
-ifeq ($(CONFIG_NETFILTER),y)
-SUB_DIRS += ipv4/netfilter
-MOD_SUB_DIRS += ipv4/netfilter
-endif
-endif
-
-ifeq ($(CONFIG_UNIX),y)
-SUB_DIRS += unix
-else
-  ifeq ($(CONFIG_UNIX),m)
-  MOD_SUB_DIRS += unix
-  endif
-endif
-
-ifeq ($(CONFIG_IPV6),y)
-SUB_DIRS += ipv6
-ifeq ($(CONFIG_NETFILTER),y)
-SUB_DIRS += ipv6/netfilter
-MOD_SUB_DIRS += ipv6/netfilter
-endif
-else
-  ifeq ($(CONFIG_IPV6),m)
-  MOD_SUB_DIRS += ipv6
-  ifeq ($(CONFIG_NETFILTER),y)
-  MOD_SUB_DIRS += ipv6/netfilter
-  endif
-  endif
-endif
-
-ifeq ($(CONFIG_KHTTPD),y)
-SUB_DIRS += khttpd
-else
-  ifeq ($(CONFIG_KHTTPD),m)
-  MOD_SUB_DIRS += khttpd
-  endif
-endif
-
-ifeq ($(CONFIG_NETLINK),y)
-SUB_DIRS += netlink
-  ifeq ($(CONFIG_NETLINK_DEV),m)
-    MOD_SUB_DIRS += netlink
-  endif
-endif
-
-ifeq ($(CONFIG_PACKET),y)
-SUB_DIRS += packet
-else
-  ifeq ($(CONFIG_PACKET),m)
-    MOD_SUB_DIRS += packet
-  endif
-endif
-
-ifeq ($(CONFIG_NET_SCHED),y)
-  MOD_SUB_DIRS += sched
-endif
-
-ifeq ($(CONFIG_BRIDGE),y)
-SUB_DIRS += bridge
-else
-  ifeq ($(CONFIG_BRIDGE),m)
-    MOD_SUB_DIRS += bridge
-  endif
-endif
-
-ifeq ($(CONFIG_IPX),y)
-SUB_DIRS += ipx
-# SPX can be still a module
-MOD_SUB_DIRS += ipx
-else
-  ifeq ($(CONFIG_IPX),m)
-  MOD_SUB_DIRS += ipx
-  endif
-endif
-
-ifeq ($(CONFIG_ATALK),y)
-SUB_DIRS += appletalk
-else
-  ifeq ($(CONFIG_ATALK),m)
-  MOD_SUB_DIRS += appletalk
-  endif
-endif
-
-ifeq ($(CONFIG_WAN_ROUTER),y)
-SUB_DIRS += wanrouter
-else
-  ifeq ($(CONFIG_WAN_ROUTER),m)
-  MOD_SUB_DIRS += wanrouter
-  endif
-endif
+mod-subdirs := ipv4/netfilter ipv6/netfilter ipx irda atm
+export-objs := netsyms.o
 
-ifeq ($(CONFIG_X25),y)
-SUB_DIRS += x25
-else
-  ifeq ($(CONFIG_X25),m)
-  MOD_SUB_DIRS += x25
-  endif
-endif
-
-ifeq ($(CONFIG_LAPB),y)
-SUB_DIRS += lapb
-else
-  ifeq ($(CONFIG_LAPB),m)
-  MOD_SUB_DIRS += lapb
-  endif
-endif
+subdir-y :=    core ethernet
+subdir-m :=    ipv4 # hum?
 
-ifeq ($(CONFIG_NETROM),y)
-SUB_DIRS += netrom
-else
-  ifeq ($(CONFIG_NETROM),m)
-  MOD_SUB_DIRS += netrom
-  endif
-endif
 
-ifeq ($(CONFIG_ROSE),y)
-SUB_DIRS += rose
-else
-  ifeq ($(CONFIG_ROSE),m)
-  MOD_SUB_DIRS += rose
-  endif
+subdir-$(CONFIG_NET)           += 802 sched
+subdir-$(CONFIG_INET)          += ipv4
+subdir-$(CONFIG_NETFILTER)     += ipv4/netfilter
+subdir-$(CONFIG_UNIX)          += unix
+subdir-$(CONFIG_IPV6)          += ipv6
+
+ifneq ($(CONFIG_IPV6),n)
+ifneq ($(CONFIG_IPV6),)
+subdir-$(CONFIG_NETFILTER)     += ipv6/netfilter
 endif
-
-ifeq ($(CONFIG_AX25),y)
-SUB_DIRS += ax25
-else
-  ifeq ($(CONFIG_AX25),m)
-  MOD_SUB_DIRS += ax25
-  endif
 endif
 
-ifeq ($(CONFIG_IRDA),y)
-SUB_DIRS += irda
-# There might be some irda features that are compiled as modules
-MOD_IN_SUB_DIRS += irda
-else
-  ifeq ($(CONFIG_IRDA),m)
-  MOD_SUB_DIRS += irda
-  endif
-endif
+subdir-$(CONFIG_KHTTPD)                += khttpd
+subdir-$(CONFIG_NETLINK)       += netlink
+subdir-$(CONFIG_PACKET)                += packet
+subdir-$(CONFIG_NET_SCHED)     += sched
+subdir-$(CONFIG_BRIDGE)                += bridge
+subdir-$(CONFIG_IPX)           += ipx
+subdir-$(CONFIG_ATALK)         += appletalk
+subdir-$(CONFIG_WAN_ROUTER)    += wanrouter
+subdir-$(CONFIG_X25)           += x25
+subdir-$(CONFIG_LAPB)          += lapb
+subdir-$(CONFIG_NETROM)                += netrom
+subdir-$(CONFIG_ROSE)          += rose
+subdir-$(CONFIG_AX25)          += ax25
+subdir-$(CONFIG_IRDA)          += irda
+subdir-$(CONFIG_SUNRPC)                += sunrpc
+subdir-$(CONFIG_ATM)           += atm
+subdir-$(CONFIG_DECNET)                += decnet
+subdir-$(CONFIG_ECONET)                += econet
 
-ifeq ($(CONFIG_SUNRPC),y)
-SUB_DIRS += sunrpc
-else
-  ifeq ($(CONFIG_SUNRPC),m)
-  MOD_SUB_DIRS += sunrpc
-  endif
-endif
 
-ifeq ($(CONFIG_ATM),y)
-SUB_DIRS += atm
-ifeq ($(CONFIG_ATM_LANE),m)
-  MOD_ATM = atm
-endif
-ifeq ($(CONFIG_ATM_MPOA),m)
-  MOD_ATM = atm
-endif
-MOD_SUB_DIRS += $(MOD_ATM)
+obj-y  := socket.o protocols.o $(join $(subdir-y), $(patsubst %,/%.o,$(notdir 
+$(subdir-y))))
+ifeq ($(CONFIG_NET),y)
+obj-$(CONFIG_MODULES)          += netsyms.o
+obj-$(CONFIG_SYSCTL)           += sysctl_net.o
 endif
 
-ifeq ($(CONFIG_DECNET),y)
-SUB_DIRS += decnet
-else
-  ifeq ($(CONFIG_DECNET),m)
-  MOD_SUB_DIRS += decnet
-  endif
-endif
 
-ifeq ($(CONFIG_ECONET),y)
-SUB_DIRS += econet
-else
-  ifeq ($(CONFIG_ECONET),m)
-  MOD_SUB_DIRS += econet
-  endif
-endif
+# Subdirectories that should be entered when MAKING_MODULES=1, even if set to 'y'.
+both-m         := $(filter $(mod-subdirs), $(subdir-y))
 
-# We must attach netsyms.o to socket.o, as otherwise there is nothing
-# to pull the object file from the archive.
+# Translate to Rules.make lists.
+O_OBJS         := $(filter-out $(export-objs), $(obj-y))
+OX_OBJS                := $(filter     $(export-objs), $(obj-y))
+M_OBJS         := $(sort $(filter-out  $(export-objs), $(obj-m)))
+MX_OBJS                := $(sort $(filter      $(export-objs), $(obj-m)))
 
-ifeq ($(CONFIG_NET),y)
-ifeq ($(CONFIG_MODULES),y)
-OX_OBJS      := netsyms.o
-endif
-endif
+SUB_DIRS       := $(subdir-y)
+MOD_SUB_DIRS   := $(sort $(subdir-m) $(both-m))
+ALL_SUB_DIRS   := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
 
-O_TARGET     := network.o
-O_OBJS      := socket.o protocols.o $(join $(SUB_DIRS), $(patsubst %,/%.o,$(notdir 
$(SUB_DIRS))))
-
-M_OBJS      :=
-
-ifeq ($(CONFIG_SYSCTL),y)
-ifeq ($(CONFIG_NET),y)
-O_OBJS += sysctl_net.o
-endif
-endif
 
 include $(TOPDIR)/Rules.make
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to