From 0d70d054586cf2e718aacd5fccfc47e32975b092 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 19 Jun 2000 21:22:44 +0000 Subject: [PATCH] * Various fixes for problems in the 3.79.0.1 pretest. --- ChangeLog | 23 ++++++++++++++++ Makefile.DOS.template | 29 ++++++++++---------- README.DOS.template | 9 +++++++ acinclude.m4 | 2 +- configh.dos.template | 6 +++++ configure.in | 4 +-- expand.c | 6 ++++- file.c | 3 ++- function.c | 2 +- implicit.c | 30 ++++++++++++--------- job.c | 3 ++- make.h | 6 ++++- remake.c | 2 +- tests/ChangeLog | 16 +++++++++++ tests/scripts/functions/addsuffix | 44 +++++++++++++------------------ tests/scripts/options/general | 16 ++++++----- 16 files changed, 133 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4885bb5..b88026b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2000-06-19 Paul D. Smith + + * function.c (handle_function): If the last argument was empty, we + were pretending it didn't exist rather than providing an empty + value. Keep looking until we're past the end, not just at the end. + + * implicit.c (pattern_search): Multi-target implicit rules weren't + expanding the "also made" targets correctly if the pattern didn't + contain a slash but the target did; in that case the directory + part wasn't being added back to the stem on the "also made" + targets. Reported by Seth M LaForge , with + a patch. + +2000-06-17 Eli Zaretskii + + * Makefile.DOS.template (DESTDIR, bindir, datadir, libdir) + (infodir, mandir, includedir): Support installation under a + non-default DESTDIR. + + * remake.c (f_mtime): Fix the spelling of __MSDOS__. + + * configh.DOS.template (HAVE_FDOPEN, HAVE_MKSTEMP): Define. + 2000-06-14 Paul D. Smith * acinclude.m4 (pds_WITH_GETTEXT): rewrite fp_WITH_GETTEXT and diff --git a/Makefile.DOS.template b/Makefile.DOS.template index c445381f..8819f1bc 100644 --- a/Makefile.DOS.template +++ b/Makefile.DOS.template @@ -15,26 +15,25 @@ VPATH = $(srcdir) prefix = /dev/env/DJDIR exec_prefix = ${prefix} -bindir = ${exec_prefix}/bin -datadir = ${prefix}/share -libdir = ${prefix}/lib -infodir = ${prefix}/info -# DJGPP doesn't have separate man tree, use info instead. -mandir = ${prefix}/info -includedir = ${prefix}/include +bindir = /bin +datadir = /share +libdir = /lib +infodir = /info +mandir = /man +includedir = /include oldincludedir = c:/djgpp/include -DESTDIR = +DESTDIR = /dev/env/DJDIR pkgdatadir = $(datadir)/make pkglibdir = $(libdir)/make pkgincludedir = $(includedir)/make -localedir = $(prefix)/share/locale +localedir = $(datadir)/locale -INSTALL = ${bindir}/ginstall -c -INSTALL_PROGRAM = ${bindir}/ginstall -c -INSTALL_DATA = ${bindir}/ginstall -c -m 644 -INSTALL_SCRIPT = ${bindir}/ginstall -c +INSTALL = ${exec_prefix}/bin/ginstall -c +INSTALL_PROGRAM = ${exec_prefix}/bin/ginstall -c +INSTALL_DATA = ${exec_prefix}/bin/ginstall -c -m 644 +INSTALL_SCRIPT = ${exec_prefix}/bin/ginstall -c transform = s,x,x, # This will fail even if they don't have a Unix-like shell (stock DOS @@ -52,7 +51,7 @@ AR = ar CC = gcc CPP = gcc -E LIBOBJS = -MAKEINFO = ${bindir}/makeinfo +MAKEINFO = ${exec_prefix}/bin/makeinfo PACKAGE = make PERL = perl RANLIB = ranlib @@ -78,7 +77,7 @@ 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 -mkinstalldirs = ${bindir}/gmkdir -p +mkinstalldirs = ${exec_prefix}/bin/gmkdir -p CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = build.sh PROGRAMS = $(bin_PROGRAMS) diff --git a/README.DOS.template b/README.DOS.template index 5218bb49..ac11d46f 100644 --- a/README.DOS.template +++ b/README.DOS.template @@ -95,6 +95,15 @@ To build from sources: will also need GNU Fileutils and GNU Sed for this (they should be available from the DJGPP sites). + By default, GNU make will install into your DJGPP installation + area. If you wish to use a different directory, override the + DESTDIR variable when invoking "make install", like this: + + make install DESTDIR=c:/other/dir + + This causes the make executable to be placed in c:/other/dir/bin, + the man pages in c:/other/dir/man, etc. + Without a Unix-style shell, you will have to install programs and the docs manually. Copy make.exe to a directory on your PATH, make.i* info files to your Info directory, and update the diff --git a/acinclude.m4 b/acinclude.m4 index bbee5359..53b77cc9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -534,7 +534,7 @@ not GNU gettext AC_DEFINE(HAVE_LIBINTL_H, 1, [Define if you have .]) else with_included_gettext=yes - LIBS="$fp_keep_LIBS" + LIBS="$pds_keep_LIBS" fi fi ]) diff --git a/configh.dos.template b/configh.dos.template index 36fb953e..ba7485b9 100644 --- a/configh.dos.template +++ b/configh.dos.template @@ -23,6 +23,9 @@ #endif +/* Define if you have the fdopen function. */ +#define HAVE_FDOPEN 1 + /* Define if you have sigsetmask. */ #define HAVE_SIGSETMASK 1 @@ -32,6 +35,9 @@ /* Define if you have the memmove function. */ #define HAVE_MEMMOVE 1 +/* Define if you have the mkstemp function. */ +#define HAVE_MKSTEMP 1 + #define SCCS_GET "get" /* Define to `unsigned long' or `unsigned long long' diff --git a/configure.in b/configure.in index 97c28740..23883282 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_REVISION([$Id$]) AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required. AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. -AM_INIT_AUTOMAKE(make, 3.79.0.1) +AM_INIT_AUTOMAKE(make, 3.79.0.2) AM_CONFIG_HEADER(config.h) dnl Regular configure stuff @@ -66,7 +66,7 @@ AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. AC_SEARCH_LIBS(clock_gettime, [rt posix4]) -if test $ac_cv_search_clock_gettime != no; then +if test "$ac_cv_search_clock_gettime" != no; then AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have the clock_gettime function.]) fi diff --git a/expand.c b/expand.c index b679a90b..8ada0cdf 100644 --- a/expand.c +++ b/expand.c @@ -17,9 +17,10 @@ along with GNU Make; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "make.h" + #include -#include "make.h" #include "filedef.h" #include "job.h" #include "commands.h" @@ -426,6 +427,9 @@ expand_argument (str, end) { char *tmp; + if (str == end) + return xstrdup(""); + if (!end || *end == '\0') tmp = str; else diff --git a/file.c b/file.c index d9e4c1bd..ede68594 100644 --- a/file.c +++ b/file.c @@ -17,9 +17,10 @@ along with GNU Make; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "make.h" + #include -#include "make.h" #include "dep.h" #include "filedef.h" #include "job.h" diff --git a/function.c b/function.c index 9b5fc669..5d15ff68 100644 --- a/function.c +++ b/function.c @@ -1778,7 +1778,7 @@ handle_function (op, stringp) p = beg; nargs = 0; - for (p=beg, nargs=0; p < end; ++argvp) + for (p=beg, nargs=0; p <= end; ++argvp) { char *next; diff --git a/implicit.c b/implicit.c index c0ca4ed7..15c54879 100644 --- a/implicit.c +++ b/implicit.c @@ -1,5 +1,5 @@ /* Implicit rule searching for GNU Make. -Copyright (C) 1988,89,90,91,92,93,94,97 Free Software Foundation, Inc. +Copyright (C) 1988,89,90,91,92,93,94,97,2000 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -117,6 +117,7 @@ pattern_search (file, archive, depth, recursions) /* The start and length of the stem of FILENAME for the current rule. */ register char *stem = 0; register unsigned int stemlen = 0; + register unsigned int fullstemlen = 0; /* Buffer in which we store all the rules that are possibly applicable. */ struct rule **tryrules @@ -582,18 +583,23 @@ pattern_search (file, archive, depth, recursions) } if (!checked_lastslash[foundrule]) - /* Always allocate new storage, since STEM might be - on the stack for an intermediate file. */ - file->stem = savestring (stem, stemlen); + { + /* Always allocate new storage, since STEM might be + on the stack for an intermediate file. */ + file->stem = savestring (stem, stemlen); + fullstemlen = stemlen; + } else { + int dirlen = (lastslash + 1) - filename; + /* We want to prepend the directory from the original FILENAME onto the stem. */ - file->stem = (char *) xmalloc (((lastslash + 1) - filename) - + stemlen + 1); - bcopy (filename, file->stem, (lastslash + 1) - filename); - bcopy (stem, file->stem + ((lastslash + 1) - filename), stemlen); - file->stem[((lastslash + 1) - filename) + stemlen] = '\0'; + fullstemlen = dirlen + stemlen; + file->stem = (char *) xmalloc (fullstemlen + 1); + bcopy (filename, file->stem, dirlen); + bcopy (stem, file->stem + dirlen, stemlen); + file->stem[fullstemlen] = '\0'; } file->cmds = rule->cmds; @@ -606,12 +612,12 @@ pattern_search (file, archive, depth, recursions) if (i != matches[foundrule]) { struct dep *new = (struct dep *) xmalloc (sizeof (struct dep)); - new->name = p = (char *) xmalloc (rule->lens[i] + stemlen + 1); + new->name = p = (char *) xmalloc (rule->lens[i] + fullstemlen + 1); bcopy (rule->targets[i], p, rule->suffixes[i] - rule->targets[i] - 1); p += rule->suffixes[i] - rule->targets[i] - 1; - bcopy (stem, p, stemlen); - p += stemlen; + bcopy (file->stem, p, fullstemlen); + p += fullstemlen; bcopy (rule->suffixes[i], p, rule->lens[i] - (rule->suffixes[i] - rule->targets[i]) + 1); new->file = enter_file (new->name); diff --git a/job.c b/job.c index 3698f698..1c11a38a 100644 --- a/job.c +++ b/job.c @@ -17,9 +17,10 @@ along with GNU Make; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "make.h" + #include -#include "make.h" #include "job.h" #include "debug.h" #include "filedef.h" diff --git a/make.h b/make.h index c7fc4b6a..8ddbb94a 100644 --- a/make.h +++ b/make.h @@ -39,6 +39,11 @@ Boston, MA 02111-1307, USA. */ # define PARAMS(protos) () #endif /* C++ or ANSI C. */ +/* Specify we want GNU source code. This must be defined before any + system headers are included. */ + +#define _GNU_SOURCE 1 + /* Include libintl.h, if it was found: we don't even look for it unless we want to use the system's gettext(). If not, use the included gettext.h. */ @@ -77,7 +82,6 @@ Boston, MA 02111-1307, USA. */ # define __NO_STRING_INLINES #endif -#define _GNU_SOURCE 1 #include #include #include diff --git a/remake.c b/remake.c index 343a05e4..d7d7102c 100644 --- a/remake.c +++ b/remake.c @@ -1155,7 +1155,7 @@ f_mtime (file, search) FILE_TIMESTAMP adjusted_mtime = mtime; -#if defined WINDOWS32 || defined _MSDOS__ +#if defined(WINDOWS32) || defined(__MSDOS__) FILE_TIMESTAMP adjustment; #ifdef WINDOWS32 /* FAT filesystems round time to the nearest even second! diff --git a/tests/ChangeLog b/tests/ChangeLog index d621d01e..9c8e7fbd 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,19 @@ +2000-06-19 Paul D. Smith + + * scripts/functions/addsuffix: Test for an empty final argument. + Actually this bug might have happened for any function, but this + one was handy. + +2000-06-17 Eli Zaretskii + + * scripts/options/general: If parallel jobs are not supported, + expect a warning message from Make. + +2000-06-15 Eli Zaretskii + + * scripts/options/general: Don't try -jN with N != 1 if parallel + jobs are not supported. + 2000-05-24 Paul D. Smith * scripts/options/general: Test general option processing (PR/1716). diff --git a/tests/scripts/functions/addsuffix b/tests/scripts/functions/addsuffix index d150f078..da4fbb71 100644 --- a/tests/scripts/functions/addsuffix +++ b/tests/scripts/functions/addsuffix @@ -1,44 +1,36 @@ -$description = "The following test creates a makefile to test the addsuffix " - ."function."; +# -*-perl-*- +$description = "Test the addsuffix function."; $details = ""; -# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET -# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF -# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END. -# EXAMPLE: $makefile2 = &get_tmpfile; - open(MAKEFILE,"> $makefile"); # The Contents of the MAKEFILE ... -print MAKEFILE "string := \$(addsuffix .c,src${pathsep}a.b.z.foo hacks) \n" - ."all: \n" - ."\t\@echo \$(string) \n"; +print MAKEFILE < $makefile"); # The Contents of the MAKEFILE ... -print MAKEFILE "foo 5foo: ; \@echo \$\@\n"; +print MAKEFILE "foo 1foo: ; \@echo \$\@\n"; close(MAKEFILE); # TEST 0 -&run_make_with_options($makefile, "-j 5foo", &get_logfile); -$answer = "5foo\n"; -&compare_output($answer, &get_logfile(1)); +&run_make_with_options($makefile, "-j 1foo", &get_logfile); +if (!$parallel_jobs) { + $answer = "$make_name: Parallel jobs (-j) are not supported on this platform.\n$make_name: Resetting to single job (-j1) mode.\n1foo\n"; +} +else { + $answer = "1foo\n"; +} -# TEST 0 +# TEST 1 # This test prints the usage string; I don't really know a good way to # test it. I guess I could invoke make with a known-bad option to see @@ -24,7 +28,7 @@ $answer = "5foo\n"; # If I were always on UNIX, I could invoke it with 2>/dev/null, then # just check the error code. -&run_make_with_options($makefile, "-j5foo 2>/dev/null", &get_logfile, 512); +&run_make_with_options($makefile, "-j1foo 2>/dev/null", &get_logfile, 512); $answer = ""; &compare_output($answer, &get_logfile(1));