patch-2.3.38 linux/drivers/usb/Makefile

Next file: linux/drivers/usb/acm.c
Previous file: linux/drivers/usb/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.37/linux/drivers/usb/Makefile linux/drivers/usb/Makefile
@@ -2,233 +2,114 @@
 # Makefile for the kernel USB device drivers.
 #
 
-SUB_DIRS     :=
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
-
-L_TARGET := usb.a
-MOD_LIST_NAME := USB_MODULES
-
-ifeq ($(CONFIG_USB),y)
-  L_OBJS += usb-debug.o usb-core.o hub.o
-  LX_OBJS += usb.o
-  ifeq ($(CONFIG_USB_PROC),y)
-    L_OBJS += proc_usb.o
-  endif
-endif
-ifeq ($(CONFIG_USB),m)
-  M_OBJS += usbcore.o
-  MI_OBJS += usb-debug.o usb-core.o hub.o
-  MIX_OBJS += usb.o
-  ifeq ($(CONFIG_USB_PROC),y)
-    MI_OBJS += proc_usb.o
-  endif
-endif
-
-ifeq ($(CONFIG_USB_UHCI),y)
-    L_OBJS += uhci.o uhci-debug.o
-endif
-
-ifeq ($(CONFIG_USB_UHCI),m)
-      M_OBJS += usb-uhci.o
-      MI_OBJS += uhci.o uhci-debug.o
-endif
-
-ifeq ($(CONFIG_USB_OHCI_HCD),y)
-    L_OBJS += ohci-hcd.o
-endif
-ifeq ($(CONFIG_USB_OHCI_HCD),m)
-      M_OBJS += usb-ohci-hcd.o
-      MI_OBJS += ohci-hcd.o
-endif
-
-ifeq ($(CONFIG_USB_SCANNER),y)
-  L_OBJS += scanner.o
-endif
-ifeq ($(CONFIG_USB_SCANNER),m)
-  M_OBJS  +=scanner.o
-endif
-
-ifeq ($(CONFIG_USB_ACM),y)
-  L_OBJS += acm.o
-endif
-ifeq ($(CONFIG_USB_ACM),m)
-  M_OBJS += acm.o
-endif
-
-ifeq ($(CONFIG_USB_PRINTER),y)
-  L_OBJS += printer.o
-endif
-
-ifeq ($(CONFIG_USB_PRINTER),m)
-  M_OBJS += printer.o
-endif
-
-ifeq ($(CONFIG_USB_SERIAL),y)
-  L_OBJS += usb-serial.o
-endif
-
-ifeq ($(CONFIG_USB_SERIAL),m)
-  M_OBJS += usb-serial.o
-endif
-
-ifeq ($(CONFIG_USB_AUDIO),y)
-  L_OBJS += audio.o
-endif
-
-ifeq ($(CONFIG_USB_AUDIO),m)
-  M_OBJS += audio.o
-endif
-
-ifeq ($(CONFIG_USB_CPIA),y)
-  L_OBJS += cpia.o
-endif
-
-ifeq ($(CONFIG_USB_CPIA),m)
-  M_OBJS += cpia.o
-endif
-
-ifeq ($(CONFIG_USB_OV511),y)
-  L_OBJS += ov511.o
-endif
-
-ifeq ($(CONFIG_USB_OV511),m)
-  M_OBJS += ov511.o
-endif
-
-ifeq ($(CONFIG_USB_DC2XX),y)
-  L_OBJS += dc2xx.o
-endif
-ifeq ($(CONFIG_USB_DC2XX),m)
-  M_OBJS += dc2xx.o
-endif
+# Subdirs.
 
-ifeq ($(CONFIG_USB_SCSI),y)
-  L_OBJS += usb_scsi.o
-  ifeq ($(CONFIG_USB_SCSI_DEBUG),y)
-    L_OBJS += usb_scsi_debug.o
-  endif
-endif
-
-ifeq ($(CONFIG_USB_SCSI),m)
-  M_OBJS += usb-scsi.o
-  MI_OBJS += usb_scsi.o
-  ifeq ($(CONFIG_USB_SCSI_DEBUG),y)
-    MI_OBJS += usb_scsi_debug.o
-  endif
-endif
-
-ifeq ($(CONFIG_USB_EZUSB),y)
-  L_OBJS += ezusb.o
-endif
-
-ifeq ($(CONFIG_USB_EZUSB),m)
-  M_OBJS += ezusb.o
-endif
-
-ifeq ($(CONFIG_USB_HID),y)
-  L_OBJS += hid.o
-  ILX_OBJS := input.o
-endif
-
-ifeq ($(CONFIG_USB_HID),m)
-  M_OBJS += hid.o
-  IMX_OBJS := input.o
-endif
-
-ifeq ($(CONFIG_USB_KBD),y)
-  L_OBJS += usbkbd.o
-  ILX_OBJS := input.o
-endif
-
-ifeq ($(CONFIG_USB_KBD),m)
-  M_OBJS += usbkbd.o
-  IMX_OBJS := input.o
-endif
-
-ifeq ($(CONFIG_USB_MOUSE),y)
-  L_OBJS += usbmouse.o
-  ILX_OBJS := input.o
-endif
-
-ifeq ($(CONFIG_USB_MOUSE),m)
-  M_OBJS += usbmouse.o
-  IMX_OBJS := input.o
-endif
+SUB_DIRS	:=
+MOD_SUB_DIRS	:= $(SUB_DIRS)
+ALL_SUB_DIRS	:= $(SUB_DIRS)
 
-LX_OBJS += $(ILX_OBJS)
-MX_OBJS += $(IMX_OBJS)
+# The target object and module list name.
 
-ifeq ($(CONFIG_INPUT_KEYBDEV),y)
-  L_OBJS += keybdev.o
-endif
+O_TARGET	:= usbdrv.o
+M_OBJS		:=
+O_OBJS		:=
+MOD_LIST_NAME	:= USB_MODULES
 
-ifeq ($(CONFIG_INPUT_KEYBDEV),m)
-  M_OBJS += keybdev.o
-endif
+# Objects that export symbols.
 
-ifeq ($(CONFIG_INPUT_MOUSEDEV),y)
-  L_OBJS += mousedev.o
-endif
-
-ifeq ($(CONFIG_INPUT_MOUSEDEV),m)
-  M_OBJS += mousedev.o
-endif
+export-objs		:= usb.o input.o
 
-ifeq ($(CONFIG_INPUT_JOYDEV),y)
-  L_OBJS += joydev.o
-endif
+# Multipart objects.
 
-ifeq ($(CONFIG_INPUT_JOYDEV),m)
-  M_OBJS += joydev.o
-endif
+list-multi		:= usbcore.o usb-uhci.o usb-ohci-hcd.o
+usbcore-objs		:= usb.o usb-debug.o usb-core.o hub.o
+usb-uhci-objs		:= uhci.o uhci-debug.o
+usb-ohci-hcd-objs	:= ohci-hcd.o
+usb-scsi-objs		:= usb_scsi.o
 
-ifeq ($(CONFIG_INPUT_EVDEV),y)
-  L_OBJS += evdev.o
-endif
+# Optional parts of multipart objects.
 
-ifeq ($(CONFIG_INPUT_EVDEV),m)
-  M_OBJS += evdev.o
+ifeq ($(CONFIG_USB_PROC),y)
+	usbcore-objs	+= proc_usb.o
 endif
-
-ifeq ($(CONFIG_USB_USS720),y)
-  L_OBJS += uss720.o
+ifeq ($(CONFIG_USB_SCSI_DEBUG),y)
+	usb-scsi-objs	+= usb_scsi_debug.o
 endif
 
-ifeq ($(CONFIG_USB_USS720),m)
-  M_OBJS += uss720.o
-endif
+# Object file lists.
 
-ifeq ($(CONFIG_USB_DABUSB),y)
-  L_OBJS += dabusb.o
-endif
+obj-y	:=
+obj-m	:=
+obj-n	:=
+obj-	:=
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_USB)		+= usbcore.o
+obj-$(CONFIG_USB_UHCI)		+= usb-uhci.o
+obj-$(CONFIG_USB_OHCI_HCD)	+= usb-ohci-hcd.o
+
+obj-$(CONFIG_USB_MOUSE)		+= usbmouse.o input.o
+obj-$(CONFIG_USB_HID)		+= hid.o input.o
+obj-$(CONFIG_USB_KBD)		+= usbkbd.o input.o
+obj-$(CONFIG_INPUT_KEYBDEV)	+= keybdev.o input.o
+obj-$(CONFIG_INPUT_MOUSEDEV)	+= mousedev.o input.o
+obj-$(CONFIG_INPUT_JOYDEV)	+= joydev.o input.o
+obj-$(CONFIG_INPUT_EVDEV)	+= evdev.o input.o
+
+obj-$(CONFIG_USB_SCANNER)	+= scanner.o
+obj-$(CONFIG_USB_ACM)		+= acm.o
+obj-$(CONFIG_USB_PRINTER)	+= printer.o
+obj-$(CONFIG_USB_SERIAL)	+= usb-serial.o
+obj-$(CONFIG_USB_AUDIO)		+= audio.o
+obj-$(CONFIG_USB_CPIA)		+= cpia.o
+obj-$(CONFIG_USB_DC2XX)		+= dc2xx.o
+obj-$(CONFIG_USB_SCSI)		+= usb-scsi.o
+obj-$(CONFIG_USB_EZUSB)		+= ezusb.o
+obj-$(CONFIG_USB_USS720)	+= uss720.o
+obj-$(CONFIG_USB_DABUSB)	+= dabusb.o
+obj-$(CONFIG_USB_OV511)		+= ov511.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)))
+
+# Files that are both resident and modular: remove from modular.
+
+obj-m		:= $(filter-out $(obj-y), $(obj-m))
+int-m		:= $(filter-out $(int-y), $(int-m))
+
+# 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)))
+MI_OBJS		:= $(sort $(filter-out $(export-objs), $(int-m)))
+MIX_OBJS	:= $(sort $(filter     $(export-objs), $(int-m)))
 
-ifeq ($(CONFIG_USB_DABUSB),m)
-  M_OBJS += dabusb.o
-endif
+# The global Rules.make.
 
 include $(TOPDIR)/Rules.make
 
-ifeq ($(CONFIG_USB_SCSI_DEBUG),y)
-usb-scsi.o: usb_scsi.o usb_scsi_debug.o
-	$(LD) $(LD_RFLAG) -r -o $@  usb_scsi.o usb_scsi_debug.o 
-else
-usb-scsi.o: usb_scsi.o
-	$(LD) $(LD_RFLAG) -r -o $@  usb_scsi.o
-endif
+# Link rules for multi-part drivers.
 
-usb-uhci.o: uhci.o uhci-debug.o 
-	$(LD) $(LD_RFLAG) -r -o $@  uhci.o uhci-debug.o 
+usbcore.o: $(usbcore-objs)
+	$(LD) -r -o $@ $(usbcore-objs)
 
-usb-ohci-hcd.o: ohci-hcd.o
-	$(LD) $(LD_RFLAG) -r -o $@ ohci-hcd.o
+usb-uhci.o: $(usb-uhci-objs)
+	$(LD) -r -o $@ $(usb-uhci-objs)
 
-ifeq ($(CONFIG_USB_PROC),y)
-usbcore.o: usb.o usb-debug.o usb-core.o proc_usb.o hub.o
-	$(LD) $(LD_RFLAG) -r -o $@ usb.o usb-debug.o usb-core.o proc_usb.o \
-	hub.o
-else
-usbcore.o: usb.o usb-debug.o usb-core.o hub.o
-	$(LD) $(LD_RFLAG) -r -o $@ usb.o usb-debug.o usb-core.o \
-	hub.o
-endif
+usb-ohci-hcd.o: $(usb-ohci-hcd-objs)
+	$(LD) -r -o $@ $(usb-ohci-hcd-objs)
+
+usb-scsi.o: $(usb-scsi-objs)
+	$(LD) -r -o $@ $(usb-scsi-objs)

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