delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2008/01/16/06:49:20

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX18Gvco9j1cGJcrl8/Ii0Ry9sKxysu0MIRT1UO9eqc
DiJGADbvtIeso7
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: Paul Smith <psmith AT gnu DOT org>, Eli Zaretskii <eliz AT gnu DOT org>,
djgpp-workers AT delorie DOT com
Subject: Re: Fixing broken djgpp support in make 3.81
Date: Tue, 15 Jan 2008 20:20:24 +0100
User-Agent: KMail/1.9.5
MIME-Version: 1.0
Message-Id: <200801152020.25753.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

Hello Paul:

[snip]
> It seems like the amount of change you've made will require
> copyright assignment.  I see you've already done some of these,
> for Bison etc., but if you need paperwork let me know.

Please send the required paperwork to me or let me known
where I can get it and I will sign the copyright assignment.


> As for the above, I wonder whether it might be useful to add:
>
>   # define HAVE_DRIVE(n)        0
>
> for the non-HAVE_DOS_PATHS sections of the above ifdef.  That would
> allow us to use HAVE_DRIVE(foo) without enclosing it in ifdefs for DOS
> etc., and still have the compiler omit the code (via optimization of
> always-false values).

You are right and that is the way i would do it; but an inspection of
the make code showed me that all code lines where the macro can be used
were enclosed by ifdefs for DOS, so I have assumed that this was the
prefered coding style and in such a case it made no much sense to me
to define macros that would never be used for other OSs.  If some day
someone decides to criticaly review the existing code, one of the goals
should be to get rid of all these #ifdef HAVE_DOS_PATHS and VMS (if
possible at all) and to replace that code with some generic path syntax
handling code that will make use of such macros to hide OS path syntax
peculiarities.  Then it will become responsability of the different
port maintainers to provide adecuate macros to handle the issue.


I resend the patch with included empty/false definitions of HAVE_DRIVE
for the other OSs in make.h and also fixed character set issues I have
noticed to late in the changelog text.


Regards,
Juan M. Guerrero



2008-01-15  Juan Manuel Guerrero  <juan DOT guerrero AT gmx DOT de>

	* implicit.c: Add const qualifier to *lastslash so it matches the
	declaration of *filename.

	* dir.c (file_exists_p) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.
	(file_impossible) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.
	(file_impossible_p) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.

	* function.c [HAVE_DOS_PATHS, VMS]: Remove IS_PATHSEP definition.
	Now it is defined in its canonical place in make.h.
	(abspath) [HAVE_DOS_PATHS]: Use IS_PATHSEP instead of a literal '/'.
	Support d:foo style absolute file names.
	Add logic for the case that backslash are path separators too.
	Include colon as separator char in the IS_PATHSEP definition and
	use it to check for root char.
	(func_notdir_suffix, func_basename_dir, abspath): Use HAVE_DRIVE.

	* glob/glob.c (my_realloc): Don't define, and don't redefine realloc
	to call it since the DJGPP realloc handles NULL pointers.

       	* hash.c (round_up_2): Use 4294967295U to avoid compiler warnings.

	* implicit.c (pattern_search) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.

	* make.h: All OS specific macros to handle path syntax peculiarities
	are defined here.
	[HAVE_DOS_PATHS]: New macro HAVE_DRIVE to check for drive specifier
	strings like 'a:'.  For all other supported OSs this macro is empty
	and optimzed out.
	[HAVE_DOS_PATHS, VMS]:  Define macro IS_PATHSEP.  Previous definition
	in function.c removed accordingly.

	* Makefile.DOS.template (INCLUDES): Use $(prefix) and the corresponding
	variables to define LIBDIR, INCLUDEDIR and LOCALEDIR instead of using
	the hardcoded ones.
	(SUBDIRS): doc subdir added.
	(INFO_DEPS, DVIS): Values changed to 'make.info' and 'make.dvi'.
	(TEXI2HTML, TEXI2HTML_FLAGS): Removed.  Use makeinfo --html to
	create html formated docs.  texi2html may not be ported to DOS.
	(make.info, make.dvi, make.ps, make.html): Make targets depend on
	'make.texi'.
	(.texi.info, .texi, .texi.dvi): Now recursively invocate.  Change
	-I switch to look in ./ instead of ./doc.
	(html): Target depend on html-recursive instead of make_1.html.
	(make_1.html): Removed.
	(mostlyclean-aminfo): Use $(srcdir)/doc instead of ./ as prefix.
	(all-recursive): Allow for more than one subdir in the build process.
	(mostlyclean-recursive, clean-recursive, distclean-recursive,
	maintainer-clean-recursive, check-recursive): Enter in doc/ too.
	(tags-recursive): Allow for more than one subdir in the build process.
	(info-recursive, dvi-recursive, ps-recursive, html-recursive): New
	targets.  Enter into doc/ to produce the targets.
	(all-am): $(INFO_DEPS) replaced by info.

	* dosbuild.bat: Add -DLOCALEDIR to compiler command line to compile
	main.c.
	Remove make.new if build successfull.
	Use /dev/env/DJDIR instead of c:/djgpp for -DINCLUDEDIR and
	-DLOCALEDIR.

	* tests/scripts/functions/abspath: Added new MSDOS specific tests.
	They reproduce the complete test cases adding up to three new test
	cases but using backslash instead of slash as dir separator and
	prepending a DOS typical drive letter.
	They are only started if the OS is some DOS flouver and DJGPP is
	used as compiler.

	* tests/scripts/options/dash-B: Define $error_message to allow for an
	error message that may be specific to a particular libc implementation.

	* tests/scripts/options/dash-k: Define $error_message to allow for an
	error message that may be specific to a particular libc implementation.

	* tests/scripts/options/dash-W: Define $error_message to allow for an
	error message that may be specific to a particular libc implementation.

	* tests/scripts/targets/SECONDARY: If the port does not support
	parallelism inhibit test cases #9 and #10 (Savannah bug #15919).

	* tests/scripts/variables/MAKE_RESTARTS: Define $error_message to allow
	error message that may be specific to a particular libc implementation.

	* tests/scripts/variables/SHELL: If compiled with DJGPP, do not run
	this test at all.




Index: Makefile.DOS.template
===================================================================
RCS file: /sources/make/make/Makefile.DOS.template,v
retrieving revision 2.16
diff -U 5 -r2.16 Makefile.DOS.template
--- Makefile.DOS.template	22 Dec 2007 12:07:36 -0000	2.16
+++ Makefile.DOS.template	15 Jan 2008 14:17:45 -0000
@@ -1,10 +1,10 @@
 # -*-Makefile-*- template for DJGPP
 # Makefile.in generated automatically by automake 1.2 from Makefile.am
 #
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 # This file is part of GNU Make.
 #
 # GNU Make is free software; you can redistribute it and/or modify it under
 # the terms of the GNU General Public License as published by the Free Software
 # Foundation; either version 3 of the License, or (at your option) any later
@@ -83,17 +83,17 @@
 libglob_a_SOURCES =	%GLOB_SOURCES%
 make_LDADD =	  glob/libglob.a
 
 man_MANS =	make.1
 
-INCLUDES =	-I$(srcdir)/glob -DLIBDIR=\"c:/djgpp/lib\" -DINCLUDEDIR=\"c:/djgpp/include\" -DLOCALEDIR=\"$(localedir)\"
+INCLUDES =	-I$(srcdir)/glob -DLIBDIR=\"$(prefix)$(libdir)\" -DINCLUDEDIR=\"$(prefix)$(includedir)\" -DLOCALEDIR=\"$(prefix)$(localedir)\"
 
 BUILT_SOURCES =	README build.sh-in
 
 EXTRA_DIST = 	$(BUILT_SOURCES) $(man_MANS) README.customs remote-cstms.c  make-stds.texi texinfo.tex SCOPTIONS SMakefile  Makefile.ami README.Amiga config.ami amiga.c amiga.h  NMakefile README.DOS configh.dos configure.bat makefile.com  README.W32 build_w32.bat config.h-W32 subproc.bat make.lnk  config.h-vms makefile.vms readme.vms vmsdir.h vmsfunctions.c  vmsify.c
 
-SUBDIRS =	glob
+SUBDIRS =	glob doc
 mkinstalldirs = ${exec_prefix}/bin/gmkdir -p
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =  build.sh
 PROGRAMS =  $(bin_PROGRAMS)
 
@@ -113,20 +113,17 @@
 CFLAGS = -O2 -g
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
 LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
 TEXI2DVI = texi2dvi
 TEXINFO_TEX = $(srcdir)/config/texinfo.tex
-INFO_DEPS = make.info
-DVIS = make.dvi
+INFO_DEPS = doc/make.info
+DVIS = doc/make.dvi
 TEXINFOS = doc/make.texi
 noinst_TEXINFOS = doc/fdl.texi doc/make-stds.texi
 man1dir = $(mandir)/man1
 MANS = $(man_MANS)
 
-TEXI2HTML = texi2html
-TEXI2HTML_FLAGS = -split_chapter
-
 NROFF = nroff
 DIST_COMMON =  README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL Makefile.am  Makefile.in NEWS acconfig.h aclocal.m4 alloca.c build.sh-in config.h-in  configure configure.in getloadavg.c
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
@@ -189,38 +186,41 @@
 	@command.com /c if exist make.exe del make.exe
 	$(LINK) $(make_LDFLAGS) $(make_OBJECTS) $(make_LDADD) $(LIBS)
 
 # Documentation
 
-make.info: doc/make.texi
-make.dvi: doc/make.texi
+make.info: make.texi
+make.dvi: make.texi
+make.ps: make.dvi make.texi
+make.html: make.texi
 
 
 DVIPS = dvips
 
 .texi.info:
 	@command.com /c if exist make.info* del make.info*
 	@command.com /c if exist make.i* del make.i*
-	$(MAKEINFO) -I$(srcdir)/doc --no-split $< -o ./$@
+	$(MAKEINFO) -I$(srcdir) --no-split $< -o ./$@
 
 .texi:
 	@command.com /c if exist make.info* del make.info*
 	@command.com /c if exist make.i* del make.i*
-	$(MAKEINFO) -I$(srcdir)/doc --no-split $< -o ./$@
+	$(MAKEINFO) -I$(srcdir) --no-split $< -o ./$@
 
 .texi.dvi:
-	TEXINPUTS="$(srcdir)/doc;$$TEXINPUTS"    MAKEINFO='$(MAKEINFO) -I $(srcdir)/doc' $(TEXI2DVI) $<
+	TEXINPUTS="$(srcdir);$$TEXINPUTS"    MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
 
 .dvi.ps:
 	$(DVIPS) $< -o $@
 
 # Other documentation formats
 
-html: make_1.html
+html: html-recursive
 
-make_1.html: $(TEXINFOS) $(noinst_TEXINFOS)
-	$(TEXI2HTML) $(TEXI2HTML_FLAGS) $(srcdir)/doc/make.texi
+.texi.html:
+	@command.com /c if exist make.html* del make.html*
+	$(MAKEINFO) --html -I$(srcdir) --no-split $< -o ./$@
 
 install-info-am: $(INFO_DEPS)
 	@$(NORMAL_INSTALL)
 	$(mkinstalldirs) $(DESTDIR)$(infodir)
 	@for file in $(INFO_DEPS); do    d=$(srcdir);    for ifile in `cd $$d && echo $$file`; do      if test -f $$d/$$ifile; then        echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; else : ; fi;    done;  done
@@ -235,13 +235,16 @@
 
 dist-info: $(INFO_DEPS)
 	for base in $(INFO_DEPS); do    d=$(srcdir);    for file in `cd $$d && eval echo $$base*`; do      test -f $(distdir)/$$file      || ln $$d/$$file $(distdir)/$$file 2> /dev/null      || cp -p $$d/$$file $(distdir)/$$file;    done;  done
 
 mostlyclean-aminfo:
-	-rm -f make.aux make.cp make.cps make.dvi make.fn make.fns make.ky \
-	  make.kys make.ps make.log make.pg make.toc make.tp make.tps \
-	  make.vr make.vrs make.op make.tr make.cv make.cn
+	-rm -f $(srcdir)/doc/make.aux $(srcdir)/doc/make.cp $(srcdir)/doc/make.cps $(srcdir)/doc/make.dvi \
+	  $(srcdir)/doc/make.fn $(srcdir)/doc/make.fns $(srcdir)/doc/make.ky $(srcdir)/doc/make.kys \
+	  $(srcdir)/doc/make.ps $(srcdir)/doc/make.log $(srcdir)/doc/make.pg $(srcdir)/doc/make.toc \
+	  $(srcdir)/doc/make.tp $(srcdir)/doc/make.tps $(srcdir)/doc/make.vr $(srcdir)/doc/make.vrs \
+	  $(srcdir)/doc/make.op $(srcdir)/doc/make.tr $(srcdir)/doc/make.cv $(srcdir)/doc/make.cn \
+	  $(srcdir)/doc/make.html
 
 clean-aminfo:
 
 distclean-aminfo:
 
@@ -289,17 +292,14 @@
 
 # Assume that the only thing to do in glob is to build libglob.a,
 # but do a sanity check: if $SUBDIRS will ever have more than
 # a single directory, yell bloody murder.
 all-recursive:
-ifeq ($(words $(SUBDIRS)), 1)
+ifeq ($(findstring glob, $(SUBDIRS)), glob)
 	@command.com /c if not exist glob\\nul md glob
-	@echo Making all in $(SUBDIRS)
-	$(MAKE) -C $(SUBDIRS) -f ../Makefile INCLUDES='-I$(srcdir) -I$(srcdir)/glob' DEFS='-I.. -I$(srcdir)' VPATH=$(srcdir)/glob libglob.a
-else
-	@echo FATAL: There is more than one directory in "($(SUBDIRS))"
-	@$(EXIT_FAIL)
+	@echo Making all in glob
+	$(MAKE) -C glob -f ../Makefile INCLUDES='-I$(srcdir) -I$(srcdir)/glob' DEFS='-I.. -I$(srcdir)' VPATH=$(srcdir)/glob libglob.a
 endif
 
 $(SUBDIRS):
 	command.com /c md $@
 
@@ -308,26 +308,28 @@
 	$(AR) cru libglob.a $(libglob_a_OBJECTS) $(libglob_a_LIBADD)
 	$(RANLIB) libglob.a
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive check-recursive:
-ifeq ($(words $(SUBDIRS)), 1)
-	@echo Making $(shell echo $@ | sed s/-recursive//) in $(SUBDIRS)
-	$(MAKE) -C $(SUBDIRS) -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am
+ifeq ($(words $(SUBDIRS)), 2)
+	@echo Making $(shell echo $@ | sed s/-recursive//) in glob
+	$(MAKE) -C glob -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am
+	@echo Making $(shell echo $@ | sed s/-recursive//) in doc
+	$(MAKE) -C doc -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am
 else
-	@echo FATAL: There is more than one directory in "($(SUBDIRS))"
+	@echo FATAL: There is more than two directory in "($(SUBDIRS))"
 	@$(EXIT_FAIL)
 endif
 
 tags-in-glob: $(libglob_a_SOURCES)
 	etags $(addprefix $(srcdir)/,$^) -o ./glob/TAGS
 
 tags-recursive:
-ifeq ($(words $(SUBDIRS)), 1)
+ifeq ($(words $(SUBDIRS)), 2)
 	$(MAKE) tags-in-glob
 else
-	@echo FATAL: There is more than one directory in "($(SUBDIRS))"
+	@echo FATAL: There is more than two directory in "($(SUBDIRS))"
 	@$(EXIT_FAIL)
 endif
 
 tags: TAGS
 
@@ -374,19 +376,48 @@
 	-chmod 777 $(distdir)
 	@for file in $(DISTFILES); do d=$(srcdir); test -f $(distdir)/$$file || ln $$d/$$file $(distdir)/$$file 2> /dev/null || cp -p $$d/$$file $(distdir)/$$file; done; for subdir in $(SUBDIRS); do test -d $(distdir)/$$subdir || mkdir $(distdir)/$$subdir || exit 1; chmod 777 $(distdir)/$$subdir; (cd $$subdir && $(MAKE) top_distdir=../$(top_distdir)/$$subdir distdir=../$(distdir)/$$subdir distdir) || exit 1; done
 	$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
 	$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
 
-info: $(INFO_DEPS) info-recursive
-dvi: $(DVIS) dvi-recursive
+info: info-recursive
+info-recursive:
+ifeq ($(findstring doc, $(SUBDIRS)), doc)
+	@command.com /c if not exist doc\\nul md doc
+	@echo Making all in doc
+	$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.info
+endif
+
+dvi: dvi-recursive
+dvi-recursive:
+ifeq ($(findstring doc, $(SUBDIRS)), doc)
+	@command.com /c if not exist doc\\nul md doc
+	@echo Making all in doc
+	$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.dvi
+endif
+
+ps: ps-recursive
+ps-recursive:
+ifeq ($(findstring doc, $(SUBDIRS)), doc)
+	@command.com /c if not exist doc\\nul md doc
+	@echo Making all in doc
+	$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.ps
+endif
+
+html-recursive:
+ifeq ($(findstring doc, $(SUBDIRS)), doc)
+	@command.com /c if not exist doc\\nul md doc
+	@echo Making all in doc
+	$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.html
+endif
+
 check: all-am check-recursive check-local
 	@:
 installcheck: installcheck-recursive
 all-recursive-am: config.h
 	$(MAKE) all-recursive
 
-all-am: Makefile $(INFO_DEPS) $(PROGRAMS) config.h
+all-am: Makefile $(PROGRAMS) config.h info
 
 install-exec-am: install-binPROGRAMS
 
 install-data-am: install-info-am
 
Index: dir.c
===================================================================
RCS file: /sources/make/make/dir.c,v
retrieving revision 1.67
diff -U 5 -r1.67 dir.c
--- dir.c	10 Oct 2007 04:32:16 -0000	1.67
+++ dir.c	15 Jan 2008 14:17:47 -0000
@@ -765,11 +765,11 @@
   {
     const char *bslash = strrchr(name, '\\');
     if (!dirend || bslash > dirend)
       dirend = bslash;
     /* The case of "d:file".  */
-    if (!dirend && name[0] && name[1] == ':')
+    if (!dirend && HAVE_DRIVE (name))
       dirend = name + 1;
   }
 #endif /* HAVE_DOS_PATHS */
   if (dirend == 0)
 #ifndef _AMIGA
@@ -825,11 +825,11 @@
   {
     const char *bslash = strrchr(p, '\\');
     if (!dirend || bslash > dirend)
       dirend = bslash;
     /* The case of "d:file".  */
-    if (!dirend && p[0] && p[1] == ':')
+    if (!dirend && HAVE_DRIVE (p))
       dirend = p + 1;
   }
 # endif /* HAVE_DOS_PATHS */
   if (dirend == 0)
 # ifdef _AMIGA
@@ -907,11 +907,11 @@
   {
     const char *bslash = strrchr(filename, '\\');
     if (!dirend || bslash > dirend)
       dirend = bslash;
     /* The case of "d:file".  */
-    if (!dirend && filename[0] && filename[1] == ':')
+    if (!dirend && HAVE_DRIVE (filename))
       dirend = filename + 1;
   }
 #endif /* HAVE_DOS_PATHS */
   if (dirend == 0)
 #ifdef _AMIGA
Index: dosbuild.bat
===================================================================
RCS file: /sources/make/make/dosbuild.bat,v
retrieving revision 1.7
diff -U 5 -r1.7 dosbuild.bat
--- dosbuild.bat	4 Jul 2007 19:35:18 -0000	1.7
+++ dosbuild.bat	15 Jan 2008 14:17:47 -0000
@@ -1,7 +1,7 @@
 @echo off
-rem Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+rem Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 rem Free Software Foundation, Inc.
 rem This file is part of GNU Make.
 rem
 rem GNU Make is free software; you can redistribute it and/or modify it under
 rem the terms of the GNU General Public License as published by the Free
@@ -23,13 +23,13 @@
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g commands.c -o commands.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g job.c -o job.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g dir.c -o dir.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g file.c -o file.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g misc.c -o misc.o
-gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g main.c -o main.o
-gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DINCLUDEDIR=\"c:/djgpp/include\" -O2 -g read.c -o read.o
-gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DLIBDIR=\"c:/djgpp/lib\" -O2 -g remake.c -o remake.o
+gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DLOCALEDIR=\"/dev/env/DJDIR/share/locale\" -O2 -g main.c -o main.o
+gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DINCLUDEDIR=\"/dev/env/DJDIR/include\" -O2 -g read.c -o read.o
+gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DLIBDIR=\"/dev/env/DJDIR/lib\" -O2 -g remake.c -o remake.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g rule.c -o rule.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g implicit.c -o implicit.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g default.c -o default.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g variable.c -o variable.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g expand.c -o expand.o
@@ -59,5 +59,6 @@
 @echo on
 gcc -o make.new @respf.$$$
 @if exist make.exe echo Make.exe is now built!
 @if not exist make.exe echo Make.exe build failed...
 @if exist make.exe del respf.$$$
+@if exist make.exe del make.new
Index: function.c
===================================================================
RCS file: /sources/make/make/function.c,v
retrieving revision 1.104
diff -U 5 -r1.104 function.c
--- function.c	10 Oct 2007 13:22:21 -0000	1.104
+++ function.c	15 Jan 2008 14:17:51 -0000
@@ -509,20 +509,10 @@
       o = variable_buffer_output (o, "simple", 6);
 
   return o;
 }
 
-#ifdef VMS
-# define IS_PATHSEP(c) ((c) == ']')
-#else
-# ifdef HAVE_DOS_PATHS
-#  define IS_PATHSEP(c) ((c) == '/' || (c) == '\\')
-# else
-#  define IS_PATHSEP(c) ((c) == '/')
-# endif
-#endif
-
 
 static char *
 func_notdir_suffix (char *o, char **argv, const char *funcname)
 {
   /* Expand the argument.  */
@@ -553,11 +543,11 @@
 	    continue;
 	  o = variable_buffer_output (o, p, len - (p - p2));
 	}
 #ifdef HAVE_DOS_PATHS
       /* Handle the case of "d:foo/bar".  */
-      else if (streq (funcname, "notdir") && p2[0] && p2[1] == ':')
+      else if (streq (funcname, "notdir") && HAVE_DRIVE (p2))
 	{
 	  p = p2 + 2;
 	  o = variable_buffer_output (o, p, len - (p - p2));
 	}
 #endif
@@ -605,11 +595,11 @@
         o = variable_buffer_output (o, p2, ++p - p2);
       else if (p >= p2 && (*p == '.'))
         o = variable_buffer_output (o, p2, p - p2);
 #ifdef HAVE_DOS_PATHS
       /* Handle the "d:foobar" case */
-      else if (p2[0] && p2[1] == ':' && is_dir)
+      else if (HAVE_DRIVE (p2) && is_dir)
         o = variable_buffer_output (o, p2, 2);
 #endif
       else if (is_dir)
 #ifdef VMS
         o = variable_buffer_output (o, "[]", 2);
@@ -1882,19 +1872,39 @@
    `..' components nor any repeated path separators ('/').   */
 
 static char *
 abspath (const char *name, char *apath)
 {
+#ifdef HAVE_DOS_PATHS
+# undef  IS_PATHSEP
+# define IS_PATHSEP(c) ((c) == '/' || (c) == '\\' || (c) == ':')
+#endif
+
   char *dest;
   const char *start, *end, *apath_limit;
 
   if (name[0] == '\0' || apath == NULL)
     return NULL;
 
   apath_limit = apath + GET_PATH_MAX;
 
-  if (name[0] != '/')
+#ifdef HAVE_DOS_PATHS
+  if (HAVE_DRIVE (name))  /* DOS-style drive letter? */
+    {
+      strncpy (apath, name, 2);
+      dest = apath + 2;
+      name += 2;
+      if (IS_PATHSEP (*name))
+       {
+         name++;
+         *dest++ = '/';
+       }
+      *dest = '\0';
+    }
+  else
+#endif
+  if (!IS_PATHSEP (name[0]))
     {
       /* It is unlikely we would make it until here but just to make sure. */
       if (!starting_directory)
 	return NULL;
 
@@ -1911,15 +1921,15 @@
   for (start = end = name; *start != '\0'; start = end)
     {
       unsigned long len;
 
       /* Skip sequence of multiple path-separators.  */
-      while (*start == '/')
+      while (IS_PATHSEP (*start))
 	++start;
 
       /* Find end of path component.  */
-      for (end = start; *end != '\0' && *end != '/'; ++end)
+      for (end = start; *end != '\0' && !IS_PATHSEP (*end); ++end)
         ;
 
       len = end - start;
 
       if (len == 0)
@@ -1927,16 +1937,20 @@
       else if (len == 1 && start[0] == '.')
 	/* nothing */;
       else if (len == 2 && start[0] == '.' && start[1] == '.')
 	{
 	  /* Back up to previous component, ignore if at root already.  */
-	  if (dest > apath + 1)
-	    while ((--dest)[-1] != '/');
+	  if (dest > apath + 1
+#ifdef HAVE_DOS_PATHS
+	      && (apath[1] != ':' || dest > apath + 2 + IS_PATHSEP (apath[2]))
+#endif
+	      )
+	    while (--dest, (!IS_PATHSEP (dest[-1])));
 	}
       else
 	{
-	  if (dest[-1] != '/')
+	  if (!IS_PATHSEP (dest[-1]))
             *dest++ = '/';
 
 	  if (dest + len >= apath_limit)
             return NULL;
 
@@ -1945,16 +1959,24 @@
 	  *dest = '\0';
 	}
     }
 
   /* Unless it is root strip trailing separator.  */
-  if (dest > apath + 1 && dest[-1] == '/')
+  if (dest > apath + 1 && IS_PATHSEP (dest[-1])
+#ifdef HAVE_DOS_PATHS
+      && (dest > apath + 3 || dest[-3] == ':')
+#endif
+      )
     --dest;
 
   *dest = '\0';
 
   return apath;
+#ifdef HAVE_DOS_PATHS
+# undef  IS_PATHSEP
+# define IS_PATHSEP(c) ((c) == '/' || (c) == '\\')
+#endif
 }
 
 
 static char *
 func_realpath (char *o, char **argv, const char *funcname UNUSED)
Index: hash.c
===================================================================
RCS file: /sources/make/make/hash.c,v
retrieving revision 2.7
diff -U 5 -r2.7 hash.c
--- hash.c	4 Jul 2007 19:35:18 -0000	2.7
+++ hash.c	15 Jan 2008 14:17:51 -0000
@@ -319,11 +319,11 @@
   n |= (n >> 2);
   n |= (n >> 4);
   n |= (n >> 8);
   n |= (n >> 16);
 
-#if !defined(HAVE_LIMITS_H) || ULONG_MAX > 4294967295
+#if !defined(HAVE_LIMITS_H) || ULONG_MAX > 4294967295U
   /* We only need this on systems where unsigned long is >32 bits.  */
   n |= (n >> 32);
 #endif
 
   return n + 1;
Index: implicit.c
===================================================================
RCS file: /sources/make/make/implicit.c,v
retrieving revision 1.66
diff -U 5 -r1.66 implicit.c
--- implicit.c	4 Jul 2007 19:35:19 -0000	1.66
+++ implicit.c	15 Jan 2008 14:17:53 -0000
@@ -192,11 +192,11 @@
 
   /* Length of FILENAME.  */
   unsigned int namelen = strlen (filename);
 
   /* The last slash in FILENAME (or nil if there is none).  */
-  char *lastslash;
+  const char *lastslash;
 
   /* This is a file-object used as an argument in
      recursive calls.  It never contains any data
      except during a recursive call.  */
   struct file *intermediate_file = 0;
@@ -272,11 +272,11 @@
 	 and the case of "d:file".  */
       {
 	char *bslash = strrchr (filename, '\\');
 	if (lastslash == 0 || bslash > lastslash)
 	  lastslash = bslash;
-	if (lastslash == 0 && filename[0] && filename[1] == ':')
+	if (lastslash == 0 && HAVE_DRIVE (filename))
 	  lastslash = filename + 1;
       }
 #endif
 #endif
       if (lastslash != 0 && lastslash[1] == '\0')
@@ -339,11 +339,11 @@
 #ifdef HAVE_DOS_PATHS
               /* Didn't find it yet: check for DOS-type directories.  */
               if (check_lastslash)
                 {
                   char *b = strchr (target, '\\');
-                  check_lastslash = !(b || (target[0] && target[1] == ':'));
+                  check_lastslash = !(b || HAVE_DRIVE (target));
                 }
 #endif
 #endif
             }
 	  if (check_lastslash)
Index: make.h
===================================================================
RCS file: /sources/make/make/make.h,v
retrieving revision 1.131
diff -U 5 -r1.131 make.h
--- make.h	4 Nov 2007 21:54:01 -0000	1.131
+++ make.h	15 Jan 2008 14:17:54 -0000
@@ -308,14 +308,20 @@
 
 /* Handle other OSs.  */
 #ifndef PATH_SEPARATOR_CHAR
 # if defined(HAVE_DOS_PATHS)
 #  define PATH_SEPARATOR_CHAR ';'
+#  define IS_PATHSEP(c)       ((c) == '/' || (c) == '\\')
+#  define HAVE_DRIVE(n)       ((n)[0] && (n)[1] == ':')
 # elif defined(VMS)
 #  define PATH_SEPARATOR_CHAR ','
+#  define IS_PATHSEP(c)       ((c) == ']')
+#  define HAVE_DRIVE(n)       (0)
 # else
 #  define PATH_SEPARATOR_CHAR ':'
+#  define IS_PATHSEP(c)       ((c) == '/')
+#  define HAVE_DRIVE(n)       (0)
 # endif
 #endif
 
 /* This is needed for getcwd() and chdir(), on some W32 systems.  */
 #if defined(HAVE_DIRECT_H)
Index: glob/glob.c
===================================================================
RCS file: /sources/make/make/glob/glob.c,v
retrieving revision 1.28
diff -U 5 -r1.28 glob.c
--- glob/glob.c	22 Dec 2007 11:28:49 -0000	1.28
+++ glob/glob.c	15 Jan 2008 14:17:56 -0000
@@ -180,21 +180,18 @@
 # define HAVE_MEMPCPY	1
 # undef  mempcpy
 # define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
 #endif
 
-#ifndef	__GNU_LIBRARY__
+#if !defined __GNU_LIBRARY__ && !defined __DJGPP__
 # ifdef	__GNUC__
 __inline
 # endif
 # ifndef __SASC
 #  ifdef WINDOWS32
 static void *
 my_realloc (void *p, unsigned int n)
-#  elif defined(__DJGPP__)
-static void *
-my_realloc (void *p, size_t n)
 #  else
 static char *
 my_realloc (p, n)
      char *p;
      unsigned int n;
@@ -206,11 +203,11 @@
     return (char *) malloc (n);
   return (char *) realloc (p, n);
 }
 # define	realloc	my_realloc
 # endif /* __SASC */
-#endif /* __GNU_LIBRARY__ */
+#endif /* __GNU_LIBRARY__ || __DJGPP__ */
 
 
 #if !defined __alloca && !defined __GNU_LIBRARY__
 
 # ifdef	__GNUC__
Index: tests/scripts/functions/abspath
===================================================================
RCS file: /sources/make/make/tests/scripts/functions/abspath,v
retrieving revision 1.2
diff -U 5 -r1.2 abspath
--- tests/scripts/functions/abspath	29 Aug 2005 14:11:01 -0000	1.2
+++ tests/scripts/functions/abspath	15 Jan 2008 14:17:57 -0000
@@ -75,7 +75,119 @@
 ',
 '',
 '');
 
 
+if ($port_type eq "DOS") {
+  if (exists $ENV{DJDIR}) {
+  #
+  #  Some DOS specific tests that are supported
+  #  only by the DJGPP port of make.
+  #
+  #  For every unix-style test case up to three more are
+  #  added to test for paths with backslash instead slash
+  #  as directory separator; to test for paths with mixed
+  #  backslash and slash as dir separator and to test for
+  #  paths with a drive letter prepended.
+  #
+
+$description = "Test the abspath functions with DOS path syntax.";
+
+$details = "";
+
+run_make_test('
+ifneq ($(realpath $(abspath .\)),$(CURDIR))
+  $(warning .\: abs="$(abspath .\)" real="$(realpath $(abspath .\))" curdir="$(CURDIR)")
+endif
+
+ifneq ($(realpath $(abspath .\\\)),$(CURDIR))
+  $(warning .\\\: abs="$(abspath .\\\)" real="$(realpath $(abspath .\\\))" curdir="$(CURDIR)")
+endif
+
+ifneq ($(abspath \),/)
+  $(warning \: abspath="$(abspath \)")
+endif
+
+ifneq ($(abspath \\\\\\),/)
+  $(warning \\\\\\: abspath="$(abspath \\\\\\)")
+endif
+
+ifneq ($(abspath \\.),/)
+  $(warning \\.: abspath="$(abspath \\.)")
+endif
+
+ifneq ($(abspath ///.),/)
+  $(warning ///.: abspath="$(abspath ///.)")
+endif
+
+ifneq ($(abspath \\./),/)
+  $(warning \\./: abspath="$(abspath \\./)")
+endif
+
+ifneq ($(abspath \\.///),/)
+  $(warning \\.///: abspath="$(abspath \\.///)")
+endif
+
+ifneq ($(abspath \\..),/)
+  $(warning \\..: abspath="$(abspath \\..)")
+endif
+
+ifneq ($(abspath //\\..),/)
+  $(warning //\\..: abspath="$(abspath //\\..)")
+endif
+
+ifneq ($(abspath \\../),/)
+  $(warning \\../: abspath="$(abspath \\../)")
+endif
+
+ifneq ($(abspath \\..///),/)
+  $(warning \\..///: abspath="$(abspath \\..///)")
+endif
+
+
+ifneq ($(abspath \\foo\\bar\\..),/foo)
+  $(warning \\foo\\bar\\..: abspath="$(abspath \\foo\\bar\\..)")
+endif
+
+ifneq ($(abspath a:\\foo\\bar\\..),a:/foo)
+  $(warning a:\\foo\\bar\\..: abspath="$(abspath a:\\foo\\bar\\..)")
+endif
+
+ifneq ($(abspath a:foo\\bar\\..),a:foo)
+  $(warning a:foo\\bar\\..: abspath="$(abspath a:foo\\bar\\..)")
+endif
+
+ifneq ($(abspath \\foo\\bar\\..\\..\\..\\baz),/baz)
+  $(warning \\foo\\bar\\..\\..\\..\\baz: abspath="$(abspath \\foo\\bar\\..\\..\\..\\baz)")
+endif
+
+ifneq ($(abspath a:\\foo\\bar\\..\\..\\..\\baz),a:/baz)
+  $(warning a:\\foo\\bar\\..\\..\\..\\baz: abspath="$(abspath a:\\foo\\bar\\..\\..\\..\\baz)")
+endif
+
+ifneq ($(abspath a:foo\\bar\\..\\..\\..\\baz),a:baz)
+  $(warning a:foo\\bar\\..\\..\\..\\baz: abspath="$(abspath a:foo\\bar\\..\\..\\..\\baz)")
+endif
+
+ifneq ($(abspath \\foo\\bar\\..\\ \\..),/foo /)
+  $(warning \\foo\\bar\\..\\ \\..: abspath="$(abspath \\foo\\bar\\..\\ \\..)")
+endif
+
+ifneq ($(abspath a:\\foo\\bar\\..\\ a:\\..),a:/foo a:/)
+  $(warning a:\\foo\\bar\\..\\ a:\\..: abspath="$(abspath a:\\foo\\bar\\..\\ a:\\..)")
+endif
+
+ifneq ($(abspath a:foo\\bar\\..\\ a:..),a:foo a:)
+  $(warning a:foo\\bar\\..\\ a:..: abspath="$(abspath a:foo\\bar\\..\\ a:..)")
+endif
+
+.PHONY: all
+all: ; @:
+',
+'',
+'');
+
+  }
+}
+
 # This tells the test driver that the perl test script executed properly.
 1;
Index: tests/scripts/options/dash-B
===================================================================
RCS file: /sources/make/make/tests/scripts/options/dash-B,v
retrieving revision 1.4
diff -U 5 -r1.4 dash-B
--- tests/scripts/options/dash-B	25 Jun 2005 18:57:28 -0000	1.4
+++ tests/scripts/options/dash-B	15 Jan 2008 14:17:57 -0000
@@ -36,19 +36,31 @@
 rmfiles('bar.x', 'foo');
 
 # Test -B with the re-exec feature: we don't want to re-exec forever
 # Savannah bug # 7566
 
+if ($port_type eq "DOS") {
+  if (exists $ENV{DJDIR}) {
+  #
+  #  If compiled with DJGPP an error message (ENOENT) is issued.
+  #
+    $error_message = '(ENOENT)';
+  }
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('
 all: ; @:
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @touch $@
 ',
-              '-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
-MAKE_RESTARTS=1');
+              '-B', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
+MAKE_RESTARTS=1");
 
 rmfiles('foo.x');
 
 # Test -B with the re-exec feature: we DO want -B in the "normal" part of the
 # makefile.
@@ -60,14 +72,14 @@
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @touch $@
 blah.x: ; @echo $@
 ',
-              '-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
+              '-B', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
 MAKE_RESTARTS=1
 blah.x
-all');
+all");
 
 rmfiles('foo.x', 'blah.x');
 
 1;
Index: tests/scripts/options/dash-W
===================================================================
RCS file: /sources/make/make/tests/scripts/options/dash-W,v
retrieving revision 1.5
diff -U 5 -r1.5 dash-W
--- tests/scripts/options/dash-W	8 Mar 2006 20:15:09 -0000	1.5
+++ tests/scripts/options/dash-W	15 Jan 2008 14:17:57 -0000
@@ -31,24 +31,36 @@
 # Test -W with the re-exec feature: we don't want to re-exec forever
 # Savannah bug # 7566
 
 # First set it up with a normal build
 
+if ($port_type eq "DOS") {
+  if (exists $ENV{DJDIR}) {
+  #
+  #  If compiled with DJGPP an error message (ENOENT) is issued.
+  #
+    $error_message = '(ENOENT)';
+  }
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('
 all: baz.x ; @:
 include foo.x
 foo.x: bar.x
 	@echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@
 	@echo "touch $@"
 bar.x: ; echo >> $@
 baz.x: bar.x ; @echo "touch $@"
 ',
-              '', '#MAKEFILE#:3: foo.x: No such file or directory
+              '', "#MAKEFILE#:3: foo.x: No such file or directory $error_message
 echo >> bar.x
 touch foo.x
 restarts=1
-touch baz.x');
+touch baz.x");
 
 # Now run with -W bar.x
 
 # Tweak foo.x's timestamp so the update will change it.
 &utouch(1000, 'foo.x');
Index: tests/scripts/options/dash-k
===================================================================
RCS file: /sources/make/make/tests/scripts/options/dash-k,v
retrieving revision 1.3
diff -U 5 -r1.3 dash-k
--- tests/scripts/options/dash-k	16 May 2004 19:16:56 -0000	1.3
+++ tests/scripts/options/dash-k	15 Jan 2008 14:17:57 -0000
@@ -98,16 +98,28 @@
 &compare_output($answer, &get_logfile(1));
 
 # TEST -- make sure we keep the error code if we can't create an included
 # makefile.
 
+if ($port_type eq "DOS") {
+  if (exists $ENV{DJDIR}) {
+  #
+  #  If compiled with DJGPP an error message (ENOENT) is issued.
+  #
+    $error_message = '(ENOENT)';
+  }
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('all: ; @echo hi
 include ifile
 ifile: no-such-file; @false
 ',
               '-k',
-              "#MAKEFILE#:2: ifile: No such file or directory
+              "#MAKEFILE#:2: ifile: No such file or directory $error_message
 #MAKE#: *** No rule to make target `no-such-file', needed by `ifile'.
 #MAKE#: Failed to remake makefile `ifile'.
 hi\n",
               512);
 
Index: tests/scripts/targets/SECONDARY
===================================================================
RCS file: /sources/make/make/tests/scripts/targets/SECONDARY,v
retrieving revision 1.6
diff -U 5 -r1.6 SECONDARY
--- tests/scripts/targets/SECONDARY	15 Aug 2007 13:53:54 -0000	1.6
+++ tests/scripts/targets/SECONDARY	15 Jan 2008 14:17:57 -0000
@@ -119,10 +119,14 @@
 all: version2',
               'all', 'GOOD');
 
 unlink('version2');
 
+if (!$parallel_jobs) {
+  return 1;
+}
+
 # TEST #9 -- Savannah bug #15919
 # The original fix for this bug caused a new bug, shown here.
 
 touch(qw(1.a 2.a));
 
Index: tests/scripts/variables/MAKE_RESTARTS
===================================================================
RCS file: /sources/make/make/tests/scripts/variables/MAKE_RESTARTS,v
retrieving revision 1.1
diff -U 5 -r1.1 MAKE_RESTARTS
--- tests/scripts/variables/MAKE_RESTARTS	25 Jun 2005 18:57:28 -0000	1.1
+++ tests/scripts/variables/MAKE_RESTARTS	15 Jan 2008 14:17:58 -0000
@@ -2,19 +2,31 @@
 
 $description = "Test the MAKE_RESTARTS variable.";
 
 # Test basic capability
 
+if ($port_type eq "DOS") {
+  if (exists $ENV{DJDIR}) {
+  #
+  #  If compiled with DJGPP an error message (ENOENT) is issued.
+  #
+    $error_message = '(ENOENT)';
+  }
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('
 all: ; @:
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @touch $@
 ',
-              '', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
-MAKE_RESTARTS=1');
+              '', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
+MAKE_RESTARTS=1");
 
 rmfiles('foo.x');
 
 # Test multiple restarts
 
@@ -23,15 +35,15 @@
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @echo "include bar.x" > $@
 bar.x: ; @touch $@
 ',
-              '', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
+              '', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
 MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
-MAKE_RESTARTS=2');
+foo.x:1: bar.x: No such file or directory $error_message
+MAKE_RESTARTS=2");
 
 rmfiles('foo.x', 'bar.x');
 
 # Test multiple restarts and make sure the variable is cleaned up
 
@@ -45,13 +57,13 @@
 include foo.x
 foo.x: ; @echo "include bar.x" > $@
 bar.x: ; @touch $@
 ',
               '', "MAKE_RESTARTS=
-#MAKEFILE#:8: foo.x: No such file or directory
+#MAKEFILE#:8: foo.x: No such file or directory $error_message
 MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
+foo.x:1: bar.x: No such file or directory $error_message
 MAKE_RESTARTS=2
 recurse MAKE_RESTARTS=
 MAKE_RESTARTS=
 #MAKE#[1]: Entering directory `#PWD#'
 all MAKE_RESTARTS=
Index: tests/scripts/variables/SHELL
===================================================================
RCS file: /sources/make/make/tests/scripts/variables/SHELL,v
retrieving revision 1.4
diff -U 5 -r1.4 SHELL
--- tests/scripts/variables/SHELL	25 Aug 2005 04:40:11 -0000	1.4
+++ tests/scripts/variables/SHELL	15 Jan 2008 14:17:58 -0000
@@ -1,9 +1,15 @@
 #                                                                    -*-perl-*-
 
 $description = "Test proper handling of SHELL.";
 
+if ($port_type eq "DOS") {
+  if (exists $ENV{DJDIR}) {
+    return -1;
+  }
+}
+
 # Find the default value when SHELL is not set.  On UNIX it will be /bin/sh,
 # but on other platforms who knows?
 resetENV();
 delete $ENV{SHELL};
 $mshell = `echo 'all:;\@echo \$(SHELL)' | $make_path -f-`;

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019