Index: /trunk/src/makedep/def.h
===================================================================
--- /trunk/src/makedep/def.h	(revision 167)
+++ /trunk/src/makedep/def.h	(revision 168)
@@ -27,6 +27,8 @@
 /* $XFree86: xc/config/makedepend/def.h,v 3.13tsi Exp $ */
 
-#include "Xos.h"
-#include "Xfuncproto.h"
+#ifndef NO_X11 /* from mozilla */
+#include "X11/Xos.h"
+#include "X11/Xfuncproto.h"
+#endif
 #include <stdlib.h>
 #include <stdio.h>
@@ -81,5 +83,5 @@
 /*
  * debug levels are:
- * 
+ *
  *     0	show ifn*(def)*,endif
  *     1	trace defined/!defined
@@ -148,5 +150,5 @@
 				   struct inclist **srcfile);
 struct filepointer	*getfile(char *file);
-void                    included_by(struct inclist *ip, 
+void                    included_by(struct inclist *ip,
 				    struct inclist *newfile);
 struct inclist		*newinclude(char *newfile, char *incstring);
@@ -159,14 +161,14 @@
 void                    define(char *def, struct inclist *file);
 void                    undefine(char *symbol, struct inclist *file);
-int                     find_includes(struct filepointer *filep, 
-				      struct inclist *file, 
-				      struct inclist *file_red, 
+int                     find_includes(struct filepointer *filep,
+				      struct inclist *file,
+				      struct inclist *file_red,
 				      int recursion, boolean failOK);
 
-void                    recursive_pr_include(struct inclist *head, 
+void                    recursive_pr_include(struct inclist *head,
 					     char *file, char *base);
-void                    add_include(struct filepointer *filep, 
-				    struct inclist *file, 
-				    struct inclist *file_red, 
+void                    add_include(struct filepointer *filep,
+				    struct inclist *file,
+				    struct inclist *file_red,
 				    char *include, int type,
 				    boolean failOK);
Index: /trunk/src/makedep/imakemdep.h
===================================================================
--- /trunk/src/makedep/imakemdep.h	(revision 168)
+++ /trunk/src/makedep/imakemdep.h	(revision 168)
@@ -0,0 +1,733 @@
+
+/* $XConsortium: imakemdep.h,v 1.83 95/04/07 19:47:46 kaleb Exp $ */
+/* $XFree86: xc/config/imake/imakemdep.h,v 3.12 1995/07/08 10:22:17 dawes Exp $ */
+/*
+
+Copyright (c) 1993, 1994  X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+*/
+
+
+/* 
+ * This file contains machine-dependent constants for the imake utility.
+ * When porting imake, read each of the steps below and add in any necessary
+ * definitions.  In general you should *not* edit ccimake.c or imake.c!
+ */
+
+#ifdef CCIMAKE
+/*
+ * Step 1:  imake_ccflags
+ *     Define any special flags that will be needed to get imake.c to compile.
+ *     These will be passed to the compile along with the contents of the
+ *     make variable BOOTSTRAPCFLAGS.
+ */
+#ifdef hpux
+#ifdef hp9000s800
+#define imake_ccflags "-DSYSV"
+#else
+#define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV"
+#endif
+#endif
+
+#if defined(macII) || defined(_AUX_SOURCE)
+#define imake_ccflags "-DmacII -DSYSV"
+#endif
+
+#ifdef stellar
+#define imake_ccflags "-DSYSV"
+#endif
+
+#if defined(USL) || defined(Oki) || defined(NCR)
+#define imake_ccflags "-Xc -DSVR4"
+#endif
+
+#ifdef sony
+#if defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV)
+#define imake_ccflags "-DSVR4"
+#else
+#include <sys/param.h>
+#if NEWSOS < 41
+#define imake_ccflags "-Dbsd43 -DNOSTDHDRS"
+#else
+#if NEWSOS < 42
+#define imake_ccflags "-Dbsd43"
+#endif
+#endif
+#endif
+#endif
+
+#ifdef _CRAY
+#define imake_ccflags "-DSYSV -DUSG"
+#endif
+
+#if defined(_IBMR2) || defined(aix)
+#define imake_ccflags "-Daix -DSYSV"
+#endif
+
+#ifdef Mips
+#  if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43)
+#    define imake_ccflags "-DBSD43"
+#  else 
+#    define imake_ccflags "-DSYSV"
+#  endif
+#endif 
+
+#ifdef is68k
+#define imake_ccflags "-Dluna -Duniosb"
+#endif
+
+#ifdef SYSV386
+# ifdef SVR4
+#  define imake_ccflags "-Xc -DSVR4"
+# else
+#  define imake_ccflags "-DSYSV"
+# endif
+#endif
+
+#ifdef SVR4
+# ifdef i386
+#  define imake_ccflags "-Xc -DSVR4"
+# endif
+#endif
+
+#ifdef SYSV
+# ifdef i386
+#  define imake_ccflags "-DSYSV"
+# endif
+#endif
+
+#ifdef __convex__
+#define imake_ccflags "-fn -tm c1"
+#endif
+
+#ifdef apollo
+#define imake_ccflags "-DX_NOT_POSIX"
+#endif
+
+#ifdef WIN32
+#define imake_ccflags "-nologo -batch -D__STDC__"
+#endif
+
+#ifdef __uxp__
+#define imake_ccflags "-DSVR4 -DANSICPP"
+#endif
+
+#ifdef __sxg__
+#define imake_ccflags "-DSYSV -DUSG -DNOSTDHDRS"
+#endif
+
+#ifdef sequent
+#define imake_ccflags "-DX_NOT_STDC_ENV -DX_NOT_POSIX"
+#endif
+
+#ifdef _SEQUENT_
+#define imake_ccflags "-DSYSV -DUSG"
+#endif
+
+#if defined(SX) || defined(PC_UX)
+#define imake_ccflags "-DSYSV"
+#endif
+
+#ifdef nec_ews_svr2
+#define imake_ccflags "-DUSG"
+#endif
+
+#if defined(nec_ews_svr4) || defined(_nec_ews_svr4) || defined(_nec_up) || defined(_nec_ft)
+#define imake_ccflags "-DSVR4"
+#endif
+
+#ifdef	MACH
+#define imake_ccflags "-DNOSTDHDRS"
+#endif
+
+/* this is for OS/2 under EMX. This won't work with DOS */
+#if defined(__EMX__) 
+#define imake_ccflags "-DBSD43"
+#endif
+
+#else /* not CCIMAKE */
+#ifndef MAKEDEPEND
+/*
+ * Step 2:  dup2
+ *     If your OS doesn't have a dup2() system call to duplicate one file
+ *     descriptor onto another, define such a mechanism here (if you don't
+ *     already fall under the existing category(ies).
+ */
+#if defined(SYSV) && !defined(_CRAY) && !defined(Mips) && !defined(_SEQUENT_)
+#define	dup2(fd1,fd2)	((fd1 == fd2) ? fd1 : (close(fd2), \
+					       fcntl(fd1, F_DUPFD, fd2)))
+#endif
+
+
+/*
+ * Step 3:  FIXUP_CPP_WHITESPACE
+ *     If your cpp collapses tabs macro expansions into a single space and
+ *     replaces escaped newlines with a space, define this symbol.  This will
+ *     cause imake to attempt to patch up the generated Makefile by looking
+ *     for lines that have colons in them (this is why the rules file escapes
+ *     all colons).  One way to tell if you need this is to see whether or not
+ *     your Makefiles have no tabs in them and lots of @@ strings.
+ */
+#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || (defined(AMOEBA) && defined(CROSS_COMPILE))
+#define FIXUP_CPP_WHITESPACE
+#endif
+#ifdef WIN32
+#define REMOVE_CPP_LEADSPACE
+#define INLINE_SYNTAX
+#define MAGIC_MAKE_VARS
+#endif
+#ifdef __minix_vmd
+#define FIXUP_CPP_WHITESPACE
+#endif
+
+/*
+ * Step 4:  USE_CC_E, DEFAULT_CC, DEFAULT_CPP
+ *     If you want to use cc -E instead of cpp, define USE_CC_E.
+ *     If use cc -E but want a different compiler, define DEFAULT_CC.
+ *     If the cpp you need is not in /lib/cpp, define DEFAULT_CPP.
+ */
+#ifdef hpux
+#define USE_CC_E
+#endif
+#ifdef WIN32
+#define USE_CC_E
+#define DEFAULT_CC "cl"
+#endif
+#ifdef apollo
+#define DEFAULT_CPP "/usr/lib/cpp"
+#endif
+#if defined(_IBMR2) && !defined(DEFAULT_CPP)
+#define DEFAULT_CPP "/usr/lpp/X11/Xamples/util/cpp/cpp"
+#endif
+#if defined(sun) && defined(SVR4)
+#define DEFAULT_CPP "/usr/ccs/lib/cpp"
+#endif
+#ifdef __bsdi__
+#define DEFAULT_CPP "/usr/bin/cpp"
+#endif
+#ifdef __uxp__
+#define DEFAULT_CPP "/usr/ccs/lib/cpp"
+#endif
+#ifdef __sxg__
+#define DEFAULT_CPP "/usr/lib/cpp"
+#endif
+#ifdef _CRAY
+#define DEFAULT_CPP "/lib/pcpp"
+#endif
+#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#define DEFAULT_CPP "/usr/libexec/cpp"
+#endif
+#ifdef	MACH
+#define USE_CC_E
+#endif
+#ifdef __minix_vmd
+#define DEFAULT_CPP "/usr/lib/cpp"
+#endif
+#if defined(__EMX__)
+/* expects cpp in PATH */
+#define DEFAULT_CPP "cpp"
+#endif
+
+/*
+ * Step 5:  cpp_argv
+ *     The following table contains the flags that should be passed
+ *     whenever a Makefile is being generated.  If your preprocessor 
+ *     doesn't predefine any unique symbols, choose one and add it to the
+ *     end of this table.  Then, do the following:
+ * 
+ *         a.  Use this symbol in Imake.tmpl when setting MacroFile.
+ *         b.  Put this symbol in the definition of BootstrapCFlags in your
+ *             <platform>.cf file.
+ *         c.  When doing a make World, always add "BOOTSTRAPCFLAGS=-Dsymbol" 
+ *             to the end of the command line.
+ * 
+ *     Note that you may define more than one symbol (useful for platforms 
+ *     that support multiple operating systems).
+ */
+
+#define	ARGUMENTS 50	/* number of arguments in various arrays */
+char *cpp_argv[ARGUMENTS] = {
+	"cc",		/* replaced by the actual program to exec */
+	"-I.",		/* add current directory to include path */
+#ifdef unix
+	"-Uunix",	/* remove unix symbol so that filename unix.c okay */
+#endif
+#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(MACH)
+# ifdef __i386__
+	"-D__i386__",
+# endif
+# ifdef __x86_64__
+	"-D__x86_64__",
+# endif
+# ifdef __GNUC__
+	"-traditional",
+# endif
+#endif
+#ifdef M4330
+	"-DM4330",	/* Tektronix */
+#endif
+#ifdef M4310
+	"-DM4310",	/* Tektronix */
+#endif
+#if defined(macII) || defined(_AUX_SOURCE)
+	"-DmacII",	/* Apple A/UX */
+#endif
+#ifdef USL
+	"-DUSL",	/* USL */
+#endif
+#ifdef sony
+	"-Dsony",	/* Sony */
+#if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) && NEWSOS < 42
+	"-Dbsd43",
+#endif
+#endif
+#ifdef _IBMR2
+	"-D_IBMR2",	/* IBM RS-6000 (we ensured that aix is defined above */
+#ifndef aix
+#define aix		/* allow BOOTSTRAPCFLAGS="-D_IBMR2" */
+#endif
+#endif /* _IBMR2 */
+#ifdef aix
+	"-Daix",	/* AIX instead of AOS */
+#ifndef ibm
+#define ibm		/* allow BOOTSTRAPCFLAGS="-Daix" */
+#endif
+#endif /* aix */
+#ifdef ibm
+	"-Dibm",	/* IBM PS/2 and RT under both AOS and AIX */
+#endif
+#ifdef luna
+	"-Dluna",	/* OMRON luna 68K and 88K */
+#ifdef luna1
+	"-Dluna1",
+#endif
+#ifdef luna88k		/* need not on UniOS-Mach Vers. 1.13 */
+	"-traditional", /* for some older version            */
+#endif			/* instead of "-DXCOMM=\\#"          */
+#ifdef uniosb
+	"-Duniosb",
+#endif
+#ifdef uniosu
+	"-Duniosu",
+#endif
+#endif /* luna */
+#ifdef _CRAY		/* Cray */
+	"-Ucray",
+#endif
+#ifdef Mips
+	"-DMips",	/* Define and use Mips for Mips Co. OS/mach. */
+# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43)
+	"-DBSD43",	/* Mips RISCOS supports two environments */
+# else
+	"-DSYSV",	/* System V environment is the default */
+# endif
+#endif /* Mips */
+#ifdef MOTOROLA
+	"-DMOTOROLA",    /* Motorola Delta Systems */
+# ifdef SYSV
+	"-DSYSV", 
+# endif
+# ifdef SVR4
+	"-DSVR4",
+# endif
+#endif /* MOTOROLA */
+#ifdef i386
+	"-Di386",
+# ifdef SVR4
+	"-DSVR4",
+# endif
+# ifdef SYSV
+	"-DSYSV",
+#  ifdef ISC
+	"-DISC",
+#   ifdef ISC40
+	"-DISC40",       /* ISC 4.0 */
+#   else
+#    ifdef ISC202
+	"-DISC202",      /* ISC 2.0.2 */
+#    else
+#     ifdef ISC30
+	"-DISC30",       /* ISC 3.0 */
+#     else
+	"-DISC22",       /* ISC 2.2.1 */
+#     endif
+#    endif
+#   endif
+#  endif
+#  ifdef SCO
+	"-DSCO",
+#   ifdef SCO324
+	"-DSCO324",
+#   endif
+#  endif
+# endif
+# ifdef ESIX
+	"-DESIX",
+# endif
+# ifdef ATT
+	"-DATT",
+# endif
+# ifdef DELL
+	"-DDELL",
+# endif
+#endif
+#ifdef SYSV386           /* System V/386 folks, obsolete */
+	"-Di386",
+# ifdef SVR4
+	"-DSVR4",
+# endif
+# ifdef ISC
+	"-DISC",
+#  ifdef ISC40
+	"-DISC40",       /* ISC 4.0 */
+#  else
+#   ifdef ISC202
+	"-DISC202",      /* ISC 2.0.2 */
+#   else
+#    ifdef ISC30
+	"-DISC30",       /* ISC 3.0 */
+#    else
+	"-DISC22",       /* ISC 2.2.1 */
+#    endif
+#   endif
+#  endif
+# endif
+# ifdef SCO
+	"-DSCO",
+#  ifdef SCO324
+	"-DSCO324",
+#  endif
+# endif
+# ifdef ESIX
+	"-DESIX",
+# endif
+# ifdef ATT
+	"-DATT",
+# endif
+# ifdef DELL
+	"-DDELL",
+# endif
+#endif
+#ifdef __osf__
+	"-D__osf__",
+# ifdef __mips__
+	"-D__mips__",
+# endif
+# ifdef __alpha
+	"-D__alpha",
+# endif
+# ifdef __i386__
+	"-D__i386__",
+# endif
+# ifdef __GNUC__
+	"-traditional",
+# endif
+#endif
+#ifdef Oki
+	"-DOki",
+#endif
+#ifdef sun
+#ifdef SVR4
+	"-DSVR4",
+#endif
+#endif
+#ifdef WIN32
+	"-DWIN32",
+	"-nologo",
+	"-batch",
+	"-D__STDC__",
+#endif
+#ifdef NCR
+	"-DNCR",	/* NCR */
+#endif
+#ifdef linux
+        "-traditional",
+        "-Dlinux",
+#endif
+#ifdef __uxp__
+	"-D__uxp__",
+#endif
+#ifdef __sxg__
+	"-D__sxg__",
+#endif
+#ifdef nec_ews_svr2
+	"-Dnec_ews_svr2",
+#endif
+#ifdef AMOEBA
+	"-DAMOEBA",
+# ifdef CROSS_COMPILE
+	"-DCROSS_COMPILE",
+#  ifdef CROSS_i80386
+	"-Di80386",
+#  endif
+#  ifdef CROSS_sparc
+	"-Dsparc",
+#  endif
+#  ifdef CROSS_mc68000
+	"-Dmc68000",
+#  endif
+# else
+#  ifdef i80386
+	"-Di80386",
+#  endif
+#  ifdef sparc
+	"-Dsparc",
+#  endif
+#  ifdef mc68000
+	"-Dmc68000",
+#  endif
+# endif
+#endif
+#ifdef __minix_vmd
+        "-Dminix",
+#endif
+
+#if defined(__EMX__)
+	"-traditional",
+	"-Demxos2",
+#endif
+
+};
+#else /* else MAKEDEPEND */
+/*
+ * Step 6:  predefs
+ *     If your compiler and/or preprocessor define any specific symbols, add
+ *     them to the the following table.  The definition of struct symtab is
+ *     in util/makedepend/def.h.
+ */
+struct symtab	predefs[] = {
+#ifdef apollo
+	{"apollo", "1"},
+#endif
+#ifdef ibm032
+	{"ibm032", "1"},
+#endif
+#ifdef ibm
+	{"ibm", "1"},
+#endif
+#ifdef aix
+	{"aix", "1"},
+#endif
+#ifdef sun
+	{"sun", "1"},
+#endif
+#ifdef sun2
+	{"sun2", "1"},
+#endif
+#ifdef sun3
+	{"sun3", "1"},
+#endif
+#ifdef sun4
+	{"sun4", "1"},
+#endif
+#ifdef sparc
+	{"sparc", "1"},
+#endif
+#ifdef __sparc__
+	{"__sparc__", "1"},
+#endif
+#ifdef hpux
+	{"hpux", "1"},
+#endif
+#ifdef __hpux
+	{"__hpux", "1"},
+#endif
+#ifdef __hp9000s800
+	{"__hp9000s800", "1"},
+#endif
+#ifdef __hp9000s700
+	{"__hp9000s700", "1"},
+#endif
+#ifdef vax
+	{"vax", "1"},
+#endif
+#ifdef VMS
+	{"VMS", "1"},
+#endif
+#ifdef cray
+	{"cray", "1"},
+#endif
+#ifdef CRAY
+	{"CRAY", "1"},
+#endif
+#ifdef _CRAY
+	{"_CRAY", "1"},
+#endif
+#ifdef att
+	{"att", "1"},
+#endif
+#ifdef mips
+	{"mips", "1"},
+#endif
+#ifdef __mips__
+	{"__mips__", "1"},
+#endif
+#ifdef ultrix
+	{"ultrix", "1"},
+#endif
+#ifdef stellar
+	{"stellar", "1"},
+#endif
+#ifdef mc68000
+	{"mc68000", "1"},
+#endif
+#ifdef mc68020
+	{"mc68020", "1"},
+#endif
+#ifdef __GNUC__
+	{"__GNUC__", "1"},
+#endif
+#if __STDC__
+	{"__STDC__", "1"},
+#endif
+#ifdef __HIGHC__
+	{"__HIGHC__", "1"},
+#endif
+#ifdef CMU
+	{"CMU", "1"},
+#endif
+#ifdef luna
+	{"luna", "1"},
+#ifdef luna1
+	{"luna1", "1"},
+#endif
+#ifdef luna2
+	{"luna2", "1"},
+#endif
+#ifdef luna88k
+	{"luna88k", "1"},
+#endif
+#ifdef uniosb
+	{"uniosb", "1"},
+#endif
+#ifdef uniosu
+	{"uniosu", "1"},
+#endif
+#endif
+#ifdef ieeep754
+	{"ieeep754", "1"},
+#endif
+#ifdef is68k
+	{"is68k", "1"},
+#endif
+#ifdef m68k
+        {"m68k", "1"},
+#endif
+#ifdef m88k
+        {"m88k", "1"},
+#endif
+#ifdef __m88k__
+	{"__m88k__", "1"},
+#endif
+#ifdef bsd43
+	{"bsd43", "1"},
+#endif
+#ifdef hcx
+	{"hcx", "1"},
+#endif
+#ifdef sony
+	{"sony", "1"},
+#ifdef SYSTYPE_SYSV
+	{"SYSTYPE_SYSV", "1"},
+#endif
+#ifdef _SYSTYPE_SYSV
+	{"_SYSTYPE_SYSV", "1"},
+#endif
+#endif
+#ifdef __OSF__
+	{"__OSF__", "1"},
+#endif
+#ifdef __osf__
+	{"__osf__", "1"},
+#endif
+#ifdef __alpha
+	{"__alpha", "1"},
+#endif
+#ifdef __DECC
+	{"__DECC",  "1"},
+#endif
+#ifdef __decc
+	{"__decc",  "1"},
+#endif
+#ifdef __uxp__
+	{"__uxp__", "1"},
+#endif
+#ifdef __sxg__
+	{"__sxg__", "1"},
+#endif
+#ifdef _SEQUENT_
+	{"_SEQUENT_", "1"},
+	{"__STDC__", "1"},
+#endif
+#ifdef __bsdi__
+	{"__bsdi__", "1"},
+#endif
+#ifdef nec_ews_svr2
+	{"nec_ews_svr2", "1"},
+#endif
+#ifdef nec_ews_svr4
+	{"nec_ews_svr4", "1"},
+#endif
+#ifdef _nec_ews_svr4
+	{"_nec_ews_svr4", "1"},
+#endif
+#ifdef _nec_up
+	{"_nec_up", "1"},
+#endif
+#ifdef SX
+	{"SX", "1"},
+#endif
+#ifdef nec
+	{"nec", "1"},
+#endif
+#ifdef _nec_ft
+	{"_nec_ft", "1"},
+#endif
+#ifdef PC_UX
+	{"PC_UX", "1"},
+#endif
+#ifdef sgi
+	{"sgi", "1"},
+#endif
+#ifdef __sgi
+	{"__sgi", "1"},
+#endif
+#ifdef __FreeBSD__
+	{"__FreeBSD__", "1"},
+#endif
+#ifdef __NetBSD__
+	{"__NetBSD__", "1"},
+#endif
+#ifdef __OpenBSD__
+	{"__OpenBSD__", "1"},
+#endif
+#ifdef __EMX__
+	{"__EMX__", "1"},
+#endif
+	/* add any additional symbols before this line */
+	{NULL, NULL}
+};
+
+#endif /* MAKEDEPEND */
+#endif /* CCIMAKE */
Index: /trunk/src/makedep/include.c
===================================================================
--- /trunk/src/makedep/include.c	(revision 167)
+++ /trunk/src/makedep/include.c	(revision 168)
@@ -29,4 +29,9 @@
 
 #include "def.h"
+
+/* mozilla: */
+#ifdef _MSC_VER
+#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
+#endif
 
 extern struct	inclist	inclist[ MAXFILES ],
@@ -119,5 +124,5 @@
 		    char **tp = cp;
 
-		    do 
+		    do
 			*tp++ = *fp; /* move all the pointers down */
 		    while (*fp++);
@@ -267,5 +272,5 @@
 		    (type == INCLUDENEXTDOT) ||
 		    (*include == '/')) {
-			if (stat(include, &st) == 0)
+			if (stat(include, &st) == 0 && !S_ISDIR(st.st_mode)) /* mozilla */
 				return newinclude(include, include);
 			if (show_where_not)
@@ -289,5 +294,5 @@
 			}
 			remove_dotdot(path);
-			if (stat(path, &st) == 0)
+			if (stat(path, &st) == 0 && !S_ISDIR(st.st_mode)) /* mozilla */
 				return newinclude(path, include);
 			if (show_where_not)
@@ -307,5 +312,5 @@
 		sprintf(path, "%s/%s", *pp, include);
 		remove_dotdot(path);
-		if (stat(path, &st) == 0) {
+		if (stat(path, &st) == 0 && !S_ISDIR(st.st_mode)) { /* mozilla */
 			includedirsnext = pp + 1;
 			return newinclude(path, include);
Index: /trunk/src/makedep/main.c
===================================================================
--- /trunk/src/makedep/main.c	(revision 167)
+++ /trunk/src/makedep/main.c	(revision 168)
@@ -158,4 +158,5 @@
 	char **undeflist = NULL;
 	int numundefs = 0, i;
+	register char offset; /* mozilla */
 
 	ProgramName = argv[0];
@@ -232,14 +233,20 @@
 			break;
 		case 'D':
+			offset = 2; /* mozilla */
+Imaginary Buffer Line
 			if (argv[0][2] == '\0') {
 				argv++;
 				argc--;
-			}
-			for (p=argv[0] + 2; *p ; p++)
+				offset = 0;
+			}
+			/* offset +1 here since first def letter
+			 * cannot be `=`
+			 */
+			for (p = argv[0] + offset + 1; *p; p++) /* mozilla */
 				if (*p == '=') {
 					*p = ' ';
 					break;
 				}
-			define(argv[0] + 2, &maininclist);
+			define(argv[0] + offset, &maininclist); /* mozilla */
 			break;
 		case 'I':
@@ -260,9 +267,11 @@
 			    undeflist = realloc(undeflist,
 						numundefs * sizeof(char *));
+			offset = 2;  /* mozilla */
 			if (argv[0][2] == '\0') {
 				argv++;
 				argc--;
-			}
-			undeflist[numundefs - 1] = argv[0] + 2;
+				offset = 0;  /* mozilla */
+			}
+			undeflist[numundefs - 1] = argv[0] + offset; /* mozilla */
 			break;
 		case 'Y':
@@ -510,5 +519,5 @@
  * eliminate \r chars from file
  */
-static int 
+static int
 elim_cr(char *buf, int sz)
 {
@@ -634,5 +643,5 @@
 			whitespace = TRUE;
 		}
-        
+
 		if (*p == '/' && (p+1) < eof && *(p+1) == '*') {
 			/* Consume C comments */
@@ -662,5 +671,5 @@
 				}
 				else if (*p == '?' && (p+3) < eof &&
-					 *(p+1) == '?' && 
+					 *(p+1) == '?' &&
 					 *(p+2) == '/' &&
 					 *(p+3) == '\n') {
@@ -698,5 +707,5 @@
 				*(p++) = '\0';
 				/* punt lines with just # (yacc generated) */
-				for (cp = bol+1; 
+				for (cp = bol+1;
 				     *cp && (*cp == ' ' || *cp == '\t'); cp++);
 				if (*cp) goto done;
