Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 1 | # Makefile -- For the Direct Rendering Manager module (drm) |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 2 | # |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 3 | # Based on David Woodhouse's mtd build. |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 4 | # |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 5 | # Modified to handle the DRM requirements and builds on a wider range of |
| 6 | # platforms in a flexible way by David Dawes. It's not clear, however, |
| 7 | # that this approach is simpler than the old one. |
Gareth Hughes | e15a24e | 2000-12-02 06:14:18 +0000 | [diff] [blame] | 8 | # |
Michel Daenzer | 0f32a88 | 2004-04-18 22:59:01 +0000 | [diff] [blame] | 9 | # The purpose of this Makefile is to handle setting up everything |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 10 | # needed for an out-of-kernel source build. Makefile.kernel contains |
| 11 | # everything required for in-kernel source builds. It is included into |
| 12 | # this file, so none of that should be duplicated here. |
Gareth Hughes | e15a24e | 2000-12-02 06:14:18 +0000 | [diff] [blame] | 13 | # |
Alan Hourihane | c516801 | 2003-09-12 20:00:59 +0000 | [diff] [blame] | 14 | # $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.40 2003/08/17 17:12:25 dawes Exp $ |
Gareth Hughes | 3604753 | 2001-02-15 08:12:14 +0000 | [diff] [blame] | 15 | # |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 16 | |
Brian Paul | 569da5a | 2000-06-08 14:38:22 +0000 | [diff] [blame] | 17 | # |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 18 | # By default, the build is done against the running linux kernel source. |
| 19 | # To build against a different kernel source tree, set LINUXDIR: |
| 20 | # |
Michel Daenzer | 0f32a88 | 2004-04-18 22:59:01 +0000 | [diff] [blame] | 21 | # make LINUXDIR=/path/to/kernel/source |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 22 | |
| 23 | # |
| 24 | # To build only some modules, either set DRM_MODULES to the list of modules, |
| 25 | # or specify the modules as targets: |
| 26 | # |
Michel Daenzer | 0f32a88 | 2004-04-18 22:59:01 +0000 | [diff] [blame] | 27 | # make r128.o radeon.o |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 28 | # |
| 29 | # or: |
| 30 | # |
Michel Daenzer | 0f32a88 | 2004-04-18 22:59:01 +0000 | [diff] [blame] | 31 | # make DRM_MODULES="r128 radeon" |
Brian Paul | 569da5a | 2000-06-08 14:38:22 +0000 | [diff] [blame] | 32 | # |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 33 | |
Alan Hourihane | b3eb34e | 2003-03-25 11:36:43 +0000 | [diff] [blame] | 34 | SHELL=/bin/sh |
| 35 | |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 36 | .SUFFIXES: |
| 37 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 38 | ifndef LINUXDIR |
| 39 | RUNNING_REL := $(shell uname -r) |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 40 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 41 | LINUXDIR := /lib/modules/$(RUNNING_REL)/build |
| 42 | endif |
Jeff Hartmann | ba1b1ae | 2000-04-04 22:08:14 +0000 | [diff] [blame] | 43 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 44 | MACHINE := $(shell uname -m) |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 45 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 46 | # Modules for all architectures |
Dave Airlie | 873e1c4 | 2004-04-12 05:27:40 +0000 | [diff] [blame] | 47 | MODULE_LIST := gamma.o tdfx.o r128.o radeon.o mga.o sis.o savage.o via.o mach64.o |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 48 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 49 | # Modules only for ix86 architectures |
| 50 | ifneq (,$(findstring 86,$(MACHINE))) |
Alan Hourihane | c516801 | 2003-09-12 20:00:59 +0000 | [diff] [blame] | 51 | ARCHX86 := 1 |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 52 | MODULE_LIST += i830.o i810.o |
| 53 | endif |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 54 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 55 | # Add ffb.o for sparc?? |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 56 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 57 | DRM_MODULES ?= $(MODULE_LIST) |
Kevin E Martin | 5d6ddbc | 2001-04-05 22:16:12 +0000 | [diff] [blame] | 58 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 59 | # These definitions are for handling dependencies in the out of kernel build. |
| 60 | |
| 61 | DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \ |
Eric Anholt | 2950f9e | 2003-10-17 05:13:48 +0000 | [diff] [blame] | 62 | drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_irq.h \ |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 63 | drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h |
| 64 | |
Eric Anholt | 5864101 | 2003-11-05 01:43:47 +0000 | [diff] [blame] | 65 | DRMSHARED = drm.h drm_sarea.h |
| 66 | DRMHEADERS = drmP.h $(DRMSHARED) |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 67 | |
David Dawes | 9d603b0 | 2003-04-24 02:56:06 +0000 | [diff] [blame] | 68 | GAMMAHEADERS = gamma.h gamma_context.h gamma_drm.h gamma_drv.h gamma_lists.h \ |
| 69 | gamma_old_dma.h gamma_lock.h $(DRMHEADERS) $(DRMTEMPLATES) |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 70 | TDFXHEADERS = tdfx.h $(DRMHEADERS) $(DRMTEMPLATES) |
Eric Anholt | ff58476 | 2003-10-17 03:14:39 +0000 | [diff] [blame] | 71 | TDFXSHARED = tdfx.h |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 72 | R128HEADERS = r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES) |
| 73 | R128SHARED = r128.h r128_drv.h r128_drm.h r128_cce.c r128_state.c r128_irq.c |
| 74 | RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \ |
| 75 | $(DRMTEMPLATES) |
| 76 | RADEONSHARED = radeon.h radeon_drv.h radeon_drm.h radeon_cp.c radeon_irq.c \ |
| 77 | radeon_mem.c radeon_state.c |
| 78 | MGAHEADERS = mga.h mga_drv.h mga_drm.h mga_ucode.h $(DRMHEADERS) \ |
Kevin E Martin | 5d6ddbc | 2001-04-05 22:16:12 +0000 | [diff] [blame] | 79 | $(DRMTEMPLATES) |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 80 | MGASHARED = mga.h mga_dma.c mga_drm.h mga_drv.h mga_irq.c mga_state.c \ |
| 81 | mga_ucode.h mga_warp.c |
| 82 | I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES) |
| 83 | I830HEADERS = i830.h i830_drv.h i830_drm.h $(DRMHEADERS) $(DRMTEMPLATES) |
Eric Anholt | 69d038e | 2003-10-23 05:52:19 +0000 | [diff] [blame] | 84 | SISHEADERS= sis.h sis_drv.h sis_drm.h $(DRMHEADERS) |
| 85 | SISSHARED= sis.h sis_drv.h sis_drm.h sis_ds.c sis_ds.h sis_mm.c |
Felix Kuehling | 3dea36d | 2004-02-22 16:20:16 +0000 | [diff] [blame] | 86 | SAVAGEHEADERS= savage.h savage_drv.h savage_drm.h $(DRMHEADERS) \ |
| 87 | $(DRMTEMPLATES) |
Thomas Hellstrom | 89d67d9 | 2004-03-23 21:14:17 +0000 | [diff] [blame] | 88 | VIAHEADERS = via_drm.h via_drv.h via.h via_mm.h via_ds.h \ |
| 89 | $(DRMHEADERS) $(DRMTEMPLATES) |
| 90 | VIASHARED = via_drm.h via_drv.h via.h via_mm.h via_ds.h via_drv.c \ |
| 91 | via_ds.c via_irq.c via_map.c via_mm.c |
Dave Airlie | 873e1c4 | 2004-04-12 05:27:40 +0000 | [diff] [blame] | 92 | MACH64HEADERS = mach64.h mach64_drv.h mach64_drm.h $(DRMHEADERS) \ |
| 93 | $(DRMTEMPLATES) |
| 94 | MACH64SHARED = mach64.h mach64_drv.h mach64_drm.h mach64_dma.c \ |
| 95 | mach64_irq.c mach64_state.c |
Alan Hourihane | b3eb34e | 2003-03-25 11:36:43 +0000 | [diff] [blame] | 96 | |
Eric Anholt | ff58476 | 2003-10-17 03:14:39 +0000 | [diff] [blame] | 97 | SHAREDSRC = $(DRMSHARED) $(MGASHARED) $(R128SHARED) $(RADEONSHARED) \ |
Dave Airlie | 873e1c4 | 2004-04-12 05:27:40 +0000 | [diff] [blame] | 98 | $(SISSHARED) $(TDFXSHARED) $(VIASHARED) $(MACH64SHARED) |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 99 | |
David Dawes | c3092ea | 2003-04-25 00:57:42 +0000 | [diff] [blame] | 100 | PROGS = dristat drmstat |
| 101 | |
Jon Smirl | 537ac1a | 2004-03-16 00:59:24 +0000 | [diff] [blame] | 102 | CLEANFILES = *.o *.ko $(PROGS) .depend .*.flags .*.d .*.cmd *.mod.c linux |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 103 | |
| 104 | # VERSION is not defined from the initial invocation. It is defined when |
| 105 | # this Makefile is invoked from the kernel's root Makefile. |
| 106 | |
| 107 | ifndef VERSION |
| 108 | |
| 109 | ifdef RUNNING_REL |
| 110 | |
| 111 | # SuSE has the version.h and autoconf.h headers for the current kernel |
| 112 | # in /boot as /boot/vmlinuz.version.h and /boot/vmlinuz.autoconf.h. |
| 113 | # Check these first to see if they match the running kernel. |
| 114 | |
| 115 | BOOTVERSION_PREFIX = /boot/vmlinuz. |
| 116 | |
| 117 | V := $(shell if [ -f $(BOOTVERSION_PREFIX)version.h ]; then \ |
| 118 | grep UTS_RELEASE $(BOOTVERSION_PREFIX)version.h | \ |
| 119 | cut -d' ' -f3; fi) |
| 120 | |
| 121 | ifeq ($(V),"$(RUNNING_REL)") |
| 122 | HEADERFROMBOOT := 1 |
| 123 | GETCONFIG := MAKEFILES=$(shell pwd)/.config |
| 124 | HAVECONFIG := y |
| 125 | endif |
| 126 | |
| 127 | # On Red Hat we need to check if there is a .config file in the kernel |
| 128 | # source directory. If there isn't, we need to check if there's a |
| 129 | # matching file in the configs subdirectory. |
| 130 | |
| 131 | ifneq ($(HAVECONFIG),y) |
| 132 | HAVECONFIG := $(shell if [ -e $(LINUXDIR)/.config ]; then echo y; fi) |
| 133 | endif |
| 134 | |
| 135 | ifneq ($(HAVECONFIG),y) |
| 136 | REL_BASE := $(shell echo $(RUNNING_REL) | sed 's/-.*//') |
| 137 | REL_TYPE := $(shell echo $(RUNNING_REL) | sed 's/[0-9.-]//g') |
| 138 | ifeq ($(REL_TYPE),) |
| 139 | RHCONFIG := configs/kernel-$(REL_BASE)-$(MACHINE).config |
| 140 | else |
| 141 | RHCONFIG := configs/kernel-$(REL_BASE)-$(MACHINE)-$(REL_TYPE).config |
| 142 | endif |
| 143 | HAVECONFIG := $(shell if [ -e $(LINUXDIR)/$(RHCONFIG) ]; then echo y; fi) |
| 144 | ifneq ($(HAVECONFIG),y) |
| 145 | RHCONFIG := |
| 146 | endif |
| 147 | endif |
| 148 | |
| 149 | ifneq ($(HAVECONFIG),y) |
| 150 | $(error Cannot find a kernel config file) |
| 151 | endif |
| 152 | |
| 153 | endif |
| 154 | |
| 155 | CLEANCONFIG := $(shell if cmp -s $(LINUXDIR)/.config .config; then echo y; fi) |
| 156 | ifeq ($(CLEANCONFIG),y) |
| 157 | CLEANFILES += $(LINUXDIR)/.config .config $(LINUXDIR)/tmp_include_depends |
| 158 | endif |
| 159 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 160 | all: modules |
| 161 | |
| 162 | modules: includes |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 163 | make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`pwd` DRMSRCDIR=`pwd` modules |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 164 | |
| 165 | ifeq ($(HEADERFROMBOOT),1) |
| 166 | |
| 167 | BOOTHEADERS = version.h autoconf.h |
| 168 | BOOTCONFIG = .config |
| 169 | |
| 170 | CLEANFILES += $(BOOTHEADERS) $(BOOTCONFIG) |
| 171 | |
| 172 | includes:: $(BOOTHEADERS) $(BOOTCONFIG) |
| 173 | |
| 174 | version.h: $(BOOTVERSION_PREFIX)version.h |
| 175 | rm -f $@ |
| 176 | ln -s $< $@ |
| 177 | |
| 178 | autoconf.h: $(BOOTVERSION_PREFIX)autoconf.h |
| 179 | rm -f $@ |
| 180 | ln -s $< $@ |
| 181 | |
| 182 | .config: $(BOOTVERSION_PREFIX)config |
| 183 | rm -f $@ |
| 184 | ln -s $< $@ |
| 185 | endif |
| 186 | |
| 187 | # This prepares an unused Red Hat kernel tree for the build. |
| 188 | ifneq ($(RHCONFIG),) |
| 189 | includes:: $(LINUXDIR)/.config $(LINUXDIR)/tmp_include_depends .config |
| 190 | |
| 191 | $(LINUXDIR)/.config: $(LINUXDIR)/$(RHCONFIG) |
| 192 | rm -f $@ |
| 193 | ln -s $< $@ |
| 194 | |
| 195 | .config: $(LINUXDIR)/$(RHCONFIG) |
| 196 | rm -f $@ |
| 197 | ln -s $< $@ |
| 198 | |
| 199 | $(LINUXDIR)/tmp_include_depends: |
| 200 | echo all: > $@ |
| 201 | endif |
| 202 | |
| 203 | # Make sure that the shared source files are linked into this directory. |
| 204 | |
| 205 | |
Jon Smirl | ab66cbc | 2004-03-17 01:03:26 +0000 | [diff] [blame] | 206 | SHAREDDIR := ../shared |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 207 | |
| 208 | HASSHARED := $(shell if [ -d $(SHAREDDIR) ]; then echo y; fi) |
| 209 | |
| 210 | ifeq ($(HASSHARED),y) |
Dave Airlie | 93bd67e | 2004-04-21 12:13:31 +0000 | [diff] [blame^] | 211 | includes:: $(SHAREDSRC) drm_pciids.h |
| 212 | |
| 213 | drm_pciids.h: $(SHAREDDIR)/drm_pciids.txt |
| 214 | sh ../scripts/create_linux_pci_lists.sh < $(SHAREDDIR)/drm_pciids.txt |
Alan Hourihane | b3eb34e | 2003-03-25 11:36:43 +0000 | [diff] [blame] | 215 | |
| 216 | $(SHAREDSRC): |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 217 | @if [ -r $(SHAREDDIR)/$@ ]; then \ |
| 218 | (rm -f $@; set -x; ln -s $(SHAREDDIR)/$@ $@); fi |
Alan Hourihane | b3eb34e | 2003-03-25 11:36:43 +0000 | [diff] [blame] | 219 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 220 | CLEANFILES += $(SHAREDSRC) |
Jeff Hartmann | ba1b1ae | 2000-04-04 22:08:14 +0000 | [diff] [blame] | 221 | endif |
| 222 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 223 | includes:: linux |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 224 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 225 | linux: |
| 226 | rm -f linux |
| 227 | ln -s . linux |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 228 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 229 | clean cleandir: |
| 230 | rm -f $(CLEANFILES) |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 231 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 232 | $(MODULE_LIST):: |
Michel Daenzer | 0f32a88 | 2004-04-18 22:59:01 +0000 | [diff] [blame] | 233 | make DRM_MODULES=$@ modules |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 234 | |
David Dawes | c3092ea | 2003-04-25 00:57:42 +0000 | [diff] [blame] | 235 | # Build test utilities |
| 236 | |
| 237 | PRGCFLAGS = $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ |
| 238 | -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \ |
| 239 | -I. -I../../.. |
| 240 | |
| 241 | DRMSTATLIBS = -L../../.. -L.. -ldrm -lxf86_os \ |
| 242 | -L../../../../dummylib -ldummy -lm |
| 243 | |
| 244 | programs: $(PROGS) |
| 245 | |
| 246 | dristat: dristat.c |
| 247 | $(CC) $(PRGCFLAGS) $< -o $@ |
| 248 | |
| 249 | drmstat: drmstat.c |
| 250 | $(CC) $(PRGCFLAGS) $< -o $@ $(DRMSTATLIBS) |
| 251 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 252 | else |
| 253 | |
| 254 | # Check for kernel versions that we don't support. |
| 255 | |
| 256 | BELOW24 := $(shell if [ $(VERSION) -lt 2 -o $(PATCHLEVEL) -lt 4 ]; then \ |
| 257 | echo y; fi) |
| 258 | |
| 259 | ifeq ($(BELOW24),y) |
| 260 | $(error Only 2.4.x and later kernels are supported \ |
| 261 | ($(VERSION).$(PATCHLEVEL).$(SUBLEVEL))) |
Jeff Hartmann | ba1b1ae | 2000-04-04 22:08:14 +0000 | [diff] [blame] | 262 | endif |
Daryll Strauss | b6a28bf | 1999-12-05 23:10:37 +0000 | [diff] [blame] | 263 | |
Alan Hourihane | c516801 | 2003-09-12 20:00:59 +0000 | [diff] [blame] | 264 | ifdef ARCHX86 |
| 265 | ifndef CONFIG_X86_CMPXCHG |
| 266 | $(error CONFIG_X86_CMPXCHG needs to be enabled in the kernel) |
| 267 | endif |
| 268 | endif |
| 269 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 270 | # This needs to go before all other include paths. |
| 271 | CC += -I$(DRMSRCDIR) |
| 272 | |
| 273 | # Check for Red Hat's 4-argument do_munmap(). |
| 274 | DOMUNMAP := $(shell grep do_munmap $(LINUXDIR)/include/linux/mm.h | \ |
| 275 | grep -c acct) |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 276 | |
| 277 | ifneq ($(DOMUNMAP),0) |
| 278 | EXTRA_CFLAGS += -DDO_MUNMAP_4_ARGS |
| 279 | endif |
| 280 | |
Michel Daenzer | e5d3c7f | 2003-05-16 23:41:27 +0000 | [diff] [blame] | 281 | # Check for 5-argument remap_page_range() in RH9 kernel, and 2.5.x kernels |
| 282 | RPR := $(shell grep remap_page_range $(LINUXDIR)/include/linux/mm.h | \ |
| 283 | grep -c vma) |
| 284 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 285 | ifneq ($(RPR),0) |
| 286 | EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5_ARGS |
| 287 | endif |
| 288 | |
Michel Daenzer | e5d3c7f | 2003-05-16 23:41:27 +0000 | [diff] [blame] | 289 | # Check for 4-argument vmap() in some 2.5.x and 2.4.x kernels |
| 290 | VMAP := $(shell grep -A1 'vmap.*count,$$' $(LINUXDIR)/include/linux/vmalloc.h | \ |
| 291 | grep -c prot) |
| 292 | |
| 293 | ifneq ($(VMAP),0) |
| 294 | EXTRA_CFLAGS += -DVMAP_4_ARGS |
| 295 | endif |
| 296 | |
| 297 | # Check for PAGE_AGP definition |
| 298 | PAGE_AGP := $(shell cat $(LINUXDIR)/include/asm/agp.h 2>/dev/null | \ |
| 299 | grep -c PAGE_AGP) |
| 300 | |
| 301 | ifneq ($(PAGE_AGP),0) |
| 302 | EXTRA_CFLAGS += -DHAVE_PAGE_AGP |
| 303 | endif |
| 304 | |
| 305 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 306 | # Start with all modules turned off. |
| 307 | CONFIG_DRM_GAMMA := n |
| 308 | CONFIG_DRM_TDFX := n |
| 309 | CONFIG_DRM_MGA := n |
| 310 | CONFIG_DRM_I810 := n |
| 311 | CONFIG_DRM_R128 := n |
| 312 | CONFIG_DRM_RADEON := n |
| 313 | CONFIG_DRM_I830 := n |
| 314 | CONFIG_DRM_SIS := n |
| 315 | CONFIG_DRM_FFB := n |
Felix Kuehling | 3dea36d | 2004-02-22 16:20:16 +0000 | [diff] [blame] | 316 | CONFIG_DRM_SAVAGE := n |
Thomas Hellstrom | 89d67d9 | 2004-03-23 21:14:17 +0000 | [diff] [blame] | 317 | CONFIG_DRM_VIA := n |
Dave Airlie | 873e1c4 | 2004-04-12 05:27:40 +0000 | [diff] [blame] | 318 | CONFIG_DRM_MACH64 := n |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 319 | |
| 320 | # Enable module builds for the modules requested/supported. |
| 321 | |
| 322 | ifneq (,$(findstring gamma,$(DRM_MODULES))) |
| 323 | CONFIG_DRM_GAMMA := m |
| 324 | endif |
| 325 | ifneq (,$(findstring tdfx,$(DRM_MODULES))) |
| 326 | CONFIG_DRM_TDFX := m |
| 327 | endif |
Leif Delgass | 22608a4 | 2003-04-22 19:42:27 +0000 | [diff] [blame] | 328 | ifneq (,$(findstring r128,$(DRM_MODULES))) |
| 329 | CONFIG_DRM_R128 := m |
| 330 | endif |
| 331 | ifneq (,$(findstring radeon,$(DRM_MODULES))) |
| 332 | CONFIG_DRM_RADEON := m |
| 333 | endif |
| 334 | ifneq (,$(findstring sis,$(DRM_MODULES))) |
| 335 | CONFIG_DRM_SIS := m |
| 336 | endif |
Thomas Hellstrom | 89d67d9 | 2004-03-23 21:14:17 +0000 | [diff] [blame] | 337 | ifneq (,$(findstring via,$(DRM_MODULES))) |
| 338 | CONFIG_DRM_VIA := m |
| 339 | endif |
Dave Airlie | 873e1c4 | 2004-04-12 05:27:40 +0000 | [diff] [blame] | 340 | ifneq (,$(findstring mach64,$(DRM_MODULES))) |
| 341 | CONFIG_DRM_MACH64 := m |
| 342 | endif |
| 343 | |
Thomas Hellstrom | 89d67d9 | 2004-03-23 21:14:17 +0000 | [diff] [blame] | 344 | |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 345 | |
| 346 | # These require AGP support |
| 347 | |
| 348 | ifdef CONFIG_AGP |
| 349 | ifneq (,$(findstring mga,$(DRM_MODULES))) |
| 350 | CONFIG_DRM_MGA := m |
| 351 | endif |
| 352 | ifneq (,$(findstring i810,$(DRM_MODULES))) |
| 353 | CONFIG_DRM_I810 := m |
| 354 | endif |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 355 | ifneq (,$(findstring i830,$(DRM_MODULES))) |
| 356 | CONFIG_DRM_I830 := m |
| 357 | endif |
Felix Kuehling | 3dea36d | 2004-02-22 16:20:16 +0000 | [diff] [blame] | 358 | ifneq (,$(findstring savage,$(DRM_MODULES))) |
| 359 | CONFIG_DRM_SAVAGE := m |
| 360 | endif |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 361 | endif |
| 362 | |
| 363 | include $(DRMSRCDIR)/Makefile.kernel |
| 364 | |
| 365 | # Depencencies |
| 366 | $(gamma-objs): $(GAMMAHEADERS) |
| 367 | $(tdfx-objs): $(TDFXHEADERS) |
| 368 | $(r128-objs): $(R128HEADERS) |
| 369 | $(mga-objs): $(MGAHEADERS) |
| 370 | $(i810-objs): $(I810HEADERS) |
| 371 | $(i830-objs): $(I830HEADERS) |
| 372 | $(radeon-objs): $(RADEONHEADERS) |
| 373 | $(sis-objs): $(SISHEADERS) |
| 374 | $(ffb-objs): $(FFBHEADERS) |
Felix Kuehling | 3dea36d | 2004-02-22 16:20:16 +0000 | [diff] [blame] | 375 | $(savage-objs): $(SAVAGEHEADERS) |
Thomas Hellstrom | 89d67d9 | 2004-03-23 21:14:17 +0000 | [diff] [blame] | 376 | $(via-objs): $(VIAHEADERS) |
Dave Airlie | 873e1c4 | 2004-04-12 05:27:40 +0000 | [diff] [blame] | 377 | $(mach64-objs): $(MACH64HEADERS) |
David Dawes | dbb7beb | 2003-04-17 18:44:38 +0000 | [diff] [blame] | 378 | |
| 379 | endif |
Alan Hourihane | b3eb34e | 2003-03-25 11:36:43 +0000 | [diff] [blame] | 380 | |