Subject: misc/21494: Add support for building NetBSD under Cygwin/Windows
To: None <gnats-bugs@gnats.netbsd.org>
From: None <john_94501@yahoo.com>
List: netbsd-bugs
Date: 05/08/2003 00:10:14
>Number:         21494
>Category:       misc
>Synopsis:       Add support for building NetBSD under Cygwin/Windows
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu May 08 00:11:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     John Gordon
>Release:        -current
>Organization:
blueDonkey.org
>Environment:
CYGWIN_NT-5.1 vaio 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown Cygwin
>Description:
The cross-build of NetBSD fails under Cygwin for a variety of reasons, mostly due to subtle differences in the Cygwin environment and/or host-based tools.
>How-To-Repeat:
Try building NetBSD under Cygwin.
>Fix:
The patch pasted below will apply all the necessary changes to the tree required to build the i386 and one PowerPC based system (my ibmnws port). Other platforms should also work, but have not yet been tested by myself, or anybody else that I know of.

To start the build it is necessary to issue the following command:

HOST_CC=gcc-2 bash build.sh ...

The parameters to the build.sh script are the same as for any other platform, but it must have the HOST_CC environment variable pointing at the GCC 2.95.3-10 compiler and be run under bash, not Cygwin's sh implementation (build.sh will reject the native sh as "too old").

Full information about this work can be found on:

  http://www.bluedonkey.org/cgi-bin/twiki/bin/view/Netbsd/CygwinBuild

The patch (which can also be downloaded from the web page) is as follows:

Index: build.sh
===================================================================
RCS file: /cvsroot/src/build.sh,v
retrieving revision 1.96
diff -u -r1.96 build.sh
--- build.sh	2003/04/26 18:42:34	1.96
+++ build.sh	2003/05/07 23:19:17
@@ -91,7 +91,7 @@
 	# Some systems have a small ARG_MAX.  -X prevents make(1) from
 	# exporting variables in the environment redundantly.
 	case "${uname_s}" in
-	Darwin | FreeBSD)
+	Darwin | FreeBSD | CYGWIN*)
 		MAKEFLAGS=-X
 		;;
 	*)
Index: bin/sh/Makefile
===================================================================
RCS file: /cvsroot/src/bin/sh/Makefile,v
retrieving revision 1.64
diff -u -r1.64 Makefile
--- bin/sh/Makefile	2003/03/10 17:58:21	1.64
+++ bin/sh/Makefile	2003/05/07 23:19:18
@@ -24,6 +24,13 @@
 YFLAGS+=-l
 .endif
 
+BUILD_OS!=	uname -s
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+SH=/usr/bin/bash
+.else
+SH=sh
+.endif
+
 CPPFLAGS+=-DSHELL -I. -I${.CURDIR}
 #XXX: For testing only.
 #CPPFLAGS+=-DDEBUG=1
@@ -42,10 +49,10 @@
 CLEANFILES+= ${GENSRCS} y.tab.h
 
 token.h: mktokens
-	sh ${.ALLSRC}
+	${SH} ${.ALLSRC}
 
 builtins.c builtins.h: mkbuiltins shell.h builtins.def
-	sh ${.ALLSRC} ${.OBJDIR}
+	${SH} ${.ALLSRC} ${.OBJDIR}
 
 init.c: mkinit ${SHSRCS}
 	./${.ALLSRC}
Index: distrib/common/Makefile.distrib
===================================================================
RCS file: /cvsroot/src/distrib/common/Makefile.distrib,v
retrieving revision 1.2
diff -u -r1.2 Makefile.distrib
--- distrib/common/Makefile.distrib	2003/03/11 07:18:38	1.2
+++ distrib/common/Makefile.distrib	2003/05/07 23:20:06
@@ -16,12 +16,19 @@
 .if !defined(_MAKEFILE_DISTRIB_)
 _MAKEFILE_DISTRIB_=1
 
+BUILD_OS!= uname -s
 
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+SH=/usr/bin/bash
+.else
+SH=sh
+.endif
+
 DISTRIBDIR=	${NETBSDSRCDIR}/distrib
 DISTRIBREV!=	sh ${NETBSDSRCDIR}/sys/conf/osrelease.sh -s
 DISTRIBVER!=	sh ${NETBSDSRCDIR}/sys/conf/osrelease.sh
 
-MAKESUMS=	CKSUM=${CKSUM:Q} sh ${DISTRIBDIR}/sets/makesums
+MAKESUMS=	CKSUM=${CKSUM:Q} ${SH} ${DISTRIBDIR}/sets/makesums
 RELEASE_INSTALL=${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -m ${NONBINMODE}
 
 
Index: distrib/common/Makefile.makedev
===================================================================
RCS file: /cvsroot/src/distrib/common/Makefile.makedev,v
retrieving revision 1.5
diff -u -r1.5 Makefile.makedev
--- distrib/common/Makefile.makedev	2003/03/11 07:18:38	1.5
+++ distrib/common/Makefile.makedev	2003/05/07 23:20:06
@@ -38,10 +38,18 @@
 
 MTREECONF+=	${MAKEDEVSPEC}
 
+BUILD_OS!=	uname -s
+
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+SH=/usr/bin/bash
+.else
+SH=sh
+.endif
+
 ${MAKEDEVSPEC}:	${_MAKEDEVSCRIPT} ${_MAKEDEVWRAP} ${_MAKEDEV2SPEC}
 	-rm -f ${.TARGET} ${.TARGET}.tmp
 	MAKEDEVSCRIPT=${_MAKEDEVSCRIPT:Q} \
-	    sh ${_MAKEDEVWRAP} ${MAKEDEVTARGETS} | \
+	    ${SH} ${_MAKEDEVWRAP} ${MAKEDEVTARGETS} | \
 	    awk -f ${_MAKEDEV2SPEC} > ${.TARGET}.tmp \
 	&& sort -o ${.TARGET} ${.TARGET}.tmp
 
Index: distrib/common/Makefile.tarfloppy
===================================================================
RCS file: /cvsroot/src/distrib/common/Makefile.tarfloppy,v
retrieving revision 1.8
diff -u -r1.8 Makefile.tarfloppy
--- distrib/common/Makefile.tarfloppy	2003/03/11 07:18:38	1.8
+++ distrib/common/Makefile.tarfloppy	2003/05/07 23:20:06
@@ -30,7 +30,14 @@
 .if !defined(_MAKEFILE_TARFLOPPY_)
 _MAKEFILE_TARFLOPPY_=1
 
+BUILD_OS!= uname -s
 
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+SH=/usr/bin/bash
+.else
+SH=sh
+.endif
+
 .if defined(FLOPPY_BOOT)				# {
 CLEANFILES+=	boot
 boot: ${FLOPPY_BOOT}
@@ -63,7 +70,7 @@
 
 ${FLOPPYBASE}1${FLOPPYSUFFIX}: ${FLOPPYFILES} ${DISTRIBDIR}/common/buildfloppies.sh
 	@echo "Creating ${FLOPPYBASE}1${FLOPPYSUFFIX} from: ${FLOPPYFILES}"
-	PAX=${PAX:Q} sh ${DISTRIBDIR}/common/buildfloppies.sh \
+	PAX=${PAX:Q} ${SH} ${DISTRIBDIR}/common/buildfloppies.sh \
 	    ${FLOPPYINSTBOOT:D-i ${FLOPPYINSTBOOT}} ${FLOPPYPAD:D-p} \
 	    ${FLOPPYMAX:D-m ${FLOPPYMAX}} ${FLOPPYSUFFIX:D-s ${FLOPPYSUFFIX}} \
 	    ${FLOPPYBASE} ${FLOPPYSIZE} ${FLOPPYFILES}
Index: games/phantasia/phantglobs.h
===================================================================
RCS file: /cvsroot/src/games/phantasia/phantglobs.h,v
retrieving revision 1.8
diff -u -r1.8 phantglobs.h
--- games/phantasia/phantglobs.h	2001/02/05 01:01:27	1.8
+++ games/phantasia/phantglobs.h	2003/05/07 23:20:44
@@ -4,6 +4,10 @@
  * phantglobs.h - global declarations for Phantasia
  */
 
+#ifdef __CYGWIN__
+#include <sys/cdefs.h>		/* for __P */
+#endif
+
 extern	double	Circle;		/* which circle player is in */
 extern	double	Shield;		/* force field thrown up in monster battle */
 
Index: gnu/dist/groff/Makefile.ccpg
===================================================================
RCS file: /cvsroot/src/gnu/dist/groff/Makefile.ccpg,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile.ccpg
--- gnu/dist/groff/Makefile.ccpg	2001/04/19 12:48:08	1.1.1.1
+++ gnu/dist/groff/Makefile.ccpg	2003/05/07 23:20:49
@@ -6,13 +6,23 @@
   $(top_srcdir)/Makefile.ccpg \
   Makefile.dep
 
-all: $(PROG) $(MANPAGES)
+#
+# Automagically add the .exe extension for Windows
+#
+BUILD_OS!= uname -s
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+EXE=.exe
+.else
+EXE=
+.endif
 
-$(PROG): $(OBJS) $(XLIBS)
+all: $(PROG)$(EXE) $(MANPAGES)
+
+$(PROG)$(EXE): $(OBJS) $(XLIBS)
 	$(LINK.cc) -o $@ $(OBJS) $(XLIBS) $(LIBS) $(MLIB)
 
 install_bin: install_prog
-install_prog: $(PROG)
+install_prog: $(PROG)$(EXE)
 install_data: install_man
 install_man: $(MANPAGES)
 uninstall_sub: uninstall_prog uninstall_man
Index: gnu/dist/groff/Makefile.comm
===================================================================
RCS file: /cvsroot/src/gnu/dist/groff/Makefile.comm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile.comm
--- gnu/dist/groff/Makefile.comm	2001/04/19 12:48:08	1.1.1.1
+++ gnu/dist/groff/Makefile.comm	2003/05/07 23:20:50
@@ -38,7 +38,7 @@
 GRAM=
 LIBCLEAN=
 CLEANADD=
-MOSTLYCLEANFILES=$(MANCLEAN) $(PROG) $(OBJS) $(GENSRCS) $(GENHDRS) \
+MOSTLYCLEANFILES=$(MANCLEAN) $(PROG)$(EXE) $(OBJS) $(GENSRCS) $(GENHDRS) \
   depend.temp core y.output $(CLEANADD)
 CLEANFILES=$(LIBCLEAN)
 DISTCLEANFILES=TAGS Makefile Makefile.dep
@@ -49,6 +49,16 @@
 MANCLEAN=$(MANPAGES)
 fontsubdir=$(fontdir)/dev$(DEV)
 
+#
+# Automagically add the .exe extension for Windows
+#
+BUILD_OS!= uname -s
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+EXE=.exe
+.else
+EXE=
+.endif
+
 all install install_bin install_data TAGS depend distfiles uninstall_sub:
 
 install: prefix_must_exist install_bin install_data
@@ -195,12 +205,12 @@
 .PHONY: install_prog
 install_prog:
 	-test -d $(bindir) || $(mkinstalldirs) $(bindir)
-	rm -f $(bindir)/$(NAMEPREFIX)$(PROG)
-	$(INSTALL_PROGRAM) $(PROG) $(bindir)/$(NAMEPREFIX)$(PROG)
+	rm -f $(bindir)/$(NAMEPREFIX)$(PROG)$(EXE)
+	$(INSTALL_PROGRAM) $(PROG)$(EXE) $(bindir)/$(NAMEPREFIX)$(PROG)$(EXE)
 
 .PHONY: uninstall_prog
 uninstall_prog:
-	-rm -f $(bindir)/$(NAMEPREFIX)$(PROG)	
+	-rm -f $(bindir)/$(NAMEPREFIX)$(PROG)$(EXE)
 
 .PHONY: install_dev
 install_dev:
Index: gnu/dist/groff/src/include/getopt.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/groff/src/include/getopt.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 getopt.h
--- gnu/dist/groff/src/include/getopt.h	2001/04/19 12:50:44	1.1.1.1
+++ gnu/dist/groff/src/include/getopt.h	2003/05/07 23:20:53
@@ -60,6 +60,7 @@
 
 extern int optopt;
 
+#ifndef __CYGWIN__
 #ifndef __need_getopt
 /* Describe the long-named options requested by the application.
    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
@@ -102,6 +103,7 @@
 # define required_argument	1
 # define optional_argument	2
 #endif	/* need getopt */
+#endif	/* ! __CYGWIN__ */
 
 
 /* Get definitions and prototypes for functions to process the
@@ -128,6 +130,7 @@
    arguments to the option '\0'.  This behavior is specific to the GNU
    `getopt'.  */
 
+#ifndef __CYGWIN__
 #if defined __STDC__ && __STDC__
 # ifdef __GNU_LIBRARY__
 /* Many other libraries have conflicting prototypes for getopt, with
@@ -160,6 +163,7 @@
 extern int _getopt_internal ();
 # endif
 #endif /* __STDC__ */
+#endif 	/* ! __ CYGWIN__ */
 
 #ifdef	__cplusplus
 }
Index: gnu/dist/groff/src/libs/libgroff/getopt.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/groff/src/libs/libgroff/getopt.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 getopt.c
--- gnu/dist/groff/src/libs/libgroff/getopt.c	2001/04/19 12:50:52	1.1.1.1
+++ gnu/dist/groff/src/libs/libgroff/getopt.c	2003/05/07 23:20:55
@@ -103,7 +103,11 @@
    GNU application programs can use a third alternative mode in which
    they can distinguish the relative order of options and other arguments.  */
 
+#ifndef __CYGWIN__
 #include "getopt.h"
+#else
+#include "groff-getopt.h"
+#endif
 
 /* For communication from `getopt' to the caller.
    When `getopt' finds an option that takes an argument,
Index: gnu/dist/groff/src/libs/libgroff/getopt1.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/groff/src/libs/libgroff/getopt1.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 getopt1.c
--- gnu/dist/groff/src/libs/libgroff/getopt1.c	2001/04/19 12:50:52	1.1.1.1
+++ gnu/dist/groff/src/libs/libgroff/getopt1.c	2003/05/07 23:20:55
@@ -24,7 +24,11 @@
 #include <config.h>
 #endif
 
+#ifndef __CYGWIN__
 #include "getopt.h"
+#else
+#include "groff-getopt.h"
+#endif
 
 #if !defined __STDC__ || !__STDC__
 /* This is a separate conditional since some stdc systems
Index: gnu/dist/groff/src/utils/pfbtops/pfbtops.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/groff/src/utils/pfbtops/pfbtops.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pfbtops.c
--- gnu/dist/groff/src/utils/pfbtops/pfbtops.c	2001/04/19 12:52:27	1.1.1.1
+++ gnu/dist/groff/src/utils/pfbtops/pfbtops.c	2003/05/07 23:20:56
@@ -3,7 +3,11 @@
 /* This translates ps fonts in .pfb format to ASCII ps files. */
 
 #include <stdio.h>
+#ifndef __CYGWIN__
 #include <getopt.h>
+#else
+#include <groff-getopt.h>
+#endif
 
 #include "nonposix.h"
 
Index: gnu/dist/toolchain/gcc/config/i386/xm-cygwin.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/toolchain/gcc/config/i386/xm-cygwin.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 xm-cygwin.h
--- gnu/dist/toolchain/gcc/config/i386/xm-cygwin.h	2000/07/26 00:18:27	1.1.1.1
+++ gnu/dist/toolchain/gcc/config/i386/xm-cygwin.h	2003/05/07 23:21:20
@@ -19,7 +19,13 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA. */
 
+#ifndef CROSS_COMPILE
+/* Only define this if not a cross compiler... not perfect, but OK for
+ * now.
+ */
 #define EXECUTABLE_SUFFIX ".exe"
+#endif
+
 #define NO_SYS_SIGLIST 1
 
 /* We support both "/" and "\" since everybody tests both but we
Index: gnu/usr.bin/gcc/backend/Makefile
===================================================================
RCS file: /cvsroot/src/gnu/usr.bin/gcc/backend/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- gnu/usr.bin/gcc/backend/Makefile	2003/03/14 03:44:11	1.9
+++ gnu/usr.bin/gcc/backend/Makefile	2003/05/07 23:21:54
@@ -9,6 +9,8 @@
 
 SRCS=		${G_OBJS:.o=.c} ${G_out_file:T}
 
+DPSRCS=		insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
+
 CPPFLAGS+=	-I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*} \
 		-DTARGET_NAME=\"${MACHINE_GNU_PLATFORM}\"
 HOST_CPPFLAGS+=	-I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*}
@@ -41,6 +43,6 @@
 
 insn-attrtab.c: ${G_HOST_RTLANAL:S/^l-//:.o=.c}
 insn-attrtab.c insn-extract.c: insn-config.h
-${OBJS} .depend: insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
+${OBJS}: insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
 
 .PATH: ${DIST}/gcc ${DIST}/libiberty ${G_out_file:H}
Index: gnu/usr.bin/gcc/f771/Makefile
===================================================================
RCS file: /cvsroot/src/gnu/usr.bin/gcc/f771/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- gnu/usr.bin/gcc/f771/Makefile	2001/11/08 00:13:53	1.4
+++ gnu/usr.bin/gcc/f771/Makefile	2003/05/07 23:21:55
@@ -2,6 +2,7 @@
 
 PROG=		f771
 SRCS=		${G_F77_OBJS:.o=.c}
+DPSRCS=		str-1t.h str-2t.h str-fo.h str-io.h str-nq.h str-op.h str-ot.h
 
 CPPFLAGS+=	-I${DIST}/gcc/f -I.
 HOST_CPPFLAGS+=	-I${GCCARCH} -DUSE_HCONFIG= \
@@ -21,7 +22,8 @@
 str-${f}.h str-${f}.j: str-${f}.fin fini
 	./fini ${>:M*.fin} str-${f}.j str-${f}.h
 
-${OBJS} .depend: str-${f}.h
+${OBJS}: str-${f}.h
+
 .endfor
 
 .PATH: ${DIST}/gcc/f
Index: include/heimdal/roken.h
===================================================================
RCS file: /cvsroot/src/include/heimdal/roken.h,v
retrieving revision 1.10
diff -u -r1.10 roken.h
--- include/heimdal/roken.h	2003/01/27 06:19:41	1.10
+++ include/heimdal/roken.h	2003/05/07 23:22:06
@@ -58,8 +58,10 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#ifndef __CYGWIN__
 #include <arpa/nameser.h>
 #include <resolv.h>
+#endif
 #include <syslog.h>
 #include <fcntl.h>
 #include <errno.h>
Index: lib/libc/gen/pwcache.c
===================================================================
RCS file: /cvsroot/src/lib/libc/gen/pwcache.c,v
retrieving revision 1.23
diff -u -r1.23 pwcache.c
--- lib/libc/gen/pwcache.c	2002/12/04 13:08:35	1.23
+++ lib/libc/gen/pwcache.c	2003/05/07 23:22:18
@@ -324,7 +324,11 @@
  *	Pointer to stored name (or a empty string)
  */
 
+#ifdef __CYGWIN__
+char *
+#else
 const char *
+#endif
 group_from_gid(gid_t gid, int noname)
 {
 	struct group *gr;
Index: lib/libc/sys/Makefile.inc
===================================================================
RCS file: /cvsroot/src/lib/libc/sys/Makefile.inc,v
retrieving revision 1.139
diff -u -r1.139 Makefile.inc
--- lib/libc/sys/Makefile.inc	2003/03/14 22:26:13	1.139
+++ lib/libc/sys/Makefile.inc	2003/05/07 23:22:22
@@ -110,19 +110,26 @@
 ${PSEUDONOERR}: ${ASMDEPS}
 	printf '#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n' >${.TARGET}
 
+BUILD_OS!= uname -s
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+SH=/usr/bin/bash
+.else
+SH=sh
+.endif
+
 LintSysNormal.c: ${.CURDIR}/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	CPP=${CPP:Q} sh ${.CURDIR}/sys/makelintstub -o ${.TARGET} \
+	CPP=${CPP:Q} ${SH} ${.CURDIR}/sys/makelintstub -o ${.TARGET} \
 	    -s ${DESTDIR}/usr/include/sys/syscall.h ${ASM} ${WEAKASM}
 
 LintSysNoerr.c: ${.CURDIR}/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	CPP=${CPP:Q} sh ${.CURDIR}/sys/makelintstub -o ${.TARGET} -n \
+	CPP=${CPP:Q} ${SH} ${.CURDIR}/sys/makelintstub -o ${.TARGET} -n \
 	    -s ${DESTDIR}/usr/include/sys/syscall.h ${NOERR}
 
 LintSysPseudoNoerr.c: ${.CURDIR}/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	CPP=${CPP:Q} sh ${.CURDIR}/sys/makelintstub -o ${.TARGET} -p \
+	CPP=${CPP:Q} ${SH} ${.CURDIR}/sys/makelintstub -o ${.TARGET} -p \
 	    -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDONOERR}
 
 MAN+=	accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
Index: lib/libedit/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libedit/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- lib/libedit/Makefile	2002/10/27 21:41:50	1.24
+++ lib/libedit/Makefile	2003/05/07 23:22:24
@@ -59,7 +59,7 @@
 	sh ${LIBEDITDIR}/makelist -fh ${AHDR} > ${.TARGET}.tmp && \
 	    mv ${.TARGET}.tmp ${.TARGET}
 
-fcns.c: ${AHDR} fcns.h makelist
+fcns.c: ${AHDR} fcns.h help.h makelist
 	sh ${LIBEDITDIR}/makelist -fc ${AHDR} > ${.TARGET}.tmp && \
 	    mv ${.TARGET}.tmp ${.TARGET}
 
Index: lib/libkadm5srv/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libkadm5srv/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- lib/libkadm5srv/Makefile	2002/08/29 01:31:30	1.17
+++ lib/libkadm5srv/Makefile	2003/05/07 23:22:25
@@ -89,6 +89,8 @@
 
 ${SRCS:.c=.o}: kadm5_err.h
 
+.depend: kadm5_err.h
+
 CLEANFILES=	kadm5_err.h kadm5_err.c
 
 .include <bsd.lib.mk>
Index: lib/libposix/sys/Makefile.inc
===================================================================
RCS file: /cvsroot/src/lib/libposix/sys/Makefile.inc,v
retrieving revision 1.16
diff -u -r1.16 Makefile.inc
--- lib/libposix/sys/Makefile.inc	2003/01/28 00:35:36	1.16
+++ lib/libposix/sys/Makefile.inc	2003/05/07 23:22:28
@@ -22,7 +22,14 @@
 DPSRCS+=	LintSysPseudo.c
 .endif
 
+BUILD_OS!= uname -s
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+SH=/usr/bin/bash
+.else
+SH=sh
+.endif
+
 LintSysPseudo.c: ${NETBSDSRCDIR}/lib/libc/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	CPP=${CPP:Q} sh ${NETBSDSRCDIR}/lib/libc/sys/makelintstub \
+	CPP=${CPP:Q} ${SH} ${NETBSDSRCDIR}/lib/libc/sys/makelintstub \
 	    -o ${.TARGET} -p -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDO}
Index: sbin/mknod/pack_dev.c
===================================================================
RCS file: /cvsroot/src/sbin/mknod/pack_dev.c,v
retrieving revision 1.3
diff -u -r1.3 pack_dev.c
--- sbin/mknod/pack_dev.c	2002/01/31 22:43:42	1.3
+++ sbin/mknod/pack_dev.c	2003/05/07 23:22:48
@@ -68,10 +68,10 @@
 
 
 	/* exported */
-dev_t
+DEV_T
 pack_native(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev(numbers[0], numbers[1]);
@@ -88,14 +88,14 @@
 #define	major_netbsd(x)		((int32_t)((((x) & 0x000fff00) >>  8)))
 #define	minor_netbsd(x)		((int32_t)((((x) & 0xfff00000) >> 12) | \
 					   (((x) & 0x000000ff) >>  0)))
-#define	makedev_netbsd(x,y)	((dev_t)((((x) <<  8) & 0x000fff00) | \
+#define	makedev_netbsd(x,y)	((DEV_T)((((x) <<  8) & 0x000fff00) | \
 					 (((y) << 12) & 0xfff00000) | \
 					 (((y) <<  0) & 0x000000ff)))
 
-static dev_t
+static DEV_T
 pack_netbsd(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev_netbsd(numbers[0], numbers[1]);
@@ -111,13 +111,13 @@
 
 #define	major_freebsd(x)	((int32_t)(((x) & 0x0000ff00) >> 8))
 #define	minor_freebsd(x)	((int32_t)(((x) & 0xffff00ff) >> 0))
-#define	makedev_freebsd(x,y)	((dev_t)((((x) << 8) & 0x0000ff00) | \
+#define	makedev_freebsd(x,y)	((DEV_T)((((x) << 8) & 0x0000ff00) | \
 					 (((y) << 0) & 0xffff00ff)))
 
-static dev_t
+static DEV_T
 pack_freebsd(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev_freebsd(numbers[0], numbers[1]);
@@ -133,13 +133,13 @@
 
 #define	major_8_8(x)		((int32_t)(((x) & 0x0000ff00) >> 8))
 #define	minor_8_8(x)		((int32_t)(((x) & 0x000000ff) >> 0))
-#define	makedev_8_8(x,y)	((dev_t)((((x) << 8) & 0x0000ff00) | \
+#define	makedev_8_8(x,y)	((DEV_T)((((x) << 8) & 0x0000ff00) | \
 					 (((y) << 0) & 0x000000ff)))
 
-static dev_t
+static DEV_T
 pack_8_8(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev_8_8(numbers[0], numbers[1]);
@@ -155,13 +155,13 @@
 
 #define	major_12_20(x)		((int32_t)(((x) & 0xfff00000) >> 20))
 #define	minor_12_20(x)		((int32_t)(((x) & 0x000fffff) >>  0))
-#define	makedev_12_20(x,y)	((dev_t)((((x) << 20) & 0xfff00000) | \
+#define	makedev_12_20(x,y)	((DEV_T)((((x) << 20) & 0xfff00000) | \
 					 (((y) <<  0) & 0x000fffff)))
 
-static dev_t
+static DEV_T
 pack_12_20(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev_12_20(numbers[0], numbers[1]);
@@ -177,13 +177,13 @@
 
 #define	major_14_18(x)		((int32_t)(((x) & 0xfffc0000) >> 18))
 #define	minor_14_18(x)		((int32_t)(((x) & 0x0003ffff) >>  0))
-#define	makedev_14_18(x,y)	((dev_t)((((x) << 18) & 0xfffc0000) | \
+#define	makedev_14_18(x,y)	((DEV_T)((((x) << 18) & 0xfffc0000) | \
 					 (((y) <<  0) & 0x0003ffff)))
 
-static dev_t
+static DEV_T
 pack_14_18(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev_14_18(numbers[0], numbers[1]);
@@ -199,13 +199,13 @@
 
 #define	major_8_24(x)		((int32_t)(((x) & 0xff000000) >> 24))
 #define	minor_8_24(x)		((int32_t)(((x) & 0x00ffffff) >>  0))
-#define	makedev_8_24(x,y)	((dev_t)((((x) << 24) & 0xff000000) | \
+#define	makedev_8_24(x,y)	((DEV_T)((((x) << 24) & 0xff000000) | \
 					 (((y) <<  0) & 0x00ffffff)))
 
-static dev_t
+static DEV_T
 pack_8_24(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev_8_24(numbers[0], numbers[1]);
@@ -222,14 +222,14 @@
 #define	major_12_12_8(x)	((int32_t)(((x) & 0xfff00000) >> 20))
 #define	unit_12_12_8(x)		((int32_t)(((x) & 0x000fff00) >>  8))
 #define	subunit_12_12_8(x)	((int32_t)(((x) & 0x000000ff) >>  0))
-#define	makedev_12_12_8(x,y,z)	((dev_t)((((x) << 20) & 0xfff00000) | \
+#define	makedev_12_12_8(x,y,z)	((DEV_T)((((x) << 20) & 0xfff00000) | \
 					 (((y) <<  8) & 0x000fff00) | \
 					 (((z) <<  0) & 0x000000ff)))
 
-static dev_t
+static DEV_T
 pack_bsdos(int n, u_long numbers[])
 {
-	dev_t dev;
+	DEV_T dev;
 
 	if (n == 2) {
 		dev = makedev_12_20(numbers[0], numbers[1]);
Index: sbin/mknod/pack_dev.h
===================================================================
RCS file: /cvsroot/src/sbin/mknod/pack_dev.h,v
retrieving revision 1.1
diff -u -r1.1 pack_dev.h
--- sbin/mknod/pack_dev.h	2001/10/08 04:45:30	1.1
+++ sbin/mknod/pack_dev.h	2003/05/07 23:22:48
@@ -39,7 +39,13 @@
 #ifndef	_PACK_DEV_H
 #define	_PACK_DEV_H
 
-typedef	dev_t pack_t(int, u_long []);
+#ifdef __CYGWIN__
+#define DEV_T	__dev32_t
+#else
+#define DEV_T	dev_t
+#endif
+
+typedef	DEV_T pack_t(int, u_long []);
 
 pack_t	*pack_find(const char *);
 pack_t	 pack_native;
Index: share/mk/bsd.dep.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.dep.mk,v
retrieving revision 1.38
diff -u -r1.38 bsd.dep.mk
--- share/mk/bsd.dep.mk	2002/11/26 18:42:30	1.38
+++ share/mk/bsd.dep.mk	2003/05/07 23:23:14
@@ -11,12 +11,16 @@
 ##### Default values
 MKDEP?=		mkdep
 
+##### Detect OS type (for Cygwin support)
+BUILD_OS!=	uname -s
+
 ##### Build rules
 # some of the rules involve .h sources, so remove them from mkdep line
 
 .if defined(SRCS)
 __acpp_flags=	-traditional-cpp
 .NOPATH:	.depend
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} != "CYGWIN"
 .depend: ${SRCS} ${DPSRCS}
 	@rm -f .depend
 	@files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}"; \
@@ -48,6 +52,65 @@
 	  ${MKDEP} -a ${MKDEPFLAGS} \
 	    ${CXXFLAGS:M-[ID]*} ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++} ${CPPFLAGS} $$files; \
 	fi
+.else
+#
+# Cygwin workarounds for limited environment & command line space
+#
+
+SRCS_S = ${SRCS:M*.[sS]} ${DPSRCS:M*.[sS]}
+SRCS_C = ${SRCS:M*.c} ${DPSRCS:M*.c}
+SRCS_M = ${SRCS:M*.m} ${DPSRCS:M*.m}
+SRCS_X = ${SRCS:M*.C} ${DPSRCS:M*.C} \
+         ${SRCS:M*.cc} ${DPSRCS:M*.cc} \
+	 ${SRCS:M*.cxx} ${DPSRCS:M*.cxx} 
+
+.depend: ${SRCS} ${DPSRCS} \
+	 ${SRCS_S:C/(.*)/\1.dep/g:S/^.dep$//g} \
+	 ${SRCS_C:C/(.*)/\1.dep/g:S/^.dep$//g} \
+	 ${SRCS_M:C/(.*)/\1.dep/g:S/^.dep$//g} \
+	 ${SRCS_X:C/(.*)/\1.dep/g:S/^.dep$//g}
+	@rm -f .depend
+	@cat ${.ALLSRC:M*.dep} > .depend
+
+.for F in ${SRCS_S:O:u}
+.NOPATH: ${F:C/(.*)/\1.dep/g}
+${F:C/(.*)/\1.dep/g}: ${F}
+	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} \
+	    ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${__acpp_flags} ${AINC:Q} \
+	    ${.ALLSRC}
+	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \
+	    ${__acpp_flags} ${AINC} ${.ALLSRC}
+.endfor
+
+.for F in ${SRCS_C:O:u}
+.NOPATH: ${F:C/(.*)/\1.dep/g}
+${F:C/(.*)/\1.dep/g}: ${F}
+	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CFLAGS:M-[ID]*:Q} \
+	    ${CPPFLAGS:Q} ${.ALLSRC}
+	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \
+	    ${.ALLSRC}
+.endfor
+
+.for F in ${SRCS_M:O:u}
+.NOPATH: ${F:C/(.*)/\1.dep/g}
+${F:C/(.*)/\1.dep/g}: ${F}
+	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*:Q} \
+	    ${CPPFLAGS:Q} ${.ALLSRC}
+	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} \
+	    ${.ALLSRC}
+.endfor
+
+.for F in ${SRCS_X:O:u}
+.NOPATH: ${F:C/(.*)/\1.dep/g}
+${F:C/(.*)/\1.dep/g}: ${F}
+	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} \
+	    ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${.ALLSRC}
+	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \
+	    ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} \
+	    ${DESTDIR}/usr/include/g++} ${CPPFLAGS} ${.ALLSRC}
+.endfor
+
+.endif # Cygwin
 .endif # defined(SRCS)
 
 ##### Clean rules
Index: sys/arch/i386/stand/genprom/genprom.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/genprom/genprom.c,v
retrieving revision 1.4
diff -u -r1.4 genprom.c
--- sys/arch/i386/stand/genprom/genprom.c	2002/07/20 08:36:18	1.4
+++ sys/arch/i386/stand/genprom/genprom.c	2003/05/07 23:24:10
@@ -13,7 +13,23 @@
  */
 
 #include <stdio.h>
+#ifndef __CYGWIN__
 #include <err.h>
+#else
+/*
+ * Cygwin doesn't have this feature, so we fake it here.
+ * This doesn't handle all of the errx forms, but it does
+ * cover the ones used in this file.
+ */
+
+#define errx(s,m) \
+	do { \
+		fprintf (stderr, m); \
+		exit (s); \
+	} while (0)
+
+#endif
+
 #include <string.h>
 
 #define PROM_SIZE 0x10000	/* max */
Index: sys/conf/Makefile.kern.inc
===================================================================
RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.33
diff -u -r1.33 Makefile.kern.inc
--- sys/conf/Makefile.kern.inc	2003/03/07 01:26:12	1.33
+++ sys/conf/Makefile.kern.inc	2003/05/07 23:25:18
@@ -29,6 +29,7 @@
 CSCOPE?=	cscope
 MKID?=		mkid
 .MAKEOVERRIDES+=USETOOLS	# make sure proper value is propagated
+BUILD_OS!=	uname -s	# to check for Cygwin
 
 ##
 ## (1) port independent source tree identification
@@ -253,6 +254,7 @@
 SRCS?=		${MD_SFILES} ${MD_CFILES} ${MI_CFILES} ${CFILES} ${SFILES}
 MKDEP_AFLAGS?=	${AFLAGS}
 MKDEP_CFLAGS?=	${CFLAGS}
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} != "CYGWIN"
 .depend: ${SRCS} assym.h config_time.h
 	${MKDEP} ${MKDEP_AFLAGS} ${CPPFLAGS} ${MD_SFILES} ${SFILES}
 	${MKDEP} -a ${MKDEP_CFLAGS} ${CPPFLAGS} ${MD_CFILES} ${MI_CFILES} \
@@ -261,7 +263,25 @@
 	    sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} ${CPPFLAGS}
 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
 	@rm -f assym.dep
-.endif
+.else
+#
+# Cygwin version must process the dependencies file at a time to avoid
+# environment size/command line length limitations of Windoze
+#
+.depend: ${SRCS} assym.h config_time.h
+	@rm -f .depend
+.for F in ${MD_SFILES} ${SFILES}
+	${MKDEP} -a ${MKDEP_AFLAGS} ${CPPFLAGS} ${F}
+.endfor
+.for F in ${MD_CFILES} ${MI_CFILES} ${CFILES}
+	${MKDEP} -a ${MKDEP_CFLAGS} ${CPPFLAGS} ${F}
+.endfor
+	cat ${GENASSYM} ${GENASSYM_EXTRAS} | \
+	    sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} ${CPPFLAGS}
+	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
+	@rm -f assym.dep
+.endif	# Cygwin
+.endif	# target(.depend)
 
 .if !target(dependall)
 dependall: depend all
Index: tools/Makefile
===================================================================
RCS file: /cvsroot/src/tools/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- tools/Makefile	2003/03/25 23:43:49	1.63
+++ tools/Makefile	2003/05/07 23:25:56
@@ -22,6 +22,7 @@
 		asn1_compile cat cksum compile_et config file installboot \
 		lint1 makefs menuc mklocale msgc pax pwd_mkdb sunlabel zic
 
+
 .if ${MKMAN} != "no"
 SUBDIR+=	groff
 .endif
Index: tools/Makefile.gnuhost
===================================================================
RCS file: /cvsroot/src/tools/Makefile.gnuhost,v
retrieving revision 1.18
diff -u -r1.18 Makefile.gnuhost
--- tools/Makefile.gnuhost	2003/03/14 05:22:51	1.18
+++ tools/Makefile.gnuhost	2003/05/07 23:25:59
@@ -55,11 +55,22 @@
 # Some systems have a small ARG_MAX.  On such systems, prevent Make
 # variables set on the command line from being exported in the
 # environment (they will still be set in MAKEOVERRIDES).
+
 BUILD_OSTYPE!=	uname -s
+
+.if ${BUILD_OSTYPE:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+
+MAKE_ARGS:=	-X -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS}
+
+.else
+
 .if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD"
 __noenvexport=	-X
 .endif
 MAKE_ARGS:=	${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS}
+
+.endif		# CYGWIN
+
 .else
 MAKE_ARGS+=	_NOWRAPPER=1
 .endif
@@ -69,18 +80,19 @@
 ALL_TARGET?=	all
 INSTALL_TARGET?=install
 
+
 .configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
-	@mkdir build 2>/dev/null || true
-	@(cd build && ${CONFIGURE_ENV} sh ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS})
-	@touch $@
+	mkdir build 2>/dev/null || true
+	(cd build && ${CONFIGURE_ENV} sh ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS})
+	touch $@
 
 # The .build_done timestamp is only updated if a file actually changes
 # in the build tree during "make all".  This way, if nothing has changed,
 # a "make install UPDATE=" will do nothing.
 
 .build_done: .configure_done
-	@(cd build && ${MAKE} ${MAKE_ARGS} ${ALL_TARGET})
-	@if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \
+	(cd build && ${MAKE} ${MAKE_ARGS} ${ALL_TARGET})
+	if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \
 		then touch $@; fi
 
 .install_done: ${BUILD:D.build_done}
Index: tools/Makefile.gnuwrap
===================================================================
RCS file: /cvsroot/src/tools/Makefile.gnuwrap,v
retrieving revision 1.9
diff -u -r1.9 Makefile.gnuwrap
--- tools/Makefile.gnuwrap	2003/03/14 05:22:51	1.9
+++ tools/Makefile.gnuwrap	2003/05/07 23:25:59
@@ -24,7 +24,7 @@
 # variables set on the command line from being exported in the
 # environment (they will still be set in MAKEOVERRIDES).
 BUILD_OSTYPE!=  uname -s
-.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD"
+.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD" || ${BUILD_OSTYPE:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
 __noenvexport=  -X
 .endif
 _GNUWRAPPER:=	${.PARSEDIR}/${.PARSEFILE}
Index: tools/compat/Makefile
===================================================================
RCS file: /cvsroot/src/tools/compat/Makefile,v
retrieving revision 1.23
diff -u -r1.23 Makefile
--- tools/compat/Makefile	2003/04/28 23:16:11	1.23
+++ tools/compat/Makefile	2003/05/07 23:25:59
@@ -27,6 +27,7 @@
 # also use on the host system.
 
 CPPFLAGS+=	-I. -I./include -I${.CURDIR} -DHAVE_CONFIG_H \
+		-I$(NETBSDSRCDIR)/lib/libc/include \
 		-D_FILE_OFFSET_BITS=64 -D_NETBSD_SOURCE
 
 .PATH:		${.CURDIR}/../../lib/libc/gen \
Index: tools/compat/compat_defs.h
===================================================================
RCS file: /cvsroot/src/tools/compat/compat_defs.h,v
retrieving revision 1.26
diff -u -r1.26 compat_defs.h
--- tools/compat/compat_defs.h	2003/03/13 04:30:39	1.26
+++ tools/compat/compat_defs.h	2003/05/07 23:26:02
@@ -281,7 +281,9 @@
 
 #if !HAVE_USER_FROM_UID
 const char *user_from_uid(uid_t, int);
+#ifndef __CYGWIN__
 const char *group_from_gid(gid_t, int);
+#endif
 #endif
 
 #if !HAVE_VASPRINTF
Index: tools/compat/db.h
===================================================================
RCS file: /cvsroot/src/tools/compat/db.h,v
retrieving revision 1.2
diff -u -r1.2 db.h
--- tools/compat/db.h	2002/01/29 10:20:32	1.2
+++ tools/compat/db.h	2003/05/07 23:26:02
@@ -1,5 +1,7 @@
 /*	$NetBSD: db.h,v 1.2 2002/01/29 10:20:32 tv Exp $	*/
 
 #include "config.h"
+#ifndef __BIT_TYPES_DEFINED__
 #define __BIT_TYPES_DEFINED__
+#endif
 #include "../../include/db.h"
Index: tools/groff/Makefile
===================================================================
RCS file: /cvsroot/src/tools/groff/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- tools/groff/Makefile	2003/02/07 01:52:53	1.17
+++ tools/groff/Makefile	2003/05/07 23:26:02
@@ -11,6 +11,16 @@
 _NOWRAPPER=1
 
 #
+# Automagically deal with the .exe extension
+#
+BUILD_OS!= uname -s
+.if ${BUILD_OS:C/([^_]*)_.*/\1/1:tu} == "CYGWIN"
+EXE=.exe
+.else
+EXE=
+.endif
+
+#
 # Fixup build/Makefile.
 # XXX - the groff distribution Makefiles don't get their dependencies right.
 #	We use internal knowledge to specify additional target ordering.
@@ -18,6 +28,7 @@
 #	sequential (i.e. compatible) mode again for subdir makes.
 #
 .configure_done: _post_conf
+
 _post_conf: .USE
 	@(echo '.include "${.CURDIR}/../Makefile.gnuwrap"'; \
 	  echo '.ORDER: $$(ALLDIRS) dot';\
@@ -72,6 +83,7 @@
 .else
 ${TOOLDIR}/bin/${_TOOL_PREFIX}${F}: ${TOOLDIR}/lib/groff/${F}
 .endif
-	ln -f ${.ALLSRC} ${.TARGET}
+	@echo "Linking ..."
+	ln -f ${.ALLSRC}$(EXE) ${.TARGET}$(EXE)
 .endfor
 
Index: usr.bin/hexdump/hexdump.h
===================================================================
RCS file: /cvsroot/src/usr.bin/hexdump/hexdump.h,v
retrieving revision 1.7
diff -u -r1.7 hexdump.h
--- usr.bin/hexdump/hexdump.h	2001/12/07 15:14:29	1.7
+++ usr.bin/hexdump/hexdump.h	2003/05/07 23:26:33
@@ -72,6 +72,16 @@
 	int bcnt;
 } FS;
 
+#ifdef __CYGWIN__
+/* These are not defined in Cygwin's sys/types.h file */
+typedef u_int64_t       u_quad_t;       /* quads */
+typedef int64_t         quad_t;
+typedef quad_t *        qaddr_t;
+
+/* These are not defined in Cygwin's sys/params.h file */
+#define MIN(a,b)	(((a)>(b))?(a):(b))
+#endif
+
 enum _vflag { ALL, DUP, FIRST, WAIT };	/* -v values */
 
 extern int blocksize;			/* data block size */
Index: usr.bin/make/config.h
===================================================================
RCS file: /cvsroot/src/usr.bin/make/config.h,v
retrieving revision 1.14
diff -u -r1.14 config.h
--- usr.bin/make/config.h	2002/01/16 03:40:29	1.14
+++ usr.bin/make/config.h	2003/05/07 23:26:35
@@ -82,8 +82,11 @@
  *	NFS you probably should not, unless you aren't exporting jobs.
  */
 #define	LIBSUFF	".a"
+#ifndef __CYGWIN__
 #define	RECHECK
-
+#else
+#define	RECHECK
+#endif
 /*
  * POSIX
  *	Adhere to the POSIX 1003.2 draft for the make(1) program.
Index: usr.bin/make/main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/main.c,v
retrieving revision 1.87
diff -u -r1.87 main.c
--- usr.bin/make/main.c	2003/03/14 05:19:43	1.87
+++ usr.bin/make/main.c	2003/05/07 23:26:37
@@ -399,10 +399,20 @@
 			if (!**argv)
 				Punt("illegal (null) argument.");
 			if (**argv == '-') {
-				if ((*argv)[1])
+				if ((*argv)[1]) {
 					optind = 0;     /* -flag... */
-				else
+#ifdef __CYGWIN__
+					optreset = 1;
+#endif
+				} else {
 					optind = 1;     /* - */
+#ifdef __CYGWIN__
+					optreset = 1;
+#endif
+				}
+#ifdef __CYGWIN__
+				argv--; argc++;
+#endif
 				goto rearg;
 			}
 			(void)Lst_AtEnd(create, (ClientData)estrdup(*argv));
Index: usr.bin/make/make.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/make.c,v
retrieving revision 1.50
diff -u -r1.50 make.c
--- usr.bin/make/make.c	2002/06/15 18:24:57	1.50
+++ usr.bin/make/make.c	2003/05/07 23:26:41
@@ -578,7 +578,7 @@
 	(gn->type & OP_SAVE_CMDS) || mtime == 0) {
 	if (DEBUG(MAKE)) {
 	    printf(" recheck(%s): update time to now: %s\n",
-		   gn->name, Targ_FmtTime(gn->mtime));
+		   gn->name, Targ_FmtTime(now));
 	}
 	gn->mtime = now;
     }
Index: usr.sbin/config/main.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/config/main.c,v
retrieving revision 1.76
diff -u -r1.76 main.c
--- usr.sbin/config/main.c	2003/04/26 12:53:43	1.76
+++ usr.sbin/config/main.c	2003/05/07 23:27:23
@@ -77,6 +77,10 @@
 #define LINE_MAX 1024
 #endif
 
+#ifndef _PATH_UNIX
+#define _PATH_UNIX	"/netbsd"
+#endif
+
 int	vflag;				/* verbose output */
 int	Pflag;				/* pack locators */
 
Index: usr.sbin/installboot/installboot.h
===================================================================
RCS file: /cvsroot/src/usr.sbin/installboot/installboot.h,v
retrieving revision 1.19
diff -u -r1.19 installboot.h
--- usr.sbin/installboot/installboot.h	2003/04/15 14:22:13	1.19
+++ usr.sbin/installboot/installboot.h	2003/05/07 23:27:24
@@ -130,6 +130,12 @@
 	bbinfo_endian	endian;
 };
 
+#ifdef __CYGWIN__
+/* Missing type */
+typedef u_long ulong;
+
+#endif
+
 extern struct ib_mach	machines[];
 extern struct ib_fs	fstypes[];
 
Index: usr.sbin/mtree/mtree.h
===================================================================
RCS file: /cvsroot/src/usr.sbin/mtree/mtree.h,v
retrieving revision 1.20
diff -u -r1.20 mtree.h
--- usr.sbin/mtree/mtree.h	2002/12/23 04:40:19	1.20
+++ usr.sbin/mtree/mtree.h	2003/05/07 23:27:31
@@ -43,6 +43,12 @@
 
 #define	MISMATCHEXIT	2
 
+#ifdef __CYGWIN__
+#define DEV_T		__dev32_t
+#else
+#define DEV_T		dev_t
+#endif
+
 typedef struct _node {
 	struct _node	*parent, *child;	/* up, down */
 	struct _node	*prev, *next;		/* left, right */
@@ -53,7 +59,7 @@
 	gid_t	st_gid;				/* gid */
 #define	MBITS	(S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
 	mode_t	st_mode;			/* mode */
-	dev_t	st_rdev;			/* device type */
+	DEV_T	st_rdev;			/* device type */
 	u_long	st_flags;			/* flags */
 	nlink_t	st_nlink;			/* link count */
 	u_long	cksum;				/* check sum */
Index: usr.sbin/mtree/spec.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/mtree/spec.c,v
retrieving revision 1.49
diff -u -r1.49 spec.c
--- usr.sbin/mtree/spec.c	2002/12/23 04:40:19	1.49
+++ usr.sbin/mtree/spec.c	2003/05/07 23:27:34
@@ -97,10 +97,10 @@
 size_t	mtree_lineno;			/* Current spec line number */
 int	Wflag;				/* Don't "whack" permissions */
 
-static	dev_t	parsedev(char *);
-static	void	replacenode(NODE *, NODE *);
-static	void	set(char *, NODE *);
-static	void	unset(char *, NODE *);
+static	DEV_T		parsedev(char *);
+static	void		replacenode(NODE *, NODE *);
+static	void		set(char *, NODE *);
+static	void		unset(char *, NODE *);
 
 NODE *
 spec(FILE *fp)
@@ -369,7 +369,7 @@
 }
 
 
-static dev_t
+static DEV_T
 parsedev(char *arg)
 {
 #define MAX_PACK_ARGS	3
@@ -377,8 +377,9 @@
 	char	*p, *ep, *dev;
 	int	argc;
 	pack_t	*pack;
-	dev_t	result;
 
+	DEV_T		result;
+
 	if ((dev = strchr(arg, ',')) != NULL) {
 		*dev++='\0';
 		if ((pack = pack_find(arg)) == NULL)
@@ -398,7 +399,7 @@
 			mtree_err("not enough arguments");
 		result = (*pack)(argc, numbers);
 	} else {
-		result = (dev_t)strtoul(arg, &ep, 0);
+		result = (DEV_T)strtoul(arg, &ep, 0);
 		if (*ep != '\0')
 			mtree_err("invalid device `%s'", arg);
 	}
@@ -528,6 +529,7 @@
 			break;
 		case F_SIZE:
 			ip->st_size = (off_t)strtoll(val, &ep, 10);
+			fprintf(stderr,"size = %lld (%s)\n", ip->st_size, val);
 			if (*ep)
 				mtree_err("invalid size `%s'", val);
 			break;

>Release-Note:
>Audit-Trail:
>Unformatted: