summaryrefslogtreecommitdiff
path: root/linux/Makefile.kernel
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2000-09-06 12:11:57 +0000
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2000-09-06 12:11:57 +0000
commit68380d1373cf7b01a6ae5c9440de7a52745af091 (patch)
tree42c623666b8746dae59e7ed2423a19ebaa68b9cd /linux/Makefile.kernel
parenta2020a33349c91a0036b1fde8ae0d0229ae8e005 (diff)
Merge trunk into tdfx-2-1-branchtdfx-2-1-20000906
Diffstat (limited to 'linux/Makefile.kernel')
-rw-r--r--linux/Makefile.kernel99
1 files changed, 67 insertions, 32 deletions
diff --git a/linux/Makefile.kernel b/linux/Makefile.kernel
index e262213a..b1b8d976 100644
--- a/linux/Makefile.kernel
+++ b/linux/Makefile.kernel
@@ -2,52 +2,87 @@
# Makefile for the drm device driver. This driver provides support for
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x.
#
-# 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).
+
+# drm.o is a fake target -- it is never built
+# The real targets are in the module-list
+O_TARGET := drm.o
+module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o
+export-objs := $(patsubst %.o,%_drv.o,$(module-list))
+
+# libs-objs are included in every module so that radical changes to the
+# architecture of the DRM support library can be made at a later time.
+#
+# The downside is that each module is larger, and a system that uses
+# more than one module (i.e., a dual-head system) will use more memory
+# (but a system that uses exactly one module will use the same amount of
+# memory).
#
-# Note 2! The CFLAGS definitions are now inherited from the
-# parent makes..
+# The upside is that if the DRM support library ever becomes insufficient
+# for new families of cards, a new library can be implemented for those new
+# cards without impacting the drivers for the old cards. This is significant,
+# because testing architectural changes to old cards may be impossible, and
+# may delay the implementation of a better architecture. We've traded slight
+# memory waste (in the dual-head case) for greatly improved long-term
+# maintainability.
#
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.6 2000/06/17 00:03:34 martin Exp $
+lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o
+lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
-L_TARGET := libdrm.a
+ifeq ($(CONFIG_AGP),y)
+ lib-objs += agpsupport.o
+else
+ ifeq ($(CONFIG_AGP),m)
+ lib-objs += agpsupport.o
+ endif
+endif
-L_OBJS := init.o memory.o proc.o auth.o context.o drawable.o bufs.o \
- lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o \
- agpsupport.o
+gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o
+tdfx-objs := $(lib-objs) tdfx_drv.o tdfx_context.o
+r128-objs := $(lib-objs) r128_drv.o r128_dma.o r128_context.o r128_bufs.o
+ffb-objs := $(lib-objs) ffb_drv.o ffb_context.o
+mga-objs := $(lib-objs) mga_drv.o mga_dma.o mga_context.o mga_bufs.o \
+ mga_state.o
+i810-objs := $(lib-objs) i810_drv.o i810_dma.o i810_context.o i810_bufs.o
-M_OBJS :=
+obj-$(CONFIG_DRM_GAMMA) += gamma.o $(gamma-objs)
+obj-$(CONFIG_DRM_TDFX) += tdfx.o $(tdfx-objs)
+obj-$(CONFIG_DRM_R128) += r128.o $(r128-objs)
+obj-$(CONFIG_DRM_FFB) += ffb.o $(ffb-objs)
-ifdef CONFIG_DRM_GAMMA
-M_OBJS += gamma.o
+ifneq ($CONFIG_AGP),)
+obj-$(CONFIG_DRM_MGA) += mga.o $(mga-objs)
+obj-$(CONFIG_DRM_I810) += i810.o $(i810-objs)
endif
-ifdef CONFIG_DRM_TDFX
-M_OBJS += tdfx.o
-endif
+# Take module names out of obj-y and int-m
-ifdef CONFIG_DRM_MGA
-M_OBJS += mga.o
-endif
+obj-y := $(filter-out $(module-list), $(obj-y))
+int-m := $(filter-out $(module-list), $(obj-m))
-ifdef CONFIG_DRM_R128
-M_OBJS += r128.o
-endif
+# Translate to Rules.make lists.
+
+O_OBJS := $(filter-out $(export-objs), $(obj-y))
+OX_OBJS := $(filter $(export-objs), $(obj-y))
+M_OBJS := $(sort $(filter $(module-list), $(obj-m)))
+MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m)))
+MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
include $(TOPDIR)/Rules.make
-gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET)
- $(LD) $(LD_RFLAG) -r -o $@ gamma_drv.o gamma_dma.o -L. -ldrm
+gamma.o: $(gamma-objs)
+ $(LD) -r -o $@ $(gamma-objs)
+
+tdfx.o: $(tdfx-objs)
+ $(LD) -r -o $@ $(tdfx-objs)
-tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET)
- $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm
+mga.o: $(mga-objs)
+ $(LD) -r -o $@ $(mga-objs)
-i810.o: i810_drv.o i810_context.o $(L_TARGET)
- $(LD) $(LD_RFLAG) -r -o $@ i810_drv.o i810_bufs.o i810_dma.o i810_context.o -L. -ldrm
+i810.o: $(i810-objs)
+ $(LD) -r -o $@ $(i810-objs)
-mga.o: mga_drv.o mga_context.o mga_dma.o mga_bufs.o $(L_TARGET)
- $(LD) $(LD_RFLAG) -r -o $@ mga_drv.o mga_bufs.o mga_dma.o mga_context.o mga_state.o -L. -ldrm
+r128.o: $(r128-objs)
+ $(LD) -r -o $@ $(r128-objs)
-r128.o: r128_drv.o r128_context.o $(L_TARGET)
- $(LD) $(LD_RFLAG) -r -o $@ r128_drv.o r128_context.o -L. -ldrm
+ffb.o: $(ffb-objs)
+ $(LD) -r -o $@ $(ffb-objs)