New Makefile system
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a247677
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,336 @@
+# Top-level Mesa makefile
+
+TOP = .
+
+SUBDIRS = src progs
+
+
+default: $(TOP)/configs/current
+	@for dir in $(SUBDIRS) ; do \
+		pushd $$dir ; \
+		make ; \
+		popd ; \
+	done
+
+
+clean:
+	@for dir in $(SUBDIRS) ; do \
+		pushd $$dir ; \
+		make clean; \
+		popd ; \
+	done
+
+
+realclean: clean
+	#-rm -rf $(LIB_DIR)
+	-rm -rf lib*
+	-rm -f $(TOP)/configs/current
+
+
+install:
+	@echo "Installing"
+	$(TOP)/bin/installmesa 
+
+# If there's no current configuration file
+$(TOP)/configs/current:
+	@echo
+	@echo
+	@echo "Please choose a configuration from the following list:"
+	@ls -1 $(TOP)/configs | grep -v current | grep -v default
+	@echo
+	@echo "Then type 'make <config>' (ex: 'make linux-x86')"
+	@echo "(ignore the following error message)"
+	@exit 1
+
+
+# Rules to set/install a specific build configuration
+aix \
+aix-gcc \
+darwin \
+darwin-static \
+freebsd \
+hpux10 \
+hpux10-gcc \
+hpux11-32-static \
+hpux11-32-static-nothreads \
+hpux11-64-static \
+hpux9 \
+hpux9-gcc \
+irix6-64 \
+irix6-64-static \
+irix6-n32 \
+irix6-n32-static \
+irix6-o32 \
+irix6-o32-static \
+linux \
+linux-alpha \
+linux-alpha-static \
+linux-debug \
+linux-icc \
+linux-icc-static \
+linux-osmesa16 \
+linux-osmesa16-static \
+linux-osmesa32 \
+linux-ppc \
+linux-ppc-static \
+linux-solo \
+linux-sparc \
+linux-sparc5 \
+linux-static \
+linux-ultrasparc \
+linux-x86 \
+linux-x86-64 \
+linux-x86-64-static \
+linux-x86-static \
+netbsd \
+openbsd \
+osf1 \
+solaris-x86 \
+solaris-x86-gcc \
+sunos4 \
+sunos4-gcc \
+sunos4-static \
+sunos5 \
+sunos5-gcc \
+sunos5-smp \
+ultrix-gcc:
+	cp $(TOP)/configs/$@ $(TOP)/configs/current
+	make default
+
+
+# Rules for making release tarballs
+
+DIRECTORY = Mesa-6.1
+LIB_NAME = MesaLib-6.1
+DEMO_NAME = MesaDemos-6.1
+
+LIB_FILES =	\
+	$(DIRECTORY)/Makefile*						\
+	$(DIRECTORY)/descrip.mms					\
+	$(DIRECTORY)/mms-config.					\
+	$(DIRECTORY)/Mesa.dsw						\
+	$(DIRECTORY)/bin/mklib						\
+	$(DIRECTORY)/configs/[a-z]*					\
+	$(DIRECTORY)/docs/*.html					\
+	$(DIRECTORY)/docs/COPYING					\
+	$(DIRECTORY)/docs/INSTALL.GNU					\
+	$(DIRECTORY)/docs/README.*					\
+	$(DIRECTORY)/docs/RELNOTES*					\
+	$(DIRECTORY)/docs/VERSIONS					\
+	$(DIRECTORY)/docs/*.spec					\
+	$(DIRECTORY)/include/GL/internal/glcore.h			\
+	$(DIRECTORY)/include/GL/dmesa.h					\
+	$(DIRECTORY)/include/GL/amesa.h					\
+	$(DIRECTORY)/include/GL/fxmesa.h				\
+	$(DIRECTORY)/include/GL/ggimesa.h				\
+	$(DIRECTORY)/include/GL/gl.h					\
+	$(DIRECTORY)/include/GL/glext.h					\
+	$(DIRECTORY)/include/GL/gl_mangle.h				\
+	$(DIRECTORY)/include/GL/glu.h					\
+	$(DIRECTORY)/include/GL/glu_mangle.h				\
+	$(DIRECTORY)/include/GL/glx.h					\
+	$(DIRECTORY)/include/GL/glxext.h				\
+	$(DIRECTORY)/include/GL/glx_mangle.h				\
+	$(DIRECTORY)/include/GL/mesa_wgl.h				\
+	$(DIRECTORY)/include/GL/mglmesa.h				\
+	$(DIRECTORY)/include/GL/osmesa.h				\
+	$(DIRECTORY)/include/GL/svgamesa.h				\
+	$(DIRECTORY)/include/GL/ugl*.h					\
+	$(DIRECTORY)/include/GL/vms_x_fix.h				\
+	$(DIRECTORY)/include/GL/wmesa.h					\
+	$(DIRECTORY)/include/GL/xmesa.h					\
+	$(DIRECTORY)/include/GL/xmesa_x.h				\
+	$(DIRECTORY)/include/GL/xmesa_xf86.h				\
+	$(DIRECTORY)/src/Makefile					\
+	$(DIRECTORY)/src/descrip.mms					\
+	$(DIRECTORY)/src/mesa/Makefile*					\
+	$(DIRECTORY)/src/mesa/sources					\
+	$(DIRECTORY)/src/mesa/descrip.mms				\
+	$(DIRECTORY)/src/mesa/depend					\
+	$(DIRECTORY)/src/mesa/main/*.[chS]				\
+	$(DIRECTORY)/src/mesa/main/main.dsp				\
+	$(DIRECTORY)/src/mesa/main/descrip.mms				\
+	$(DIRECTORY)/src/mesa/glapi/*.[chS]				\
+	$(DIRECTORY)/src/mesa/glapi/glapi.dsp				\
+	$(DIRECTORY)/src/mesa/glapi/descrip.mms				\
+	$(DIRECTORY)/src/mesa/array_cache/*.[ch]			\
+	$(DIRECTORY)/src/mesa/array_cache/array_cache.dsp		\
+	$(DIRECTORY)/src/mesa/array_cache/descrip.mms			\
+	$(DIRECTORY)/src/mesa/math/*.[ch]				\
+	$(DIRECTORY)/src/mesa/math/math.dsp				\
+	$(DIRECTORY)/src/mesa/math/descrip.mms				\
+	$(DIRECTORY)/src/mesa/swrast/*.[ch]				\
+	$(DIRECTORY)/src/mesa/swrast/swrast.dsp				\
+	$(DIRECTORY)/src/mesa/swrast/descrip.mms			\
+	$(DIRECTORY)/src/mesa/swrast_setup/*.[ch]			\
+	$(DIRECTORY)/src/mesa/swrast_setup/swrast_setup.dsp		\
+	$(DIRECTORY)/src/mesa/swrast_setup/descrip.mms			\
+	$(DIRECTORY)/src/mesa/tnl/*.[ch]				\
+	$(DIRECTORY)/src/mesa/tnl/tnl.dsp				\
+	$(DIRECTORY)/src/mesa/tnl/descrip.mms				\
+	$(DIRECTORY)/src/mesa/tnl_dd/*.[ch]				\
+	$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch]				\
+	$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm			\
+	$(DIRECTORY)/src/mesa/drivers/beos/*.cpp			\
+	$(DIRECTORY)/src/mesa/drivers/beos/*.h				\
+	$(DIRECTORY)/src/mesa/drivers/common/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/common/descrip.mms		\
+	$(DIRECTORY)/src/mesa/drivers/dos/*.[chS]			\
+	$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c			\
+	$(DIRECTORY)/src/mesa/drivers/glide/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/glide/*.def			\
+	$(DIRECTORY)/src/mesa/drivers/ggi/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/ggi/ggimesa.conf.in		\
+	$(DIRECTORY)/src/mesa/drivers/ggi/default/*.c			\
+	$(DIRECTORY)/src/mesa/drivers/ggi/default/genkgi.conf.in	\
+	$(DIRECTORY)/src/mesa/drivers/ggi/display/*.c			\
+	$(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in		\
+	$(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h		\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win		\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms		\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def			\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.dsp			\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/svga/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/windows/*/*.def			\
+	$(DIRECTORY)/src/mesa/drivers/windows/*/*.dsp			\
+	$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms			\
+	$(DIRECTORY)/src/mesa/drivers/x11/*.[ch]			\
+	$(DIRECTORY)/src/mesa/sparc/*.[chS]				\
+	$(DIRECTORY)/src/mesa/x86/Makefile				\
+	$(DIRECTORY)/src/mesa/x86/*.[ch]				\
+	$(DIRECTORY)/src/mesa/x86/*.S					\
+	$(DIRECTORY)/src/glu/Makefile					\
+	$(DIRECTORY)/src/glu/descrip.mms				\
+	$(DIRECTORY)/src/glu/sgi/Makefile				\
+	$(DIRECTORY)/src/glu/sgi/Makefile.win				\
+	$(DIRECTORY)/src/glu/sgi/Makefile.DJ				\
+	$(DIRECTORY)/src/glu/sgi/cc*.txt				\
+	$(DIRECTORY)/src/glu/sgi/glu.def				\
+	$(DIRECTORY)/src/glu/sgi/glu.dsp				\
+	$(DIRECTORY)/src/glu/sgi/dummy.cc				\
+	$(DIRECTORY)/src/glu/sgi/descrip.mms				\
+	$(DIRECTORY)/src/glu/sgi/mesaglu.opt				\
+	$(DIRECTORY)/src/glu/sgi/include/gluos.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.cc		\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.cc		\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.cc			\
+	$(DIRECTORY)/src/glu/sgi/libtess/README				\
+	$(DIRECTORY)/src/glu/sgi/libtess/alg-outline			\
+	$(DIRECTORY)/src/glu/sgi/libtess/*.[ch]				\
+	$(DIRECTORY)/src/glu/sgi/libutil/*.[ch]				\
+	$(DIRECTORY)/src/glu/mesa/README[12]				\
+	$(DIRECTORY)/src/glu/mesa/Makefile*				\
+	$(DIRECTORY)/src/glu/mesa/descrip.mms				\
+	$(DIRECTORY)/src/glu/mesa/mms_depend				\
+	$(DIRECTORY)/src/glu/mesa/*.def					\
+	$(DIRECTORY)/src/glu/mesa/depend				\
+	$(DIRECTORY)/src/glu/mesa/*.[ch]				\
+	$(DIRECTORY)/src/glw/*.[ch]					\
+	$(DIRECTORY)/src/glw/Makefile*					\
+	$(DIRECTORY)/src/glw/README					\
+	$(DIRECTORY)/progs/Makefile					\
+	$(DIRECTORY)/progs/util/README					\
+	$(DIRECTORY)/progs/util/*.[ch]					\
+	$(DIRECTORY)/progs/util/sampleMakefile				\
+	$(DIRECTORY)/vms/analyze_map.com				\
+	$(DIRECTORY)/vms/xlib.opt					\
+	$(DIRECTORY)/vms/xlib_share.opt
+
+
+DEMO_FILES =	\
+	$(DIRECTORY)/include/GL/glut.h			\
+	$(DIRECTORY)/include/GL/glutf90.h		\
+	$(DIRECTORY)/src/glut/glx/Makefile*		\
+	$(DIRECTORY)/src/glut/glx/depend		\
+	$(DIRECTORY)/src/glut/glx/*def			\
+	$(DIRECTORY)/src/glut/glx/descrip.mms		\
+	$(DIRECTORY)/src/glut/glx/mms_depend		\
+	$(DIRECTORY)/src/glut/glx/glut.dsp		\
+	$(DIRECTORY)/src/glut/glx/*.[ch]		\
+	$(DIRECTORY)/src/glut/beos/*.h			\
+	$(DIRECTORY)/src/glut/beos/*.cpp		\
+	$(DIRECTORY)/src/glut/beos/libglut.def		\
+	$(DIRECTORY)/src/glut/beos/Makefile*		\
+	$(DIRECTORY)/src/glut/dos/*.[ch]		\
+	$(DIRECTORY)/src/glut/dos/Makefile.DJ		\
+	$(DIRECTORY)/src/glut/dos/PC_HW/*.[chS]		\
+	$(DIRECTORY)/progs/images/*.rgb			\
+	$(DIRECTORY)/progs/images/*.rgba		\
+	$(DIRECTORY)/progs/demos/Makefile*		\
+	$(DIRECTORY)/progs/demos/descrip.mms		\
+	$(DIRECTORY)/progs/demos/*.[ch]			\
+	$(DIRECTORY)/progs/demos/*.cxx			\
+	$(DIRECTORY)/progs/demos/*.dat			\
+	$(DIRECTORY)/progs/demos/README			\
+	$(DIRECTORY)/progs/demos/Windows/*.dsp		\
+	$(DIRECTORY)/progs/demos/Windows/*.dsw		\
+	$(DIRECTORY)/progs/xdemos/Makefile*		\
+	$(DIRECTORY)/progs/xdemos/descrip.mms		\
+	$(DIRECTORY)/progs/xdemos/*.[chf]		\
+	$(DIRECTORY)/progs/redbook/Makefile*		\
+	$(DIRECTORY)/progs/redbook/README		\
+	$(DIRECTORY)/progs/redbook/*.[ch]		\
+	$(DIRECTORY)/progs/samples/Makefile*		\
+	$(DIRECTORY)/progs/samples/README		\
+	$(DIRECTORY)/progs/samples/*.c			\
+	$(DIRECTORY)/progs/windml/Makefile.ugl		\
+	$(DIRECTORY)/progs/windml/*.c			\
+	$(DIRECTORY)/progs/windml/*.bmp			\
+	$(DIRECTORY)/progs/ggi/*.c
+
+
+lib_gz:
+	rm -f configs/current ; \
+	cd .. ; \
+	tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \
+	gzip $(LIB_NAME).tar ; \
+	mv $(LIB_NAME).tar.gz $(DIRECTORY)
+
+demo_gz:
+	cd .. ; \
+	tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \
+	gzip $(DEMO_NAME).tar ; \
+	mv $(DEMO_NAME).tar.gz $(DIRECTORY)
+
+lib_bz2:
+	rm -f configs/current ; \
+	cd .. ; \
+	tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \
+	bzip2 $(LIB_NAME).tar ; \
+	mv $(LIB_NAME).tar.bz2 $(DIRECTORY)
+
+demo_bz2:
+	cd .. ; \
+	tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \
+	bzip2 $(DEMO_NAME).tar ; \
+	mv $(DEMO_NAME).tar.bz2 $(DIRECTORY)
+
+lib_zip:
+	rm -f configs/current ; \
+	-rm $(LIB_NAME).zip ; \
+	cd .. ; \
+	zip -r $(LIB_NAME).zip $(LIB_FILES) ; \
+	mv $(LIB_NAME).zip $(DIRECTORY)
+
+demo_zip:
+	-rm $(DEMO_NAME).zip ; \
+	cd .. ; \
+	zip -r $(DEMO_NAME).zip $(DEMO_FILES) ; \
+	mv $(DEMO_NAME).zip $(DIRECTORY)
+
+md5:
+	@-md5sum $(LIB_NAME).tar.gz
+	@-md5sum $(LIB_NAME).tar.bz2
+	@-md5sum $(LIB_NAME).zip
+	@-md5sum $(DEMO_NAME).tar.gz
+	@-md5sum $(DEMO_NAME).tar.bz2
+	@-md5sum $(DEMO_NAME).zip
+
+# Everything for new a Mesa release:
+tarballs: lib_gz demo_gz lib_bz2 demo_bz2 lib_zip demo_zip md5
diff --git a/progs/Makefile b/progs/Makefile
new file mode 100644
index 0000000..f925de5
--- /dev/null
+++ b/progs/Makefile
@@ -0,0 +1,27 @@
+# progs/Makefile
+
+TOP = ..
+
+include $(TOP)/configs/current
+
+SUBDIRS = $(PROGRAM_DIRS)
+
+
+default: $(TOP)/configs/current
+	@for dir in $(SUBDIRS) ; do \
+		if [ -d $$dir ] ; then \
+			pushd $$dir ; \
+			make ; \
+			popd ; \
+		fi \
+	done
+
+
+clean:
+	@for dir in $(SUBDIRS) ; do \
+		if [ -d $$dir ] ; then \
+			pushd $$dir ; \
+			make clean; \
+			popd ; \
+		fi \
+	done
diff --git a/progs/demos/Makefile b/progs/demos/Makefile
new file mode 100644
index 0000000..85cde5b
--- /dev/null
+++ b/progs/demos/Makefile
@@ -0,0 +1,92 @@
+# progs/demos/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+INCDIR = $(TOP)/include
+
+OSMESA_LIBS = -L$(LIB_DIR) -lglut -lOSMesa -lGLU -lGL $(APP_LIB_DEPS)
+
+LIB_DEP = $(LIB_DIR)/$(GL_LIB) $(LIB_DIR)/$(GLU_LIB) $(LIB_DIR)/$(GLUT_LIB)
+
+PROGS = \
+	arbfplight \
+	arbocclude \
+	bounce \
+	clearspd \
+	cubemap \
+	drawpix \
+	fire \
+	fplight \
+	gamma \
+	gears \
+	geartrain \
+	glinfo \
+	gloss \
+	gltestperf \
+	glutfx \
+	isosurf \
+	ipers \
+	lodbias \
+	morph3d \
+	multiarb \
+	occlude \
+	osdemo \
+	paltex \
+	pixeltex \
+	pointblast \
+	ray \
+	readpix \
+	reflect \
+	renormal \
+	shadowtex \
+	spectex \
+	spriteblast \
+	stex3d \
+	teapot \
+	terrain \
+	tessdemo \
+	texcyl \
+	texdown \
+	texenv \
+	texobj \
+	trispd \
+	tunnel \
+	tunnel2 \
+	winpos
+
+
+##### RULES #####
+
+.SUFFIXES:
+.SUFFIXES: .c
+
+
+# make executable from .c file:
+.c: $(LIB_DEP)
+	$(CC) -I$(INCDIR) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
+
+
+##### TARGETS #####
+
+default: readtex.c readtex.h $(PROGS)
+
+
+clean:
+	-rm -f *.o *~
+
+realclean:
+	-rm -f $(PROGS)
+	-rm -f *.o *~
+	-rm -f readtex.[ch]
+
+
+readtex.c:
+	cp $(TOP)/progs/util/readtex.c .
+
+readtex.h:
+	cp $(TOP)/progs/util/readtex.h .
+
+# special case: need the -lOSMesa library:
+osdemo: osdemo.c
+	$(CC) -I$(INCDIR) $(CFLAGS) osdemo.c $(OSMESA_LIBS) -o $@
diff --git a/progs/miniglx/Makefile b/progs/miniglx/Makefile
new file mode 100644
index 0000000..6e6b0a8
--- /dev/null
+++ b/progs/miniglx/Makefile
@@ -0,0 +1,58 @@
+# Makefile for miniglx demo programs
+
+TOP = ../..
+
+include $(TOP)/configs/current
+
+
+SOURCES = miniglxtest.c \
+	miniglxsample.c \
+	sample_server.c \
+	sample_server2.c \
+	manytex.c \
+	texline.c
+
+OBJECTS = $(SOURCES:.c=.o)
+
+PROGS = $(SOURCES:%.c=%)
+
+INCLUDES = \
+	-I. \
+	-I$(TOP)/include
+
+
+##### RULES #####
+
+.SUFFIXES:
+.SUFFIXES: .c
+
+.c:
+	$(CC) $(INCLUDES) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
+
+.c.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
+
+.S.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
+
+
+##### TARGETS #####
+
+default:  depend $(PROGS)
+
+clean:
+	rm -f $(PROGS)
+	rm -f *.o
+
+
+depend: $(SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(INCLUDES) $(SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+include depend
diff --git a/progs/redbook/Makefile b/progs/redbook/Makefile
new file mode 100644
index 0000000..f423108
--- /dev/null
+++ b/progs/redbook/Makefile
@@ -0,0 +1,41 @@
+# progs/redbook/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+INCDIR = $(TOP)/include
+
+LIB_DEP = $(LIB_DIR)/$(GL_LIB) $(LIB_DIR)/$(GLU_LIB) $(LIB_DIR)/$(GLUT_LIB)
+
+PROGS = aaindex aapoly aargb accanti accpersp alpha alpha3D anti \
+	bezcurve bezmesh checker clip colormat cube depthcue dof \
+	double drawf feedback fog fogindex font hello image light \
+	lines list material mipmap model movelight nurbs pickdepth \
+	picksquare plane planet polyoff polys quadric robot sccolorlight \
+	scene scenebamb sceneflat select smooth stencil stroke surface \
+	teaambient teapots tess tesswind texbind texgen texprox texsub \
+	texturesurf torus trim unproject varray wrap 
+
+
+
+##### RULES #####
+
+.SUFFIXES:
+.SUFFIXES: .c
+
+.c: $(LIB_DEP)
+	$(CC) -I$(INCDIR) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
+
+
+
+##### TARGETS ######
+
+default: $(PROGS)
+
+clean:
+	-rm -f *.o *~
+
+realclean:
+	-rm -f $(PROGS)
+	-rm -f *.o *~
+
diff --git a/progs/samples/Makefile b/progs/samples/Makefile
new file mode 100644
index 0000000..464492d
--- /dev/null
+++ b/progs/samples/Makefile
@@ -0,0 +1,34 @@
+# progs/samples/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+INCDIR = $(TOP)/include
+
+LIB_DEP = $(LIB_DIR)/$(GL_LIB) $(LIB_DIR)/$(GLU_LIB) $(LIB_DIR)/$(GLUT_LIB)
+
+PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \
+	font line logo nurb oglinfo olympic overlay point prim quad select \
+	shape sphere star stencil stretch texture tri wave
+
+
+##### RULES #####
+
+.SUFFIXES:
+.SUFFIXES: .c
+
+.c: $(LIB_DEP)
+	$(CC) -I$(INCDIR) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
+
+
+
+##### TARGETS #####
+
+default: $(PROGS)
+
+clean:
+	-rm -f *.o *~
+
+realclean:
+	-rm -f $(PROGS)
+	-rm -f *.o *~
diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
new file mode 100644
index 0000000..0904ee3
--- /dev/null
+++ b/progs/xdemos/Makefile
@@ -0,0 +1,79 @@
+# progs/xdemos/Makefile
+
+TOP = ../../
+include $(TOP)/configs/current
+
+
+INCDIR = $(TOP)/include
+
+LIBS = -L$(LIB_DIR) $(APP_LIB_DEPS)
+
+LIB_DEP = $(LIB_DIR)/$(GL_LIB) $(LIB_DIR)/$(GLU_LIB)
+
+PROGS = glthreads \
+	glxdemo \
+	glxgears \
+	glxheads \
+	glxinfo \
+	glxpixmap \
+	glxpbdemo \
+	glxswapcontrol \
+	manywin \
+	offset \
+	pbinfo \
+	pbdemo \
+	wincopy \
+	xdemo \
+	xfont \
+	xrotfontdemo
+
+
+
+##### RULES #####
+
+.SUFFIXES:
+.SUFFIXES: .c
+
+.c: $(LIB_DEP)
+	$(CC) -I$(INCDIR) $(CFLAGS) $< $(LIBS) -o $@
+
+
+##### TARGETS #####
+
+default: $(PROGS)
+
+
+clean:
+	-rm -f *.o *~
+
+realclean:
+	-rm -f $(PROGS)
+	-rm -f *.o *~
+
+
+# special cases
+pbinfo: pbinfo.o pbutil.o
+	$(CC) pbinfo.o pbutil.o $(LIBS) -o $@
+
+pbdemo: pbdemo.o pbutil.o
+	$(CC) pbdemo.o pbutil.o $(LIBS) -o $@
+
+pbinfo.o: pbinfo.c pbutil.h
+	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbinfo.c
+
+pbdemo.o: pbdemo.c pbutil.h
+	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbdemo.c
+
+pbutil.o: pbutil.c pbutil.h
+	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbutil.c
+
+
+xrotfontdemo: xrotfontdemo.o xuserotfont.o
+	$(CC) xrotfontdemo.o xuserotfont.o $(LIBS) -o $@
+
+xuserotfont.o: xuserotfont.c xuserotfont.h
+	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) xuserotfont.c
+
+xrotfontdemo.o: xrotfontdemo.c xuserotfont.h
+	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) xrotfontdemo.c
+
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..7f8dfd0
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,34 @@
+# src/Makefile
+
+TOP = ..
+
+include $(TOP)/configs/current
+
+SUBDIRS = $(SRC_DIRS)
+
+
+default: $(LIB_DIR) subdirs
+
+
+subdirs:
+	@for dir in $(SUBDIRS) ; do \
+		if [ -d $$dir ] ; then \
+			pushd $$dir ; \
+			make ; \
+			popd ; \
+		fi \
+	done
+
+
+$(LIB_DIR):
+	-mkdir $(LIB_DIR)
+
+
+clean:
+	@for dir in $(SUBDIRS) ; do \
+		if [ -d $$dir ] ; then \
+			pushd $$dir ; \
+			make clean ; \
+			popd ; \
+		fi \
+	done
diff --git a/src/glu/Makefile b/src/glu/Makefile
new file mode 100644
index 0000000..4ddf090
--- /dev/null
+++ b/src/glu/Makefile
@@ -0,0 +1,24 @@
+# src/glu/Makefile
+
+TOP = ../..
+
+include $(TOP)/configs/current
+
+
+SUBDIRS = $(GLU_DIRS)
+
+
+default: $(TOP)/configs/current
+	@for dir in $(SUBDIRS) ; do \
+		pushd $$dir ; \
+		make ; \
+		popd ; \
+	done
+
+
+clean:
+	@for dir in $(SUBDIRS) ; do \
+		pushd $$dir ; \
+		make clean; \
+		popd ; \
+	done
diff --git a/src/glu/sgi/Makefile b/src/glu/sgi/Makefile
new file mode 100644
index 0000000..dd2fa1d
--- /dev/null
+++ b/src/glu/sgi/Makefile
@@ -0,0 +1,138 @@
+# src/glu/sgi/Makefile
+
+TOP = ../../..
+
+include $(TOP)/configs/current
+
+GLU_MAJOR = 1
+GLU_MINOR = 3
+GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
+
+INCDIRS = -I$(TOP)/include -Iinclude -Iinternals -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
+
+
+C_SOURCES = \
+	libutil/error.c		\
+	libutil/glue.c		\
+	libutil/mipmap.c	\
+	libutil/project.c	\
+	libutil/quad.c		\
+	libutil/registry.c	\
+	libtess/dict.c		\
+	libtess/geom.c		\
+	libtess/memalloc.c	\
+	libtess/mesh.c		\
+	libtess/normal.c	\
+	libtess/priorityq.c	\
+	libtess/render.c	\
+	libtess/sweep.c		\
+	libtess/tess.c		\
+	libtess/tessmono.c
+
+CC_SOURCES = \
+	libnurbs/interface/bezierEval.cc		\
+	libnurbs/interface/bezierPatch.cc		\
+	libnurbs/interface/bezierPatchMesh.cc		\
+	libnurbs/interface/glcurveval.cc		\
+	libnurbs/interface/glinterface.cc		\
+	libnurbs/interface/glrenderer.cc		\
+	libnurbs/interface/glsurfeval.cc		\
+	libnurbs/interface/incurveeval.cc		\
+	libnurbs/interface/insurfeval.cc		\
+	libnurbs/internals/arc.cc			\
+	libnurbs/internals/arcsorter.cc			\
+	libnurbs/internals/arctess.cc			\
+	libnurbs/internals/backend.cc			\
+	libnurbs/internals/basiccrveval.cc		\
+	libnurbs/internals/basicsurfeval.cc		\
+	libnurbs/internals/bin.cc			\
+	libnurbs/internals/bufpool.cc			\
+	libnurbs/internals/cachingeval.cc		\
+	libnurbs/internals/ccw.cc			\
+	libnurbs/internals/coveandtiler.cc		\
+	libnurbs/internals/curve.cc			\
+	libnurbs/internals/curvelist.cc			\
+	libnurbs/internals/curvesub.cc			\
+	libnurbs/internals/dataTransform.cc		\
+	libnurbs/internals/displaylist.cc		\
+	libnurbs/internals/flist.cc			\
+	libnurbs/internals/flistsorter.cc		\
+	libnurbs/internals/hull.cc			\
+	libnurbs/internals/intersect.cc			\
+	libnurbs/internals/knotvector.cc		\
+	libnurbs/internals/mapdesc.cc			\
+	libnurbs/internals/mapdescv.cc			\
+	libnurbs/internals/maplist.cc			\
+	libnurbs/internals/mesher.cc			\
+	libnurbs/internals/monoTriangulationBackend.cc	\
+	libnurbs/internals/monotonizer.cc		\
+	libnurbs/internals/mycode.cc			\
+	libnurbs/internals/nurbsinterfac.cc		\
+	libnurbs/internals/nurbstess.cc			\
+	libnurbs/internals/patch.cc			\
+	libnurbs/internals/patchlist.cc			\
+	libnurbs/internals/quilt.cc			\
+	libnurbs/internals/reader.cc			\
+	libnurbs/internals/renderhints.cc		\
+	libnurbs/internals/slicer.cc			\
+	libnurbs/internals/sorter.cc			\
+	libnurbs/internals/splitarcs.cc			\
+	libnurbs/internals/subdivider.cc		\
+	libnurbs/internals/tobezier.cc			\
+	libnurbs/internals/trimline.cc			\
+	libnurbs/internals/trimregion.cc		\
+	libnurbs/internals/trimvertpool.cc		\
+	libnurbs/internals/uarray.cc			\
+	libnurbs/internals/varray.cc			\
+	libnurbs/nurbtess/directedLine.cc		\
+	libnurbs/nurbtess/gridWrap.cc			\
+	libnurbs/nurbtess/monoChain.cc			\
+	libnurbs/nurbtess/monoPolyPart.cc		\
+	libnurbs/nurbtess/monoTriangulation.cc		\
+	libnurbs/nurbtess/partitionX.cc			\
+	libnurbs/nurbtess/partitionY.cc			\
+	libnurbs/nurbtess/polyDBG.cc			\
+	libnurbs/nurbtess/polyUtil.cc			\
+	libnurbs/nurbtess/primitiveStream.cc		\
+	libnurbs/nurbtess/quicksort.cc			\
+	libnurbs/nurbtess/rectBlock.cc			\
+	libnurbs/nurbtess/sampleComp.cc			\
+	libnurbs/nurbtess/sampleCompBot.cc		\
+	libnurbs/nurbtess/sampleCompRight.cc		\
+	libnurbs/nurbtess/sampleCompTop.cc		\
+	libnurbs/nurbtess/sampleMonoPoly.cc		\
+	libnurbs/nurbtess/sampledLine.cc		\
+	libnurbs/nurbtess/searchTree.cc
+
+SOURCES = $(C_SOURCES) $(CC_SOURCES)
+
+C_OBJECTS = $(C_SOURCES:.c=.o)
+CC_OBJECTS = $(CC_SOURCES:.cc=.o)
+OBJECTS = $(C_OBJECTS) $(CC_OBJECTS)
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(INCDIRS) $(CFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
+
+.cc.o:
+	$(CXX) -c $(INCDIRS) $(CXXFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
+
+
+##### TARGETS #####
+
+default: $(LIB_DIR)/$(GLU_LIB_NAME)
+
+# Make the library:
+$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
+	$(TOP)/bin/mklib -o $(GLU_LIB) -major $(GLU_MAJOR) \
+		-minor $(GLU_MINOR) -patch $(GLU_TINY) \
+		-cplusplus $(MKLIB_OPTIONS) -install $(LIB_DIR) \
+		$(GLU_LIB_DEPS) $(OBJECTS)
+
+
+clean:
+	-rm -f *.o */*.o */*/*.o
+	-rm -f *.lo */*.lo */*/*.lo
+	-rm -f *.la */*.la */*/*.la
diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile
new file mode 100644
index 0000000..83f66b0
--- /dev/null
+++ b/src/glut/glx/Makefile
@@ -0,0 +1,111 @@
+# Makefile for GLUT
+#
+# NOTICE:  The OpenGL Utility Toolkit (GLUT) distribution contains source
+# code published in a book titled "Programming OpenGL for the X Window
+# System" (ISBN: 0-201-48359-9) published by Addison-Wesley.  The
+# programs and associated files contained in the distribution were
+# developed by Mark J. Kilgard and are Copyright 1994, 1995, 1996 by Mark
+# J. Kilgard (unless otherwise noted).  The programs are not in the
+# public domain, but they are freely distributable without licensing
+# fees.  These programs are provided without guarantee or warrantee
+# expressed or implied.
+#
+# GLUT source included with Mesa with permission from Mark Kilgard.
+
+
+TOP = ../../..
+
+include $(TOP)/configs/current
+
+
+##### MACROS #####
+
+GLUT_MAJOR = 3
+GLUT_MINOR = 7
+GLUT_TINY = 1
+
+SOURCES = \
+	glut_8x13.c \
+	glut_9x15.c \
+	glut_bitmap.c \
+	glut_bwidth.c \
+	glut_cindex.c \
+	glut_cmap.c \
+	glut_cursor.c \
+	glut_dials.c \
+	glut_dstr.c \
+	glut_event.c \
+	glut_ext.c \
+	glut_fbc.c \
+	glut_fullscrn.c \
+	glut_gamemode.c \
+	glut_get.c \
+	glut_glxext.c \
+	glut_hel10.c \
+	glut_hel12.c \
+	glut_hel18.c \
+	glut_init.c \
+	glut_input.c \
+	glut_joy.c \
+	glut_key.c \
+	glut_keyctrl.c \
+	glut_keyup.c \
+	glut_menu.c \
+	glut_menu2.c \
+	glut_mesa.c \
+	glut_modifier.c \
+	glut_mroman.c \
+	glut_overlay.c \
+	glut_roman.c \
+	glut_shapes.c \
+	glut_space.c \
+	glut_stroke.c \
+	glut_swap.c \
+	glut_swidth.c \
+	glut_tablet.c \
+	glut_teapot.c \
+	glut_tr10.c \
+	glut_tr24.c \
+	glut_util.c \
+	glut_vidresize.c \
+	glut_warp.c \
+	glut_win.c \
+	glut_winmisc.c \
+	layerutil.c
+
+
+OBJECTS = $(SOURCES:.c=.o)
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c -I$(TOP)/include $(CFLAGS) $(GLUT_CFLAGS) $<
+
+
+
+##### TARGETS #####
+
+default: $(LIB_DIR)/$(GLUT_LIB_NAME)
+
+
+# Make the library
+$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
+	$(TOP)/bin/mklib -o $(GLUT_LIB) \
+		-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \
+		-patch $(GLUT_TINY) $(MKLIB_OPTIONS) -install $(LIB_DIR) \
+		$(GLUT_LIB_DEPS) $(OBJECTS)
+
+
+clean:
+	-rm -f *.o *~
+	-rm -f *.lo
+	-rm -f *.la
+	-rm -rf .libs
+
+
+depend: $(SOURCES)
+	touch depend
+	makedepend -fdepend -Y -I$(TOP)/include $(SOURCES)
+
+include depend
diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile
new file mode 100644
index 0000000..5c0f5f7
--- /dev/null
+++ b/src/glut/mini/Makefile
@@ -0,0 +1,80 @@
+# subset glut
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+MARK = $(TOP)/src/glut/glx
+
+GLUT_MAJOR = 3
+GLUT_MINOR = 7
+GLUT_TINY = 1
+
+INCLUDES = -I$(TOP)/include -I$(MARK)
+
+CORE_SOURCES = \
+	bitmap.c \
+	callback.c \
+	color.c \
+	globals.c \
+	init.c \
+	menu.c \
+	models.c \
+	overlay.c \
+	state.c \
+	teapot.c \
+	window.c
+
+
+MARK_SOURCES = \
+	$(MARK)/glut_8x13.c \
+	$(MARK)/glut_9x15.c \
+	$(MARK)/glut_hel10.c \
+	$(MARK)/glut_hel12.c \
+	$(MARK)/glut_hel18.c \
+	$(MARK)/glut_tr10.c \
+	$(MARK)/glut_tr24.c
+
+SOURCES = $(CORE_SOURCES)  $(MARK_SOURCES)
+
+OBJECTS =  $(SOURCES:.c=.o)
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend $(LIB_DIR)/$(GLUT_LIB_NAME)
+
+
+# Make the library
+$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
+	$(TOP)/bin/mklib -o $(GLUT_LIB) \
+		-major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \
+		-patch $(GLUT_TINY) $(GLUT_LIB_DEPS) -install $(LIB_DIR) \
+		$(MKLIB_OPTIONS) $(OBJECTS)
+
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(SOURCES) 
+	touch depend
+	makedepend -fdepend -Y $(INCLUDES) $(SOURCES) >& /dev/null
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean: depend
+	-rm -f depend
+	-rm -f *.o *~ *.o *~ *.so libglut.so.3.7
+
+include depend
diff --git a/src/glw/Makefile b/src/glw/Makefile
index 73fcc4d..d5ec4d9 100644
--- a/src/glw/Makefile
+++ b/src/glw/Makefile
@@ -1 +1,48 @@
-include Makefile.X11
+# src/glw/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+MAJOR = 1
+MINOR = 0
+TINY = 0
+
+INCDIRS = -I$(TOP)/include -I/usr/include/Motif1.2 -I/usr/contrib/X11R6/include -I/usr/X11R6/include
+
+
+OBJECTS = $(GLW_SOURCES:.c=.o)
+
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(INCDIRS) $(CFLAGS) $<
+
+
+
+##### TARGETS #####
+
+default: $(LIB_DIR)/$(GLW_LIB_NAME)
+
+
+clean:
+	-rm -f *.o *~
+
+# Make the library
+$(LIB_DIR)/$(GLW_LIB_NAME): $(OBJECTS)
+	$(TOP)/bin/mklib -o $(GLW_LIB) -major $(MAJOR) -minor $(MINOR) \
+		-patch $(TINY) $(MKLIB_OPTIONS) -install $(LIB_DIR) \
+		$(GLW_LIB_DEPS) $(OBJECTS)
+
+
+#
+# Run 'make depend' to update the dependencies if you change what's included
+# by any source file.
+# 
+depend: $(GLW_SOURCES)
+	touch depend
+	makedepend -fdepend -Y -I$(TOP)/include $(GLW_SOURCES)
+
+
+include depend
diff --git a/src/glx/Makefile b/src/glx/Makefile
new file mode 100644
index 0000000..d6bef10
--- /dev/null
+++ b/src/glx/Makefile
@@ -0,0 +1,12 @@
+
+TOP = ../..
+include $(TOP)/configs/current
+
+
+default:
+	cd mini ; make
+
+
+clean:
+	cd mini ; make clean
+
diff --git a/src/glx/mini/Makefile b/src/glx/mini/Makefile
new file mode 100644
index 0000000..c8ed541
--- /dev/null
+++ b/src/glx/mini/Makefile
@@ -0,0 +1,74 @@
+# Build a subset DRI-based libGL.so library.
+# Indirect rendering not supported, etc.
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+
+C_SOURCES = dispatch.c \
+	  dri_util.c \
+	  ../../mesa/glapi/glapi.c \
+	  ../../mesa/glapi/glthread.c \
+	  miniglx.c \
+	  miniglx_events.c \
+	  xf86drm.c 
+
+OBJECTS = $(C_SOURCES:.c=.o)
+
+INCLUDES = -I. $(INCLUDE_DIRS)
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup \
+	-I$(TOP)/src/mesa/drivers/dri/drm/shared
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend $(LIB_DIR)/$(GL_LIB_NAME)
+
+
+# Make libGL
+$(LIB_DIR)/$(GL_LIB_NAME):  $(OBJECTS) Makefile
+	$(TOP)/bin/mklib -o $(GL_LIB) -major 1 -minor 2 $(MKLIB_OPTIONS) \
+		-install $(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS)
+	rm -f $(LIB_DIR)/miniglx.conf
+	install example.miniglx.conf $(LIB_DIR)/miniglx.conf
+
+
+drmtest: xf86drm.o drmtest.o
+	rm -f drmtest && $(CC) -o drmtest xf86drm.o drmtest.o
+
+
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f drmtest $(LIB_DIR)/libGL.so*
+	-rm -f *.o *~
+	-rm -f depend
+
+include depend
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
new file mode 100644
index 0000000..e614996
--- /dev/null
+++ b/src/mesa/Makefile
@@ -0,0 +1,174 @@
+# src/mesa/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+include sources
+
+
+GL_MAJOR = 1
+GL_MINOR = 5
+GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
+
+
+.c.o:
+	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+
+.S.o:
+	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+
+
+# Figure out what to make here
+default:
+	@if [ "${DRIVER_DIRS}" = "dri" ] ; then \
+		make linux-solo ; \
+	elif [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
+		make osmesa-only ; \
+	else \
+		make stand-alone ; \
+	fi
+
+
+######################################################################
+# Linux solo DRI drivers
+
+SOLO_SOURCES = \
+	$(MAIN_SOURCES)		\
+	$(MATH_SOURCES)		\
+	$(ARRAY_CACHE_SOURCES)	\
+	$(TNL_SOURCES)		\
+	$(SWRAST_SOURCES)	\
+	$(SWRAST_SETUP_SOURCES)	\
+	$(ASM_C_SOURCES)	\
+	$(X86_SOURCES)
+
+SOLO_OBJECTS = $(SOLO_SOURCES:.c=.o)
+
+
+linux-solo: depend mesa.a drivers
+
+# Make archive of core object files
+mesa.a:	$(SOLO_OBJECTS)
+	rm -f $@
+	ar rcv $@ $(SOLO_OBJECTS)
+	ranlib $@
+
+drivers:
+	cd drivers/dri ; make
+
+
+######################################################################
+# Stand-alone Mesa libGL and libOSMesa
+
+STAND_ALONE_DRIVER_SOURCES = \
+	$(COMMON_DRIVER_SOURCES) \
+	$(X11_DRIVER_SOURCES) \
+	$(GLIDE_DRIVER_SOURCES) \
+	$(SVGA_DRIVER_SOURCES) \
+	$(FBDEV_DRIVER_SOURCES)
+
+STAND_ALONE_SOURCES = \
+	$(CORE_SOURCES) \
+	$(ASM_SOURCES) \
+	$(STAND_ALONE_DRIVER_SOURCES)
+
+# ASM_SOURCES is defined in the config file
+ASM_OBJECTS = $(ASM_SOURCES:.S=.o)
+
+STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
+
+STAND_ALONE_OBJECTS = \
+	$(CORE_OBJECTS) \
+	$(ASM_OBJECTS) \
+	$(STAND_ALONE_DRIVER_OBJECTS)
+
+# For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library,
+# not just the osmesa.o object (i.e. we don't have a libGL).
+OSMESA16_OBJECTS = \
+	$(CORE_OBJECTS) \
+	$(ASM_OBJECTS) \
+	$(COMMON_DRIVER_OBJECTS) \
+	$(OSMESA_DRIVER_OBJECTS)
+
+
+
+stand-alone: depend subdirs $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(OSMESA_LIB_NAME)
+
+osmesa-only: depend subdirs $(LIB_DIR)/$(OSMESA_LIB_NAME)
+
+subdirs:
+	@pushd x86 ; \
+	make ; \
+	popd
+
+# Make the GL library
+$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
+	$(TOP)/bin/mklib -o $(GL_LIB) -major $(GL_MAJOR) \
+		-minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIB_DIR) \
+		$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS)
+
+# Make the OSMesa library
+$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
+	if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
+		$(TOP)/bin/mklib -o $(OSMESA_LIB) -major $(MESA_MAJOR) \
+			-minor $(MESA_MINOR) -patch $(MESA_TINY) \
+			-install $(LIB_DIR) $(MKLIB_OPTIONS) \
+			$(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
+	else \
+		$(TOP)/bin/mklib -o $(OSMESA_LIB) -major $(MESA_MAJOR) \
+			-minor $(MESA_MINOR) -patch $(GL_TINY) \
+			-install $(LIB_DIR) $(MKLIB_OPTIONS) \
+			$(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \
+	fi
+
+
+######################################################################
+# 16 (or 32) bit/channel OSMesa
+
+# $(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA16_OBJECTS)
+#	$(TOP)/bin/mklib -o $(OSMESA_LIB) \
+#		-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
+#		-install $(LIB_DIR) \
+#		$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OSMESA16_OBJECTS)
+
+
+
+######################################################################
+# Generic stuff
+
+ALL_SOURCES = \
+	$(GLAPI_SOURCES)	\
+	$(MAIN_SOURCES)		\
+	$(MATH_SOURCES)		\
+	$(ARRAY_CACHE_SOURCES)	\
+	$(TNL_SOURCES)		\
+	$(SWRAST_SOURCES)	\
+	$(SWRAST_SETUP_SOURCES)	\
+	$(ASM_C_SOURCES)	\
+	$(X86_SOURCES)		\
+	$(COMMON_DRIVER_SOURCES)
+
+
+SUBDIRS = array_cache drivers/dri glapi main math sparc swrast swrast_setup \
+	tnl tnl_dd
+
+
+# Update dependencies
+depend: $(ALL_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(INCLUDE_DIRS) $(ALL_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+clean:
+	-rm -f */*.o
+	for dir in $(SUBDIRS) ; do \
+		pushd $$dir ; \
+		make clean ; \
+		popd ; \
+	done
+
+include depend
diff --git a/src/mesa/drivers/dri/Makefile b/src/mesa/drivers/dri/Makefile
new file mode 100644
index 0000000..5a961e9
--- /dev/null
+++ b/src/mesa/drivers/dri/Makefile
@@ -0,0 +1,31 @@
+# src/mesa/drivers/dri/Makefile
+
+TOP = ../../../..
+
+include $(TOP)/configs/current
+
+#SUBDIRS = fb ffb gamma i810 i830 mach64 mga r128 r200 radeon sis tdfx unichrome
+SUBDIRS = fb gamma i810 i830 mach64 mga r128 r200 radeon sis tdfx
+
+
+default: $(LIB_DIR) subdirs
+
+
+$(LIB_DIR):
+	-mkdir $(LIB_DIR)
+
+
+subdirs:
+	@for dir in $(SUBDIRS) ; do \
+		pushd $$dir ; \
+		make ; \
+		popd ; \
+	done
+
+
+clean:
+	@for dir in $(SUBDIRS) ; do \
+		pushd $$dir ; \
+		make clean ; \
+		popd ; \
+	done
diff --git a/src/mesa/drivers/dri/fb/Makefile b/src/mesa/drivers/dri/fb/Makefile
new file mode 100644
index 0000000..2d1253e
--- /dev/null
+++ b/src/mesa/drivers/dri/fb/Makefile
@@ -0,0 +1,75 @@
+# src/mesa/drivers/dri/fb/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+DRIVER_SOURCES = fb_dri.c
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(DRI_SOURCES) 
+
+ASM_SOURCES = 
+
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend fb_dri.so
+
+fb_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc -lm
+	rm -f $(LIB_DIR)/fb_dri.so && \
+	install fb_dri.so $(LIB_DIR)/fb_dri.so
+
+$(LIB_DIR)/fb_dri.so:	fb_dri.so
+	rm -f $(LIB_DIR)/fb_dri.so && \
+	install fb_dri.so $(LIB_DIR)/fb_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o *~ *.o *~ *.so
+
+include depend
diff --git a/src/mesa/drivers/dri/ffb/Makefile b/src/mesa/drivers/dri/ffb/Makefile
new file mode 100644
index 0000000..a761bad
--- /dev/null
+++ b/src/mesa/drivers/dri/ffb/Makefile
@@ -0,0 +1,126 @@
+# src/mesa/drivers/dri/ffb/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+# not yet
+# MINIGLX_SOURCES = server/ffb_dri.c 
+
+DRIVER_SOURCES = ffb_bitmap.c \
+		 ../../common/driverfuncs.c \
+		 ../common/mm.c \
+		 ../common/utils.c \
+		 ../common/texmem.c \
+		 ../common/vblank.c \
+		 ../common/xmlconfig.c \
+		 ffb_clear.c \
+		 ffb_dd.c \
+		 ffb_depth.c \
+		 ffb_fog.c \
+		 ffb_lines.c \
+		 ffb_points.c \
+		 ffb_span.c \
+		 ffb_state.c \
+		 ffb_stencil.c \
+		 ffb_tex.c \
+		 ffb_tris.c \
+		 ffb_vb.c \
+		 ffb_vtxfmt.c \
+		 ffb_xmesa.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+$(SYMLINKS):
+	mkdir -p server
+	cd server
+	rm -f $@ && ln -s ../../radeon/$@ $@
+
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend ffb_dri.so
+
+ffb_dri.so:  $(SYMLINKS) $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/ffb_dri.so && \
+	install ffb_dri.so $(LIB_DIR)/ffb_dri.so
+
+$(LIB_DIR)/ffb_dri.so:	ffb_dri.so
+	rm -f $(LIB_DIR)/ffb_dri.so && \
+	install ffb_dri.so $(LIB_DIR)/ffb_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+	-rm -f $(SYMLINKS)
+
+
+include depend
diff --git a/src/mesa/drivers/dri/gamma/Makefile b/src/mesa/drivers/dri/gamma/Makefile
new file mode 100644
index 0000000..8faf631
--- /dev/null
+++ b/src/mesa/drivers/dri/gamma/Makefile
@@ -0,0 +1,117 @@
+# src/mesa/drivers/dri/gamma/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+# Not yet
+# MINIGLX_SOURCES = server/gamma_dri.c 
+
+DRIVER_SOURCES = \
+		gamma_context.c \
+		gamma_dd.c \
+		gamma_inithw.c \
+		gamma_lock.c \
+		gamma_render.c \
+		gamma_screen.c \
+		gamma_span.c \
+		gamma_state.c \
+		gamma_tex.c \
+		gamma_texmem.c \
+		gamma_texstate.c \
+		gamma_tris.c \
+		gamma_vb.c \
+		gamma_xmesa.c \
+		../../common/driverfuncs.c \
+		../common/mm.c \
+		../common/utils.c \
+		../common/texmem.c \
+		../common/vblank.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend gamma_dri.so
+
+gamma_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/gamma_dri.so && \
+	install gamma_dri.so $(LIB_DIR)/gamma_dri.so
+
+$(LIB_DIR)/gamma_dri.so: gamma_dri.so
+	rm -f $(LIB_DIR)/gamma_dri.so && \
+	install gamma_dri.so $(LIB_DIR)/gamma_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+
+include depend
diff --git a/src/mesa/drivers/dri/i810/Makefile b/src/mesa/drivers/dri/i810/Makefile
new file mode 100644
index 0000000..c38a5a3
--- /dev/null
+++ b/src/mesa/drivers/dri/i810/Makefile
@@ -0,0 +1,116 @@
+# src/mesa/drivers/dri/i810/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+# Not yet
+# MINIGLX_SOURCES = server/i810_dri.c 
+
+DRIVER_SOURCES = \
+		i810context.c \
+		i810ioctl.c \
+		i810render.c \
+		i810screen.c \
+		i810span.c \
+		i810state.c \
+		i810tex.c \
+		i810texmem.c \
+		i810texstate.c \
+		i810tris.c \
+		i810vb.c \
+		../../common/driverfuncs.c \
+                ../common/mm.c \
+                ../common/utils.c \
+                ../common/texmem.c \
+                ../common/vblank.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend i810_dri.so
+
+i810_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/i810_dri.so && \
+	install i810_dri.so $(LIB_DIR)/i810_dri.so
+
+$(LIB_DIR)/i810_dri.so:	i810_dri.so
+	rm -f $(LIB_DIR)/i810_dri.so && \
+	install i810_dri.so $(LIB_DIR)/i810_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES)
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/drivers/dri/i830/Makefile b/src/mesa/drivers/dri/i830/Makefile
new file mode 100644
index 0000000..55a2872
--- /dev/null
+++ b/src/mesa/drivers/dri/i830/Makefile
@@ -0,0 +1,115 @@
+# src/mesa/drivers/dri/i830/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+# Not yet
+# MINIGLX_SOURCES = server/i830_dri.c 
+
+DRIVER_SOURCES = \
+		i830_context.c \
+		i830_debug.c \
+		i830_ioctl.c \
+		i830_render.c \
+		i830_screen.c \
+		i830_span.c \
+		i830_state.c \
+		i830_tex.c \
+		i830_texmem.c \
+		i830_texstate.c \
+		i830_tris.c \
+		../../common/driverfuncs.c \
+                ../common/mm.c \
+                ../common/utils.c \
+                ../common/texmem.c \
+                ../common/vblank.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend i830_dri.so
+
+i830_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/i830_dri.so && \
+	install i830_dri.so $(LIB_DIR)/i830_dri.so
+
+$(LIB_DIR)/i830_dri.so:	i830_dri.so
+	rm -f $(LIB_DIR)/i830_dri.so && \
+	install i830_dri.so $(LIB_DIR)/i830_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES)
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/drivers/dri/mach64/Makefile b/src/mesa/drivers/dri/mach64/Makefile
new file mode 100644
index 0000000..8cfceaf
--- /dev/null
+++ b/src/mesa/drivers/dri/mach64/Makefile
@@ -0,0 +1,116 @@
+# src/mesa/drivers/dri/mach64/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+# Not yet
+# MINIGLX_SOURCES = server/mach64_dri.c 
+
+DRIVER_SOURCES = \
+		mach64_context.c \
+		mach64_ioctl.c \
+		mach64_screen.c \
+		mach64_span.c \
+		mach64_state.c \
+		mach64_tex.c \
+		mach64_texmem.c \
+		mach64_texstate.c \
+		mach64_tris.c \
+		mach64_vb.c \
+		mach64_dd.c \
+		mach64_lock.c \
+		../../common/driverfuncs.c \
+                ../common/mm.c \
+                ../common/utils.c \
+                ../common/texmem.c \
+                ../common/vblank.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend mach64_dri.so
+
+mach64_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/mach64_dri.so && \
+	install mach64_dri.so $(LIB_DIR)/mach64_dri.so
+
+$(LIB_DIR)/mach64_dri.so: mach64_dri.so
+	rm -f $(LIB_DIR)/mach64_dri.so && \
+	install mach64_dri.so $(LIB_DIR)/mach64_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/drivers/dri/mga/Makefile b/src/mesa/drivers/dri/mga/Makefile
new file mode 100644
index 0000000..6f3bf8d
--- /dev/null
+++ b/src/mesa/drivers/dri/mga/Makefile
@@ -0,0 +1,122 @@
+# src/mesa/drivers/dri/mga/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING
+
+MINIGLX_SOURCES = server/mga_dri.c 
+
+DRIVER_SOURCES = mgadd.c \
+		 mgaioctl.c \
+		 mgarender.c \
+		 mgastate.c \
+		 mgatris.c \
+		 ../../common/driverfuncs.c \
+		 ../common/mm.c \
+		 ../common/utils.c \
+		 ../common/texmem.c \
+		 ../common/vblank.c \
+		 ../common/xmlconfig.c
+
+FULL_DRIVER_SOURCES = 	\
+		 mgapixel.c \
+		 mgaspan.c \
+		 mgatex.c \
+		 mgatexmem.c \
+		 mga_texstate.c \
+		 mga_texcombine.c \
+		 mgavb.c \
+		 mga_xmesa.c
+
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(MINIGLX_SOURCES) \
+	    $(FULL_DRIVER_SOURCES) \
+	    $(DRIVER_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend mga_dri.so
+
+mga_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/mga_dri.so && \
+	install mga_dri.so $(LIB_DIR)/mga_dri.so
+
+$(LIB_DIR)/mga_dri.so:	mga_dri.so
+	rm -f $(LIB_DIR)/mga_dri.so && \
+	install mga_dri.so $(LIB_DIR)/mga_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES)
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/drivers/dri/r128/Makefile b/src/mesa/drivers/dri/r128/Makefile
new file mode 100644
index 0000000..6424203
--- /dev/null
+++ b/src/mesa/drivers/dri/r128/Makefile
@@ -0,0 +1,116 @@
+# src/mesa/drivers/dri/r128/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+MINIGLX_SOURCES = server/r128_dri.c 
+
+DRIVER_SOURCES = \
+		r128_context.c \
+		r128_lock.c \
+		r128_state.c \
+		r128_texstate.c \
+		r128_dd.c \
+		r128_screen.c \
+		r128_tex.c \
+		r128_tris.c \
+		r128_ioctl.c \
+		r128_span.c \
+		r128_texmem.c \
+		r128_vb.c \
+		../../common/driverfuncs.c \
+		../common/mm.c \
+		../common/utils.c \
+		../common/texmem.c \
+		../common/vblank.c \
+		../common/xmlconfig.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend r128_dri.so
+
+r128_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/r128_dri.so && \
+	install r128_dri.so $(LIB_DIR)/r128_dri.so
+
+$(LIB_DIR)/r128_dri.so: r128_dri.so
+	rm -f $(LIB_DIR)/r128_dri.so && \
+	install r128_dri.so $(LIB_DIR)/r128_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
new file mode 100644
index 0000000..37b42d3
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -0,0 +1,141 @@
+# src/mesa/drivers/dri/r200/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+MINIGLX_SOURCES = server/radeon_dri.c 
+
+DRIVER_SOURCES = r200_context.c \
+		 r200_ioctl.c \
+		 r200_lock.c \
+		 r200_screen.c \
+		 r200_state.c \
+		 r200_state_init.c \
+		 ../../common/driverfuncs.c \
+		 ../common/mm.c \
+		 ../common/utils.c \
+		 ../common/texmem.c \
+		 ../common/vblank.c \
+		 ../common/xmlconfig.c \
+		 r200_cmdbuf.c \
+		 r200_pixel.c \
+		 r200_tex.c \
+		 r200_texmem.c \
+		 r200_texstate.c \
+		 r200_tcl.c \
+		 r200_swtcl.c \
+		 r200_span.c \
+		 r200_maos.c \
+		 r200_sanity.c \
+		 r200_vtxfmt.c \
+		 r200_vtxfmt_c.c \
+		 r200_vtxfmt_sse.c \
+		 r200_vtxfmt_x86.c 
+
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+SYMLINKS = \
+	server/radeon_common.h \
+	server/radeon_dri.c \
+	server/radeon_dri.h \
+	server/radeon.h \
+	server/radeon_macros.h \
+	server/radeon_reg.h \
+	server/radeon_sarea.h \
+
+
+$(SYMLINKS):
+	mkdir -p server
+	cd server
+	rm -f $@ && ln -s ../../radeon/$@ $@
+
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend r200_dri.so
+
+r200_dri.so:  $(SYMLINKS) $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/r200_dri.so && \
+	install r200_dri.so $(LIB_DIR)/r200_dri.so
+
+$(LIB_DIR)/r200_dri.so:	r200_dri.so
+	rm -f $(LIB_DIR)/r200_dri.so && \
+	install r200_dri.so $(LIB_DIR)/r200_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+	-rm -f $(SYMLINKS)
+
+
+include depend
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
new file mode 100644
index 0000000..9dd7c97
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -0,0 +1,154 @@
+# src/mesa/drivers/dri/radeon/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+ifeq ($(EMBEDDED),true)
+TARGET = radeon_es_dri.so
+DEFINES += \
+              -D_EMBEDDED \
+	-D_HAVE_SWRAST=0 \
+	-D_HAVE_SWTNL=0 \
+	-D_HAVE_SANITY=0 \
+	-D_HAVE_CODEGEN=0 \
+	-D_HAVE_LIGHTING=0 \
+	-D_HAVE_TEXGEN=0 \
+	-D_HAVE_USERCLIP=0 \
+	-DGLX_DIRECT_RENDERING
+else
+TARGET = radeon_dri.so
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING
+endif
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+MINIGLX_SOURCES = server/radeon_dri.c 
+
+DRIVER_SOURCES = radeon_context.c \
+		 radeon_ioctl.c \
+		 radeon_lock.c \
+		 radeon_screen.c \
+		 radeon_state.c \
+		 radeon_state_init.c \
+		 ../../common/driverfuncs.c \
+		 ../common/mm.c \
+		 ../common/utils.c \
+		 ../common/texmem.c \
+		 ../common/vblank.c \
+		 ../common/xmlconfig.c
+
+SUBSET_DRIVER_SOURCES = \
+		radeon_subset_bitmap.c \
+		radeon_subset_readpix.c \
+		radeon_subset_select.c \
+		radeon_subset_tex.c \
+		radeon_subset_vtx.c 
+
+FULL_DRIVER_SOURCES = 	\
+		 radeon_tex.c \
+		 radeon_texmem.c \
+		 radeon_texstate.c \
+		 radeon_tcl.c \
+		 radeon_swtcl.c \
+		 radeon_span.c \
+		 radeon_maos.c \
+		 radeon_sanity.c \
+	  	 radeon_compat.c \
+		 radeon_vtxfmt.c \
+		 radeon_vtxfmt_c.c \
+		 radeon_vtxfmt_sse.c \
+		 radeon_vtxfmt_x86.c 
+
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+ifeq ($(EMBEDDED),true)
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(SUBSET_DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+else
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(FULL_DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+endif
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend $(TARGET)
+
+$(TARGET):  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/$(TARGET) && \
+	install $(TARGET) $(LIB_DIR)/$(TARGET)
+
+$(LIB_DIR)/$(TARGET):	$(TARGET)
+	rm -f $(LIB_DIR)/$(TARGET) && \
+	install $(TARGET) $(LIB_DIR)/$(TARGET)
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES)\
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/drivers/dri/sis/Makefile b/src/mesa/drivers/dri/sis/Makefile
new file mode 100644
index 0000000..bd7b36d
--- /dev/null
+++ b/src/mesa/drivers/dri/sis/Makefile
@@ -0,0 +1,118 @@
+# src/mesa/drivers/dri/sis/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+# Not yet
+# MINIGLX_SOURCES = server/sis_dri.c 
+
+DRIVER_SOURCES = \
+		sis_alloc.c \
+		sis_clear.c \
+		sis_context.c \
+		sis_dd.c \
+		sis_fog.c \
+		sis_lock.c \
+		sis_screen.c \
+		sis_span.c \
+		sis_state.c \
+		sis_stencil.c \
+		sis_tex.c \
+		sis_texstate.c \
+		sis_tris.c \
+		sis_vb.c \
+		../../common/driverfuncs.c \
+                ../common/mm.c \
+                ../common/utils.c \
+                ../common/texmem.c \
+                ../common/vblank.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend sis_dri.so
+
+sis_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/sis_dri.so && \
+	install sis_dri.so $(LIB_DIR)/sis_dri.so
+
+$(LIB_DIR)/sis_dri.so:	sis_dri.so
+	rm -f $(LIB_DIR)/sis_dri.so && \
+	install sis_dri.so $(LIB_DIR)/sis_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/drivers/dri/tdfx/Makefile b/src/mesa/drivers/dri/tdfx/Makefile
new file mode 100644
index 0000000..8c6ebc1
--- /dev/null
+++ b/src/mesa/drivers/dri/tdfx/Makefile
@@ -0,0 +1,123 @@
+# src/mesa/drivers/dri/tdfx/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+# not yet
+# MINIGLX_SOURCES = server/tdfx_dri.c 
+
+DRIVER_SOURCES = tdfx_context.c \
+		../../common/driverfuncs.c \
+		 ../common/mm.c \
+		 ../common/utils.c \
+		 ../common/texmem.c \
+		 ../common/vblank.c \
+		 ../common/xmlconfig.c \
+		 tdfx_dd.c \
+		 tdfx_lock.c \
+		 tdfx_pixels.c \
+		 tdfx_render.c \
+		 tdfx_screen.c \
+		 tdfx_span.c \
+		 tdfx_state.c \
+		 tdfx_tex.c \
+		 tdfx_texman.c \
+		 tdfx_texstate.c \
+		 tdfx_tris.c \
+		 tdfx_vb.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+$(SYMLINKS):
+	mkdir -p server
+	cd server
+	rm -f $@ && ln -s ../../radeon/$@ $@
+
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend tdfx_dri.so
+
+tdfx_dri.so:  $(SYMLINKS) $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/tdfx_dri.so && \
+	install tdfx_dri.so $(LIB_DIR)/tdfx_dri.so
+
+$(LIB_DIR)/tdfx_dri.so:	tdfx_dri.so
+	rm -f $(LIB_DIR)/tdfx_dri.so && \
+	install tdfx_dri.so $(LIB_DIR)/tdfx_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+	-rm -f $(SYMLINKS)
+
+include depend
diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile
new file mode 100644
index 0000000..fe8f970
--- /dev/null
+++ b/src/mesa/drivers/dri/unichrome/Makefile
@@ -0,0 +1,117 @@
+# src/mesa/drivers/dri/unichrome/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/default
+
+SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver
+MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
+
+DEFINES += \
+	-D_HAVE_SWRAST=1 \
+	-D_HAVE_SWTNL=1 \
+	-D_HAVE_SANITY=1 \
+	-D_HAVE_CODEGEN=1 \
+	-D_HAVE_LIGHTING=1 \
+	-D_HAVE_TEXGEN=1 \
+	-D_HAVE_USERCLIP=1 \
+	-DGLX_DIRECT_RENDERING 
+
+MINIGLX_SOURCES = server/via_dri.c 
+
+DRIVER_SOURCES = \
+		via_context.c \
+		via_fb.c \
+		via_ioctl.c \
+		via_render.c \
+		via_screen.c \
+		via_span.c \
+		via_state.c \
+		via_tex.c \
+		via_texmem.c \
+		via_texstate.c \
+		via_tris.c \
+		via_vb.c \
+		xf86drmVIA.c \
+                ../common/mm.c \
+                ../common/utils.c \
+                ../common/texmem.c \
+                ../common/vblank.c \
+		../common/xmlconfig.c \
+		../../common/driverfuncs.c
+
+INCLUDES = $(MINIGLX_INCLUDES) \
+	   $(SHARED_INCLUDES)
+
+
+C_SOURCES = $(DRIVER_SOURCES) \
+	    $(MINIGLX_SOURCES) 
+
+MESA_MODULES = $(TOP)/src/mesa/mesa.a
+
+
+ifeq ($(WINDOW_SYSTEM),dri)
+WINOBJ=$(MESABUILDDIR)/dri/dri.a
+WINLIB=
+else
+WINOBJ=
+WINLIB=-L$(MESA)/src/glx/mini
+endif
+
+ASM_SOURCES = 
+OBJECTS = $(C_SOURCES:.c=.o) \
+	  $(ASM_SOURCES:.S=.o) 
+
+### Include directories
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include \
+	-I$(TOP)/src/mesa \
+	-I$(TOP)/src/mesa/main \
+	-I$(TOP)/src/mesa/glapi \
+	-I$(TOP)/src/mesa/math \
+	-I$(TOP)/src/mesa/transform \
+	-I$(TOP)/src/mesa/swrast \
+	-I$(TOP)/src/mesa/swrast_setup
+
+
+##### RULES #####
+
+.c.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+	$(CC) -c $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
+
+
+##### TARGETS #####
+
+default: depend unichrome_dri.so
+
+unichrome_dri.so:  $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.solo
+	rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS)
+	rm -f $(LIB_DIR)/unichrome_dri.so && \
+	install unichrome_dri.so $(LIB_DIR)/unichrome_dri.so
+
+$(LIB_DIR)/unichrome_dri.so:	unichrome_dri.so
+	rm -f $(LIB_DIR)/unichrome_dri.so && \
+	install unichrome_dri.so $(LIB_DIR)/unichrome_dri.so
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(C_SOURCES) $(ASM_SOURCES)
+	touch depend
+	makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \
+		$(C_SOURCES) $(ASM_SOURCES) >& /dev/null
+
+
+# Emacs tags
+tags:
+	etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean:
+	-rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+
+
+include depend
diff --git a/src/mesa/x86/Makefile b/src/mesa/x86/Makefile
new file mode 100644
index 0000000..0c725d3
--- /dev/null
+++ b/src/mesa/x86/Makefile
@@ -0,0 +1,42 @@
+# src/mesa/x86/Makefile
+
+TOP = ../../..
+
+include $(TOP)/configs/current
+
+
+
+INCLUDE_DIRS = \
+	-I$(TOP)/include/GL \
+	-I$(TOP)/include \
+	-I.. \
+	-I../main \
+	-I../glapi \
+	-I../tnl
+
+
+default: matypes.h
+
+
+# need some special rules here, unfortunately
+matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes.c
+	$(CC) $(INCLUDE_DIRS) $(CFLAGS) gen_matypes.c -o gen_matypes
+	./gen_matypes > matypes.h
+
+common_x86_asm.o: matypes.h
+3dnow_normal.o: matypes.h
+3dnow_xform1.o: matypes.h
+3dnow_xform2.o: matypes.h
+3dnow_xform3.o: matypes.h
+3dnow_xform4.o: matypes.h
+mmx_blend.o: matypes.h
+sse_normal.o: matypes.h
+sse_xform1.o: matypes.h
+sse_xform2.o: matypes.h
+sse_xform3.o: matypes.h
+sse_xform4.o: matypes.h
+x86_cliptest.o: matypes.h
+x86_xform2.o: matypes.h
+x86_xform3.o: matypes.h
+x86_xform4.o: matypes.h
+