1 # Makefile -- For the Direct Rendering Manager module (drm)
2 # Created: Mon Jan 4 09:26:53 1999 by faith@precisioninsight.com
3 # Revised: Sun Feb 13 23:15:59 2000 by kevin@precisioninsight.com
5 # Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
8 # Permission is hereby granted, free of charge, to any person obtaining a
9 # copy of this software and associated documentation files (the "Software"),
10 # to deal in the Software without restriction, including without limitation
11 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 # and/or sell copies of the Software, and to permit persons to whom the
13 # Software is furnished to do so, subject to the following conditions:
15 # The above copyright notice and this permission notice (including the next
16 # paragraph) shall be included in all copies or substantial portions of the
19 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 # PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 # DEALINGS IN THE SOFTWARE.
27 # $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.6 2000/02/23 04:47:25 martin Exp $
34 # **** End of SMP/MODVERSIONS detection
40 DRMOBJS= init.o memory.o proc.o auth.o context.o drawable.o bufs.o \
41 lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
42 DRMHEADERS= drm.h drmP.h
44 GAMMAOBJS= gamma_drv.o gamma_dma.o
45 GAMMAHEADERS= gamma_drv.h $(DRMHEADERS)
47 TDFXOBJS= tdfx_drv.o tdfx_context.o
48 TDFXHEADERS= tdfx_drv.h $(DRMHEADERS)
50 PROGOBJS= drmstat.po xf86drm.po xf86drmHash.po xf86drmRandom.po sigio.po
51 PROGHEADERS= xf86drm.h $(DRMHEADERS)
55 CFLAGS= -O2 $(WARNINGS)
56 WARNINGS= -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \
57 -Wstrict-prototypes -Wshadow -Wnested-externs \
58 -Winline -Wpointer-arith
59 MODCFLAGS= $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer
60 PRGCFLAGS= $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \
61 -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \
62 -I../../../../../../include -I../../../../../../../../include \
63 -I../../../../../../../../programs/Xserver/hw/xfree86/common
66 # **** Start of SMP/MODVERSIONS detection
68 # First, locate correct tree for this kernel version. If we find a
69 # matching tree, we assume that we can rely on that tree's autoconf.h.
70 # This may not be correct, but it is the best assumption we can make.
72 VERSION := $(shell uname -r)
73 A := /usr/src/linux-$(VERSION)/include
74 B := /usr/src/linux/include
77 V := $(shell gcc -E -nostdinc -I$A picker.c 2>/dev/null \
78 | grep -s 'RELEASE = ' | cut -d' ' -f3)
79 ifeq ($(V),"$(VERSION)")
82 V := $(shell gcc -E -nostdinc -I$B picker.c 2>/dev/null \
83 | grep -s 'RELEASE = ' | cut -d' ' -f3)
84 ifeq ($(V),"$(VERSION)")
87 V := $(shell gcc -E -nostdinc -I$C picker.c 2>/dev/null \
88 | grep -s 'RELEASE = ' | cut -d' ' -f3)
89 ifeq ($(V),"$(VERSION)")
97 # To override this determination, pass the path on the make command line:
98 # make TREE=/usr/my-kernel-tree/include
99 # or hardcode a value for TREE here:
103 all:; @echo Error: Could not locate kernel tree in $A $B $C
105 SMP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
106 | grep -s 'SMP = ' | cut -d' ' -f3)
107 MODVERSIONS := $(shell gcc -E -I $(TREE) picker.c 2>/dev/null \
108 | grep -s 'MODVERSIONS = ' | cut -d' ' -f3)
109 AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
110 | grep -s 'AGP = ' | cut -d' ' -f3)
112 AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
113 | grep -s 'AGP_MODULE = ' | cut -d' ' -f3)
117 MODCFLAGS += -DDRM_AGP
118 DRMOBJS += agpsupport.o
121 MGAOBJS= mga_drv.o mga_dma.o mga_bufs.o mga_state.o mga_context.o
122 MGAHEADERS= mga_drv.h $(DRMHEADERS)
124 I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o
125 I810HEADERS= i810_drv.h $(DRMHEADERS)
128 all::;@echo KERNEL HEADERS IN $(TREE): SMP=${SMP} MODVERSIONS=${MODVERSIONS} \
130 all:: $(LIBS) $(MODS) $(PROGS)
133 # **** End of SMP/MODVERSIONS detection
135 # **** Handle SMP/MODVERSIONS
137 MODCFLAGS += -D__SMP__
139 ifeq ($(MODVERSIONS),1)
140 MODCFLAGS += -DMODVERSIONS -include $(TREE)/linux/modversions.h
144 # **** End of configuration
148 $(AR) rcs $@ $(DRMOBJS)
150 gamma.o: $(GAMMAOBJS) $(LIBS)
153 tdfx.o: $(TDFXOBJS) $(LIBS)
157 mga.o: $(MGAOBJS) $(LIBS)
160 i810.o: $(I810OBJS) $(LIBS)
165 $(CC) $(PRGCFLAGS) $^ $(PRGLIBS) -o $@
170 @rcs2log -i 2 -r -l \
171 | sed 's,@.*alephnull.com,@precisioninsight.com,' > ChangeLog
174 # .o files are used for modules
176 $(CC) $(MODCFLAGS) -c $< -o $@
179 $(CC) $(PRGCFLAGS) -DDRM_USE_MALLOC -c $< -o $@
182 $(DRMOBJS): $(DRMHEADERS)
183 $(GAMMAOBJS): $(GAMMAHEADERS)
184 $(TDFXOBJS): $(TDFXHEADERS)
186 $(MGAOBJS): $(MGAHEADERS)
187 $(I810OBJS): $(I810HEADERS)
189 $(PROGOBJS): $(PROGHEADERS)
192 rm -f *.o *.a *.po *~ core $(PROGS)