Link ttydrv and x11drv objects into their respective dll.

diff --git a/Make.rules.in b/Make.rules.in
index 48a5caf..b488fcd 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -72,6 +72,8 @@
 prog_manext     = 1
 conf_manext     = 5
 includedir      = @includedir@/wine
+CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc \
+                  *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
 
 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
        $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
@@ -251,7 +253,7 @@
 	$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
 
 clean::
-	$(RM) *.o *.a *.so *.ln \#*\# *~ *% .\#* *.bak *.orig *.rej *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
+	$(RM) $(CLEAN_FILES) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
 
 dummy:
 
diff --git a/Makefile.in b/Makefile.in
index 17dcc23..1d865c9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -41,7 +41,6 @@
 	graphics/enhmetafiledrv \
 	graphics/metafiledrv \
 	graphics/psdrv \
-	graphics/ttydrv \
 	graphics/win16drv \
 	if1632 \
 	library \
@@ -57,13 +56,7 @@
 	resources \
 	scheduler \
 	win32 \
-	windows \
-	windows/ttydrv
-
-X11SUBDIRS = \
-	graphics/x11drv \
-	tsx11 \
-	windows/x11drv
+	windows
 
 EMUSUBDIRS = \
 	miscemu \
@@ -84,20 +77,19 @@
 BUILDSUBDIRS = \
 	$(TOOLSUBDIRS) \
 	$(LIBSUBDIRS) \
-	$(X11SUBDIRS) \
 	$(DLLDIR) \
 	$(EMUSUBDIRS) \
 	$(PROGSUBDIRS) \
 	$(DOCSUBDIRS)
 
 # Sub-directories to run make depend into
-DEPENDSUBDIRS = $(LIBSUBDIRS) $(X11SUBDIRS) $(DLLDIR) $(EMUSUBDIRS) $(DOCSUBDIRS)
+DEPENDSUBDIRS = $(LIBSUBDIRS) $(DLLDIR) $(EMUSUBDIRS) $(DOCSUBDIRS)
 
 # Sub-directories to run make install into
 INSTALLSUBDIRS = $(DLLDIR) $(DOCSUBDIRS) $(INCSUBDIRS)
 
 # Sub-directories to run make lint into
-LINTSUBDIRS = $(LIBSUBDIRS) $(X11SUBDIRS) $(DLLDIR) $(EMUSUBDIRS) $(DOCSUBDIRS)
+LINTSUBDIRS = $(LIBSUBDIRS) $(DLLDIR) $(EMUSUBDIRS) $(DOCSUBDIRS)
 
 # Extra sub-directories to clean
 CLEANSUBDIRS = dlls include include/bitmaps include/wine
@@ -116,7 +108,6 @@
 	graphics/enhmetafiledrv/enhmetafiledrv.o \
 	graphics/metafiledrv/metafiledrv.o \
 	graphics/psdrv/psdrv.o \
-	graphics/ttydrv/ttydrv.o \
 	graphics/win16drv/win16drv.o \
 	if1632/if1632.o \
 	loader/loader.o \
@@ -131,20 +122,14 @@
 	resources/resources.o \
 	scheduler/scheduler.o \
 	win32/win32.o \
-	windows/windows.o \
-	windows/ttydrv/ttydrv.o
-
-X11OBJS = \
-	graphics/x11drv/x11drv.o \
-	tsx11/tsx11.o \
-	windows/x11drv/x11drv.o
+	windows/windows.o
 
 EMUOBJS = \
 	miscemu/miscemu.o
 
 DLLOBJS = $(DLLS:%=dlls/lib%.@LIBEXT@)
 
-EXTRA_OBJS = $(LIBOBJS) $(X11OBJS)
+EXTRA_OBJS = $(LIBOBJS)
 
 EMU_TARGET = @EMU_TARGET@
 
@@ -152,7 +137,6 @@
 	@echo "Wine build complete."
 
 LIBLINTS = $(LIBOBJS:.o=.ln) 
-X11LINTS = $(X11OBJS:.o=.ln)
 EMULINTS = $(EMUOBJS:.o=.ln)
 
 lint:: llib-lwine.ln $(EMULINTS)
@@ -172,8 +156,8 @@
 	$(CC) -o wine $(EMUOBJS) $(DLL_LINK) $(LDOPTIONS) $(X_LIBS) $(XLIB) $(LIBS)
 	nm -n wine | grep -v _compiled >wine.sym
 
-llib-lwine.ln : $(LIBLINTS) $(X11LINTS)
-	$(LINT) $(ALLLINTFLAGS) -owine $(LIBLINTS) $(X11LINTS)
+llib-lwine.ln : $(LIBLINTS)
+	$(LINT) $(ALLLINTFLAGS) -owine $(LIBLINTS)
 
 install_so: lib$(MODULE).so.$(SOVERSION)
 	[ -d $(libdir) ] || $(MKDIR) $(libdir)
@@ -214,14 +198,14 @@
 checklink::
 	$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -lwine $(LDOPTIONS) $(X_LIBS) $(XLIB) $(LIBS) && $(RM) checklink
 
-$(X11OBJS) $(EMUOBJS) $(LIBOBJS) $(DLLOBJS) $(PROGRAMS): $(TOOLSUBDIRS) dummy
+$(EMUOBJS) $(LIBOBJS) $(DLLOBJS) $(PROGRAMS): $(TOOLSUBDIRS) dummy
 	@cd `dirname $@` && $(MAKE) `basename $@`
 
 $(BUILDSUBDIRS): dummy
 	@cd $@ && $(MAKE)
 
-$(LIBLINTS) $(X11LINTS) $(EMULINTS): dummy
-	@echo $@ | sed 's%\(.*\)\/[^\/]*%cd \1 \&\& make lint%' | sh
+$(LIBLINTS) $(EMULINTS): dummy
+	@cd `dirname $@` && $(MAKE) lint
 
 install_programs: dummy
 	@cd programs && $(MAKE) install
@@ -254,9 +238,9 @@
 	for i in $(LIBSUBDIRS); do (cd $$i && $(MAKE) html); done
 
 clean::
-	for i in $(BUILDSUBDIRS); do (cd $$i; $(MAKE) clean) || exit 1; done
-	for i in $(CLEANSUBDIRS); do (cd $$i; $(RM) *.o \#*\# .#* *~ *% *.bak *.orig *.rej *.flc); done
-	$(RM) wine wine.sym libwine.so.1.0 TAGS .#*
+	for i in $(BUILDSUBDIRS); do (cd $$i && $(MAKE) clean) || exit 1; done
+	for i in $(CLEANSUBDIRS); do (cd $$i && $(RM) $(CLEAN_FILES)); done
+	$(RM) wine wine.sym libwine.so.1.0 TAGS
 
 distclean: clean
 	$(RM) config.* Make.rules dlls/Makedll.rules include/config.h documentation/wine.man documentation/wine.conf.man
diff --git a/dlls/ddraw/Makefile.in b/dlls/ddraw/Makefile.in
index abd64aa..12356c6 100644
--- a/dlls/ddraw/Makefile.in
+++ b/dlls/ddraw/Makefile.in
@@ -4,6 +4,7 @@
 VPATH     = @srcdir@
 MODULE    = ddraw
 SOVERSION = 1.0
+IMPORTS   = x11drv
 
 SPEC_SRCS = ddraw.spec
 
diff --git a/dlls/ttydrv/Makefile.in b/dlls/ttydrv/Makefile.in
index 8cd7230..809467e 100644
--- a/dlls/ttydrv/Makefile.in
+++ b/dlls/ttydrv/Makefile.in
@@ -10,7 +10,24 @@
 C_SRCS = \
 	ttydrv_main.c
 
+EXTRA_OBJS = \
+	$(TOPOBJDIR)/graphics/ttydrv/ttydrv.o \
+	$(TOPOBJDIR)/windows/ttydrv/ttydrv.o
+
+SUBDIRS = \
+	$(TOPOBJDIR)/graphics/ttydrv \
+	$(TOPOBJDIR)/windows/ttydrv
+
 @MAKE_DLL_RULES@
 
+$(EXTRA_OBJS): $(TOOLSUBDIRS) dummy
+	@cd `dirname $@` && $(MAKE) `basename $@`
+
+depend::
+	for i in $(SUBDIRS); do (cd $$i && $(MAKE) depend) || exit 1; done
+
+clean::
+	for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit 1; done
+
 ### Dependencies:
 
diff --git a/dlls/x11drv/Makefile.in b/dlls/x11drv/Makefile.in
index 4a75671..6a07c31 100644
--- a/dlls/x11drv/Makefile.in
+++ b/dlls/x11drv/Makefile.in
@@ -10,7 +10,26 @@
 C_SRCS = \
 	x11drv_main.c
 
+EXTRA_OBJS = \
+	$(TOPOBJDIR)/graphics/x11drv/x11drv.o \
+	$(TOPOBJDIR)/tsx11/tsx11.o \
+	$(TOPOBJDIR)/windows/x11drv/x11drv.o
+
+SUBDIRS = \
+	$(TOPOBJDIR)/graphics/x11drv \
+	$(TOPOBJDIR)/tsx11 \
+	$(TOPOBJDIR)/windows/x11drv
+
 @MAKE_DLL_RULES@
 
+$(EXTRA_OBJS): $(TOOLSUBDIRS) dummy
+	@cd `dirname $@` && $(MAKE) `basename $@`
+
+depend::
+	for i in $(SUBDIRS); do (cd $$i && $(MAKE) depend) || exit 1; done
+
+clean::
+	for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit 1; done
+
 ### Dependencies: