summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdrm/xf86drm.c5
-rw-r--r--linux-core/Makefile.kernel8
-rw-r--r--linux/Makefile.kernel8
-rw-r--r--linux/Makefile.linux81
-rw-r--r--linux/picker.c14
5 files changed, 81 insertions, 35 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 542356e1..fd0c75a7 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -1,6 +1,6 @@
/* xf86drm.c -- User-level interface to DRM device
* Created: Tue Jan 5 08:16:21 1999 by faith@precisioninsight.com
- * Revised: Mon Dec 6 11:34:13 1999 by faith@precisioninsight.com
+ * Revised: Thu Jan 6 10:32:25 2000 by faith@precisioninsight.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
@@ -24,8 +24,7 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.43 1999/08/04 18:14:43 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.5 1999/10/13 22:33:07 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.6 1999/12/14 01:33:54 robin Exp $
*
*/
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index c286d8fd..57c6c50c 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -9,7 +9,6 @@
# Note 2! The CFLAGS definitions are now inherited from the
# parent makes..
#
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.2 1999/09/27 14:59:24 dawes Exp $
L_TARGET := libdrm.a
@@ -22,7 +21,14 @@ ifdef CONFIG_DRM_GAMMA
M_OBJS += gamma.o
endif
+ifdef CONFIG_DRM_TDFX
+M_OBJS += tdfx.o
+endif
+
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
+
+tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET)
+ $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm
diff --git a/linux/Makefile.kernel b/linux/Makefile.kernel
index c286d8fd..57c6c50c 100644
--- a/linux/Makefile.kernel
+++ b/linux/Makefile.kernel
@@ -9,7 +9,6 @@
# Note 2! The CFLAGS definitions are now inherited from the
# parent makes..
#
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.2 1999/09/27 14:59:24 dawes Exp $
L_TARGET := libdrm.a
@@ -22,7 +21,14 @@ ifdef CONFIG_DRM_GAMMA
M_OBJS += gamma.o
endif
+ifdef CONFIG_DRM_TDFX
+M_OBJS += tdfx.o
+endif
+
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
+
+tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET)
+ $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm
diff --git a/linux/Makefile.linux b/linux/Makefile.linux
index a0bdeb52..63092770 100644
--- a/linux/Makefile.linux
+++ b/linux/Makefile.linux
@@ -1,6 +1,6 @@
# Makefile -- For the Direct Rendering Manager module (drm)
# Created: Mon Jan 4 09:26:53 1999 by faith@precisioninsight.com
-# Revised: Thu Oct 7 10:56:13 1999 by faith@precisioninsight.com
+# Revised: Mon Jan 17 05:25:12 2000 by faith@precisioninsight.com
#
# Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
# All rights reserved.
@@ -30,31 +30,7 @@
.SUFFIXES:
-# **** Start of SMP/MODVERSIONS detection
-
# *** Setup
-LINUX=/usr/src/linux
-AUTOCONF=$(LINUX)/include/linux/autoconf.h
-
-# ** SMP
-SMP := $(shell \
- if grep -q '^\#define.*CONFIG_SMP.*1' $(AUTOCONF); \
- then echo 1; else echo 0; fi)
-# If that doesn't do automatic detection properly on your system,
-# uncomment one of these lines:
-#SMP := 0
-#SMP := 1
-
-# ** MODVERSIONS
-MODVERSIONS := $(shell \
- if grep -q '^\#define.*CONFIG_MODVERSIONS.*1' $(AUTOCONF); \
- then echo 1; else echo 0; fi)
-# If that doesn't do automatic detection properly on your system,
-# uncomment one of these lines:
-#MODVERSIONS := 0
-#MODVERSIONS := 1
-
-# **** End of SMP/MODVERSIONS detection
MODS= gamma.o tdfx.o
LIBS= libdrm.a
@@ -73,8 +49,6 @@ TDFXHEADERS= tdfx_drv.h $(DRMHEADERS)
PROGOBJS= drmstat.po xf86drm.po xf86drmHash.po xf86drmRandom.po sigio.po
PROGHEADERS= xf86drm.h $(DRMHEADERS)
-INC= /usr/include
-
CFLAGS= -O2 $(WARNINGS)
WARNINGS= -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \
-Wstrict-prototypes -Wshadow -Wnested-externs \
@@ -86,18 +60,65 @@ PRGCFLAGS= $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \
-I../../../../../../../../programs/Xserver/hw/xfree86/common
PRGLIBS=
+# **** Start of SMP/MODVERSIONS detection
+
+# First, locate correct tree for this kernel version. If we find a
+# matching tree, we assume that we can rely on that tree's autoconf.h.
+# This may not be correct, but it is the best assumption we can make.
+
+VERSION := $(shell uname -r)
+A := /usr/src/linux-$(VERSION)/include
+B := /usr/src/linux/include
+C := /usr/include
+
+V := $(shell gcc -E -nostdinc -I$A picker.c 2>/dev/null \
+ | grep -s 'RELEASE = ' | cut -d' ' -f3)
+ifeq ($(V),"$(VERSION)")
+TREE := $A
+else
+ V := $(shell gcc -E -nostdinc -I$B picker.c 2>/dev/null \
+ | grep -s 'RELEASE = ' | cut -d' ' -f3)
+ifeq ($(V),"$(VERSION)")
+ TREE := $B
+else
+ V := $(shell gcc -E -nostdinc -I$C picker.c 2>/dev/null \
+ | grep -s 'RELEASE = ' | cut -d' ' -f3)
+ifeq ($(V),"$(VERSION)")
+ TREE := $C
+else
+ TREE := 0
+endif
+endif
+endif
+
+# To override this determination, pass the path on the make command line:
+# make TREE=/usr/my-kernel-tree/include
+# or hardcode a value for TREE here:
+# TREE:=/usr/include
+
+ifeq ($(TREE),0)
+all:; @echo Error: Could not locate kernel tree in $A $B $C
+else
+SMP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
+ | grep -s 'SMP = ' | cut -d' ' -f3)
+MODVERSIONS := $(shell gcc -E -I $(TREE) picker.c 2>/dev/null \
+ | grep -s 'MODVERSIONS = ' | cut -d' ' -f3)
+all::;@echo KERNEL HEADERS IN $(TREE): SMP=${SMP} MODVERSIONS=${MODVERSIONS}
+all:: $(LIBS) $(MODS) $(PROGS)
+endif
+
+# **** End of SMP/MODVERSIONS detection
+
# **** Handle SMP/MODVERSIONS
ifeq ($(SMP),1)
MODCFLAGS += -D__SMP__
endif
ifeq ($(MODVERSIONS),1)
-MODCFLAGS += -DMODVERSIONS -include /usr/include/linux/modversions.h
+MODCFLAGS += -DMODVERSIONS -include $(TREE)/linux/modversions.h
endif
# **** End of configuration
-all: $(LIBS) $(MODS) $(PROGS)
-
libdrm.a: $(DRMOBJS)
-$(RM) -f $@
$(AR) rcs $@ $(DRMOBJS)
diff --git a/linux/picker.c b/linux/picker.c
new file mode 100644
index 00000000..ecdb2c15
--- /dev/null
+++ b/linux/picker.c
@@ -0,0 +1,14 @@
+#include <linux/autoconf.h>
+#include <linux/version.h>
+
+#ifndef CONFIG_SMP
+#define CONFIG_SMP 0
+#endif
+
+#ifndef CONFIG_MODVERSIONS
+#define CONFIG_MODVERSIONS 0
+#endif
+
+SMP = CONFIG_SMP
+MODVERSIONS = CONFIG_MODVERSIONS
+RELEASE = UTS_RELEASE