patch-2.4.0-test2 linux/drivers/block/Makefile

Next file: linux/drivers/block/acsi_slm.c
Previous file: linux/drivers/block/DAC960.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/block/Makefile linux/drivers/block/Makefile
@@ -1,15 +1,9 @@
 #
 # Makefile for the kernel block 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 (ie not a .c file).
-#
-# Note 2! The CFLAGS definition is now inherited from the
-# parent makefile.
-#
-
-#
+# 12 June 2000, Christoph Hellwig <schch@pe.tu-clausthal.de>
+# Rewritten to use lists instead of if-statements.
+# 
 # Note : at this point, these files are compiled on all systems.
 # In the future, some of these should be built conditionally.
 #
@@ -18,172 +12,45 @@
 MOD_SUB_DIRS := $(SUB_DIRS)
 ALL_SUB_DIRS := $(SUB_DIRS) paride
 
+O_TARGET := block.o
+MOD_LIST_NAME	:= BLOCK_MODULES
 
-L_TARGET := block.a
-L_OBJS   := genhd.o elevator.o
-M_OBJS   :=
-MOD_LIST_NAME := BLOCK_MODULES
-LX_OBJS := ll_rw_blk.o blkpg.o
-MX_OBJS :=
-
-ifeq ($(CONFIG_MAC_FLOPPY),y)
-L_OBJS += swim3.o
-endif
-
-ifeq ($(CONFIG_BLK_DEV_FD),y)
-L_OBJS += floppy.o
-else
-  ifeq ($(CONFIG_BLK_DEV_FD),m)
-  M_OBJS += floppy.o
-  endif
-endif
-
-ifeq ($(CONFIG_AMIGA_FLOPPY),y)
-  L_OBJS += amiflop.o
-else
-  ifeq ($(CONFIG_AMIGA_FLOPPY),m)
-    M_OBJS += amiflop.o
-  endif
-endif
-
-ifeq ($(CONFIG_ATARI_FLOPPY),y)
-  L_OBJS += ataflop.o
-else
-  ifeq ($(CONFIG_ATARI_FLOPPY),m)
-  M_OBJS += ataflop.o
-  endif
-endif
-
-ifeq ($(CONFIG_BLK_DEV_SWIM_IOP),y)
-  L_OBJS += swim_iop.o
-endif
-
-ifeq ($(CONFIG_ATARI_ACSI),y)
-  LX_OBJS += acsi.o
-else
-  ifeq ($(CONFIG_ATARI_ACSI),m)
-  MX_OBJS += acsi.o
-  endif
-endif
-
-ifeq ($(CONFIG_ATARI_SLM),y)
-  L_OBJS += acsi_slm.o
-else
-  ifeq ($(CONFIG_ATARI_SLM),m)
-  M_OBJS += acsi_slm.o
-  endif
-endif
-
-ifeq ($(CONFIG_AMIGA_Z2RAM),y)
-L_OBJS += z2ram.o
-else
-  ifeq ($(CONFIG_AMIGA_Z2RAM),m)
-  M_OBJS += z2ram.o
-  endif
-endif
 
-ifeq ($(CONFIG_BLK_DEV_RAM),y)
-L_OBJS += rd.o
-else
-  ifeq ($(CONFIG_BLK_DEV_RAM),m)
-  M_OBJS += rd.o
-  endif
-endif
+export-objs	:= ll_rw_blk.o blkpg.o loop.o DAC960.o md.o xor.o
+list-multi	:= lvm-mod.o
+lvm-mod-objs	:= lvm.o lvm-snap.o
+
+obj-y	:= ll_rw_blk.o blkpg.o genhd.o elevator.o
+
+obj-$(CONFIG_MAC_FLOPPY)	+= swim3.o
+obj-$(CONFIG_BLK_DEV_FD)	+= floppy.o
+obj-$(CONFIG_AMIGA_FLOPPY)	+= amiflop.o
+obj-$(CONFIG_ATARI_FLOPPY)	+= ataflop.o
+obj-$(CONFIG_BLK_DEV_SWIM_IOP)	+= swim_iop.o
+obj-$(CONFIG_ATARI_ACSI)	+= acsi.o
+obj-$(CONFIG_ATARI_SLM)		+= acsi_slm.o
+obj-$(CONFIG_AMIGA_Z2RAM)	+= z2ram.o
+obj-$(CONFIG_BLK_DEV_RAM)	+= rd.o
+obj-$(CONFIG_BLK_DEV_LOOP)	+= loop.o
+obj-$(CONFIG_BLK_DEV_PS2)	+= ps2esdi.o
+obj-$(CONFIG_BLK_DEV_XD)	+= xd.o
+obj-$(CONFIG_BLK_CPQ_DA)	+= cpqarray.o
+obj-$(CONFIG_BLK_DEV_DAC960)	+= DAC960.o
+obj-$(CONFIG_BLK_DEV_LVM)	+= lvm-mod.o
+
+obj-$(CONFIG_BLK_DEV_MD)	+= md.o
+obj-$(CONFIG_MD_LINEAR)		+= linear.o
+obj-$(CONFIG_MD_RAID0)		+= raid0.o
+obj-$(CONFIG_MD_RAID1)		+= raid1.o
 
-ifeq ($(CONFIG_BLK_DEV_LOOP),y)
-LX_OBJS += loop.o
+ifeq ($(CONFIG_MD_RAID5),m)
+	obj-y += xor.o
 else
-  ifeq ($(CONFIG_BLK_DEV_LOOP),m)
-  MX_OBJS += loop.o
-  endif
+	obj-$(CONFIG_MD_RAID5)	+= xor.o
 endif
+obj-$(CONFIG_MD_RAID5)		+= raid5.o
 
-ifeq ($(CONFIG_BLK_DEV_PS2),y)
-L_OBJS += ps2esdi.o
-else
-  ifeq ($(CONFIG_BLK_DEV_PS2),m)
-  M_OBJS += ps2esdi.o
-  endif
-endif
-
-ifeq ($(CONFIG_BLK_DEV_XD),y)
-L_OBJS += xd.o
-else
-  ifeq ($(CONFIG_BLK_DEV_XD),m)
-  M_OBJS += xd.o
-  endif
-endif
-
-ifeq ($(CONFIG_BLK_CPQ_DA),y)
-L_OBJS += cpqarray.o
-else
-  ifeq ($(CONFIG_BLK_CPQ_DA),m)
-  M_OBJS += cpqarray.o
-  endif
-endif
-
-ifeq ($(CONFIG_BLK_DEV_DAC960),y)
-LX_OBJS += DAC960.o
-else
-  ifeq ($(CONFIG_BLK_DEV_DAC960),m)
-  MX_OBJS += DAC960.o
-  endif
-endif
-
-ifeq ($(CONFIG_BLK_DEV_LVM),y)
-L_OBJS += lvm.o lvm-snap.o
-else
-   ifeq ($(CONFIG_BLK_DEV_LVM),m)
-   M_OBJS += lvm-mod.o
-   endif
-endif
-
-ifeq ($(CONFIG_BLK_DEV_MD),y)
-LX_OBJS += md.o
-
-ifeq ($(CONFIG_MD_LINEAR),y)
-L_OBJS += linear.o
-else
-  ifeq ($(CONFIG_MD_LINEAR),m)
-  M_OBJS += linear.o
-  endif
-endif
-
-ifeq ($(CONFIG_MD_RAID0),y)
-L_OBJS += raid0.o
-else
-  ifeq ($(CONFIG_MD_RAID0),m)
-  M_OBJS += raid0.o
-  endif
-endif
-
-ifeq ($(CONFIG_MD_RAID1),y)
-L_OBJS += raid1.o
-else
-  ifeq ($(CONFIG_MD_RAID1),m)
-  M_OBJS += raid1.o
-  endif
-endif
-
-ifeq ($(CONFIG_MD_RAID5),y)
-LX_OBJS += xor.o
-L_OBJS += raid5.o
-else
-  ifeq ($(CONFIG_MD_RAID5),m)
-  LX_OBJS += xor.o
-  M_OBJS += raid5.o
-  endif
-endif
-
-endif
-
-ifeq ($(CONFIG_BLK_DEV_NBD),y)
-L_OBJS += nbd.o
-else
-  ifeq ($(CONFIG_BLK_DEV_NBD),m)
-  M_OBJS += nbd.o
-  endif
-endif
+obj-$(CONFIG_BLK_DEV_NBD)	+= nbd.o
 
 ifeq ($(CONFIG_PARIDE),y)
 SUB_DIRS	+= paride
@@ -194,7 +61,24 @@
   endif
 endif
 
+
+# Extract lists of the multi-part drivers.
+# The 'int-*' lists are the intermediate files used to build the multi's.
+multi-y		:= $(filter $(list-multi), $(obj-y))
+multi-m		:= $(filter $(list-multi), $(obj-m))
+int-y		:= $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
+int-m		:= $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
+
+# Take multi-part drivers out of obj-y and put components in.
+obj-y		:= $(filter-out $(list-multi), $(obj-y)) $(int-y)
+
+# 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)))
+
 include $(TOPDIR)/Rules.make
 
-lvm-mod.o:	lvm.o lvm-snap.o
-	$(LD) -r -o $@ lvm.o lvm-snap.o
+lvm-mod.o: $(lvm-mod-objs)
+	$(LD) -r -o $@ $(lvm-mod-objs)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)