patch-2.4.0-test10 linux/drivers/parport/Makefile

Next file: linux/drivers/parport/parport_mfc3.c
Previous file: linux/drivers/net/wd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test9/linux/drivers/parport/Makefile linux/drivers/parport/Makefile
@@ -1,101 +1,51 @@
 #
-# Makefile for the kernel miscellaneous drivers.
+# Makefile for the kernel Parallel port 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! Parport is the Borg.  We have assimilated some other
+# drivers in the `char', `net' and `scsi' directories,
+# but left them there to allay suspicion.
 #
-# Note 2! The CFLAGS definitions are now inherited from the
-# parent makes..
+# 7 October 2000, Bartlomiej Zolnierkiewicz <bkz@linux-ide.org>
+# Rewritten to use lists instead of if-statements.
 #
-# Note 3! Parport is the Borg.  We have assimilated some other
-# drivers in the `char', `net' and `scsi' directories, but left them
-# there to allay suspicion.
-
-SUB_DIRS     := 
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
 
 L_TARGET := parport.a
-MX_OBJS  :=
-LX_OBJS  := 
-MI_OBJS  :=
-MIX_OBJS :=
-
-ifeq ($(CONFIG_PARPORT),y)
-  L_OBJS += share.o ieee1284.o ieee1284_ops.o procfs.o
-
-  ifeq ($(CONFIG_PARPORT_1284),y)
-    L_OBJS += daisy.o probe.o
-  endif
-
-  ifeq ($(CONFIG_PARPORT_PC),y)
-    LX_OBJS += parport_pc.o
-  else
-    ifeq ($(CONFIG_PARPORT_PC),m)
-      MX_OBJS += parport_pc.o
-    endif
-  endif
-  ifeq ($(CONFIG_PARPORT_AMIGA),y)
-    LX_OBJS += parport_amiga.o
-  else
-    ifeq ($(CONFIG_PARPORT_AMIGA),m)
-      M_OBJS += parport_amiga.o
-    endif
-  endif
-  ifeq ($(CONFIG_PARPORT_MFC3),y)
-    LX_OBJS += parport_mfc3.o
-  else
-    ifeq ($(CONFIG_PARPORT_MFC3),m)
-      M_OBJS += parport_mfc3.o
-    endif
-  endif
-  ifeq ($(CONFIG_PARPORT_ATARI),y)
-    LX_OBJS += parport_atari.o
-  else
-    ifeq ($(CONFIG_PARPORT_ATARI),m)
-      M_OBJS += parport_atari.o
-    endif
-  endif
-  ifeq ($(CONFIG_PARPORT_SUNBPP),y)
-    LX_OBJS += parport_sunbpp.o
-  else
-    ifeq ($(CONFIG_PARPORT_SUNBPP),m)
-      MX_OBJS += parport_sunbpp.o
-    endif
-  endif
-  LX_OBJS += init.o
-else
-  ifeq ($(CONFIG_PARPORT),m)
-    MI_OBJS += share.o ieee1284.o ieee1284_ops.o
-    ifeq ($(CONFIG_PARPORT_1284),y)
-      MI_OBJS += daisy.o probe.o
-    endif
-    ifneq ($(CONFIG_PROC_FS),n) 
-      MI_OBJS += procfs.o
-    endif
-    MIX_OBJS += init.o
-    M_OBJS += parport.o
-  endif
-  ifeq ($(CONFIG_PARPORT_PC),m)
-    MX_OBJS += parport_pc.o
-  endif
-  ifeq ($(CONFIG_PARPORT_AMIGA),m)
-    M_OBJS += parport_amiga.o
-  endif
-  ifeq ($(CONFIG_PARPORT_MFC3),m)
-    M_OBJS += parport_mfc3.o
-  endif
-  ifeq ($(CONFIG_PARPORT_ATARI),m)
-    M_OBJS += parport_atari.o
-  endif
-  ifeq ($(CONFIG_PARPORT_SUNBPP),m)
-    M_OBJS += parport_sunbpp.o
-  endif
+
+export-objs	:= init.o parport_pc.o
+
+list-multi	:= parport.o
+parport-objs	:= share.o ieee1284.o ieee1284_ops.o init.o procfs.o
+
+ifeq ($(CONFIG_PARPORT_1284),y)
+	parport-objs	+= daisy.o probe.o
 endif
 
+obj-$(CONFIG_PARPORT)		+= parport.o
+obj-$(CONFIG_PARPORT_PC)	+= parport_pc.o
+obj-$(CONFIG_PARPORT_AMIGA)	+= parport_amiga.o
+obj-$(CONFIG_PARPORT_MFC3)	+= parport_mfc3.o
+obj-$(CONFIG_PARPORT_ATARI)	+= parport_atari.o
+obj-$(CONFIG_PARPORT_SUNBPP)	+= parport_sunbpp.o
+
+# 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.
+L_OBJS		:= $(filter-out $(export-objs), $(obj-y))
+LX_OBJS		:= $(filter	$(export-objs), $(obj-y))
+M_OBJS		:= $(sort $(filter-out	$(export-objs), $(obj-m)))
+MX_OBJS		:= $(sort $(filter	$(export-objs), $(obj-m)))
+MI_OBJS		:= $(sort $(filter-out	$(export-objs), $(int-m)))
+MIX_OBJS	:= $(sort $(filter	$(export-objs), $(int-m)))
+
 include $(TOPDIR)/Rules.make
 
-# Special rule to build the composite parport.o module
-parport.o: $(MI_OBJS) $(MIX_OBJS)
-	$(LD) $(LD_RFLAG) -r -o $@ $(MI_OBJS) $(MIX_OBJS)
+parport.o: $(parport-objs)
+	$(LD) -r -o $@ $(parport-objs)

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