diff options
author | Paul Smith <psmith@gnu.org> | 2002-07-08 13:05:02 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2002-07-08 13:05:02 +0000 |
commit | 724925be2b9a48f7911ee6baa315b872bd86995c (patch) | |
tree | cc19b7c671850891cdc4ebde9d33dd897de3a1d2 | |
parent | 2f20fc1cc71e0b59e2cd859e927fea6115a30f76 (diff) | |
download | gunmake-724925be2b9a48f7911ee6baa315b872bd86995c.tar.gz |
Various cleanups reported by people using the alpha release.
Incorporate "order-only" prerequisites patch. Wrote a test for it.
The test shows what might be a bug in the code; I need to look at it
more closely (anyway it doesn't behave as I expected). Also I haven't
done the docs yet.
-rw-r--r-- | ChangeLog | 36 | ||||
-rw-r--r-- | Makefile.DOS.template | 84 | ||||
-rw-r--r-- | README.cvs | 22 | ||||
-rw-r--r-- | commands.c | 111 | ||||
-rw-r--r-- | config.h.W32.template | 3 | ||||
-rw-r--r-- | configh.dos.template | 149 | ||||
-rw-r--r-- | dep.h | 3 | ||||
-rw-r--r-- | dosbuild.bat | 84 | ||||
-rw-r--r-- | implicit.c | 3 | ||||
-rw-r--r-- | main.c | 61 | ||||
-rw-r--r-- | maintMakefile | 32 | ||||
-rw-r--r-- | po/LINGUAS | 2 | ||||
-rw-r--r-- | read.c | 33 | ||||
-rw-r--r-- | remake.c | 40 | ||||
-rw-r--r-- | rule.c | 1 | ||||
-rw-r--r-- | tests/scripts/features/order_only | 79 |
16 files changed, 514 insertions, 229 deletions
@@ -1,5 +1,17 @@ +2002-07-08 Paul D. Smith <psmith@gnu.org> + + * maintMakefile: Add "update" targets for wget'ing the latest + versions of various external files. Taken from Makefile.maint in + autoconf, etc. + + * dosbuild.bat: Somehow we got _extra_ ^M's. Remove them. + Reported by Eli Zaretskii <eliz@is.elta.co.il>. + 2002-07-07 Paul D. Smith <psmith@gnu.org> + * po/*.po: Remove. We'll use wget to retrieve them at release + time. + * variable.c (do_variable_definition) [W32]: On W32 using cmd rather than a shell you get an exception. Make sure we look up the variable. Patch provided by Eli Zaretskii <eliz@is.elta.co.il>. @@ -53,6 +65,23 @@ want to define our variables from evaluated makefile code in the global scope. +2002-07-03 Greg McGary <greg@mcgary.org> + + * dep.h (struct dep) [ignore_mtime]: New member. + [changed]: convert to a bitfield. + * implicit.c (pattern_search): Zero ignore_mtime. + * main.c (main, handle_non_switch_argument): Likewise. + * rule.c (convert_suffix_rule): Likewise. + * read.c (read_all_makefiles, read_makefile, multi_glob): Likewise. + (read_makefile): Parse '|' in prerequisite list. + (uniquize_deps): Consider ignore_mtime when comparing deps. + * remake.c (update_file_1, check_dep): Don't force remake for + dependencies that have d->ignore_mtime. + * commands.c (FILE_LIST_SEPARATOR): New constant. + (set_file_variables): Don't include a + prerequisite in $+, $^ or $? if d->ignore_mtime. + Define $|. + 2002-06-18 Paul D. Smith <psmith@gnu.org> * make.texinfo: Updates for next revision. New date/rev/etc. @@ -83,6 +112,13 @@ MAKEFILE_LIST. (read_makefile): Add each makefile read in to this variable value. +2002-05-18 Eli Zaretskii <eliz@is.elta.co.il> + + * Makefile.DOS.template: Tweak according to changes in the + distribution. Add back the dependencies of *.o files. + + * configh.dos.template: Synchronize with config.h.in. + 2002-05-09 Paul D. Smith <psmith@gnu.org> * file.c (file_timestamp_now): Use K&R function declaration. diff --git a/Makefile.DOS.template b/Makefile.DOS.template index 8819f1b..2f9eff5 100644 --- a/Makefile.DOS.template +++ b/Makefile.DOS.template @@ -1,7 +1,7 @@ # -*-Makefile-*- template for DJGPP # Makefile.in generated automatically by automake 1.2 from Makefile.am -# Copyright (C) 1994, 1995-1998, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-1998, 1999, 2002 Free Software Foundation, Inc. # This Makefile.DOS is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. @@ -47,7 +47,11 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +EXEEXT = .exe +OBJEXT = o + AR = ar +AWK = gawk CC = gcc CPP = gcc -E LIBOBJS = @@ -60,7 +64,7 @@ VERSION = %VERSION% AUTOMAKE_OPTIONS = 1.2 -bin_PROGRAMS = %PROGRAMS% +bin_PROGRAMS = %PROGRAMS%$(EXEEXT) make_SOURCES = %SOURCES% # This should include the glob/ prefix @@ -99,7 +103,7 @@ CFLAGS = -O2 -g COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ TEXI2DVI = texi2dvi -TEXINFO_TEX = $(srcdir)/texinfo.tex +TEXINFO_TEX = $(srcdir)/config/texinfo.tex INFO_DEPS = make.info DVIS = make.dvi TEXINFOS = make.texinfo @@ -107,8 +111,7 @@ man1dir = $(mandir)/man1 MANS = $(man_MANS) 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 gettext.c install-sh missing mkinstalldirs stamp-h.in texinfo.tex - +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) @@ -121,7 +124,7 @@ HEADERS = $(wildcard $(srcdir)/*.h) default: all .SUFFIXES: -.SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi +.SUFFIXES: .c .dvi .info .o .obj .ps .texinfo .tex mostlyclean-hdr: @@ -153,17 +156,11 @@ uninstall-binPROGRAMS: .c.o: $(COMPILE) -c $< -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) mostlyclean-compile: - -rm -f *.o *.exe make.new core + -rm -f *.$(OBJEXT) *$(EXEEXT) make.new core clean-compile: @@ -172,7 +169,7 @@ distclean-compile: maintainer-clean-compile: -make: $(make_OBJECTS) $(make_DEPENDENCIES) +make$(EXEEXT): $(make_OBJECTS) $(make_DEPENDENCIES) @command.com /c if exist make del make @command.com /c if exist make.exe del make.exe $(LINK) $(make_LDFLAGS) $(make_OBJECTS) $(make_LDADD) $(LIBS) @@ -183,29 +180,19 @@ make.dvi: make.texinfo DVIPS = dvips -.texi.info: - $(MAKEINFO) $(srcdir)/$< -o ./$@ - -.texi.dvi: - TEXINPUTS="$(srcdir);$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< - -.texi: - $(MAKEINFO) $(srcdir)/$< -o ./$@ - .texinfo.info: - $(MAKEINFO) $(srcdir)/$< -o ./$@ + @command.com /c if exist make.info* del make.info* + @command.com /c if exist make.i* del make.i* + $(MAKEINFO) -I$(srcdir) $< -o ./$@ .texinfo: - $(MAKEINFO) $(srcdir)/$< -o ./$@ + @command.com /c if exist make.info* del make.info* + @command.com /c if exist make.i* del make.i* + $(MAKEINFO) -I$(srcdir) $< -o ./$@ .texinfo.dvi: TEXINPUTS="$(srcdir);$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< -.txi.info: - $(MAKEINFO) $(srcdir)/$< -o ./$@ - -.txi.dvi: - TEXINPUTS="$(srcdir);$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< .dvi.ps: $(DVIPS) $< -o $@ @@ -542,3 +529,40 @@ check-regression: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: + +# --------------- DEPENDENCIES +ar.o: ar.c make.h config.h gettext.h filedef.h dep.h glob/fnmatch.h +arscan.o: arscan.c make.h config.h gettext.h +commands.o: commands.c make.h config.h gettext.h dep.h filedef.h \ + variable.h job.h commands.h +default.o: default.c make.h config.h gettext.h rule.h dep.h filedef.h \ + job.h commands.h variable.h +dir.o: dir.c make.h config.h gettext.h glob/glob.h +expand.o: expand.c make.h config.h gettext.h filedef.h job.h commands.h \ + variable.h rule.h +file.o: file.c make.h config.h gettext.h dep.h filedef.h job.h \ + commands.h variable.h debug.h +function.o: function.c make.h config.h gettext.h filedef.h variable.h \ + dep.h job.h commands.h debug.h +getopt.o: getopt.c config.h gettext.h getopt.h +getopt1.o: getopt1.c config.h getopt.h +implicit.o: implicit.c make.h config.h gettext.h rule.h dep.h filedef.h \ + debug.h +job.o: job.c make.h config.h gettext.h job.h debug.h filedef.h \ + commands.h variable.h +main.o: main.c make.h config.h gettext.h dep.h filedef.h variable.h \ + job.h commands.h rule.h debug.h getopt.h +misc.o: misc.c make.h config.h gettext.h dep.h debug.h +read.o: read.c make.h config.h gettext.h glob/glob.h dep.h filedef.h \ + job.h commands.h variable.h rule.h debug.h +remake.o: remake.c make.h config.h gettext.h filedef.h job.h commands.h \ + dep.h variable.h debug.h +remote-stub.o: remote-stub.c make.h config.h gettext.h filedef.h job.h \ + commands.h +rule.o: rule.c make.h config.h gettext.h dep.h filedef.h job.h \ + commands.h variable.h rule.h +signame.o: signame.c make.h config.h gettext.h +variable.o: variable.c make.h config.h gettext.h dep.h filedef.h job.h \ + commands.h variable.h rule.h +version.o: version.c config.h +vpath.o: vpath.c make.h config.h gettext.h filedef.h variable.h @@ -25,13 +25,11 @@ Building From CVS To build GNU make from CVS, you will need Autoconf 2.53 (or better), Automake 1.6.1 (or better), and Gettext 0.11.3-pre2 (or better), and any -tools that those utilities require (GNU m4, Perl, etc.). +tools that those utilities require (GNU m4, Perl, etc.). You will also +need a copy of wget. After checking out the code, you will need to perform these steps to get -to the point where you can run "configure" then "make". - -Hopefully at some point in the (near) future this will all be obsolete -and you can just run "autoreconf" and have it DTRT. +to the point where you can run "make". 1) $ autopoint @@ -70,12 +68,23 @@ and you can just run "autoreconf" and have it DTRT. Generate a "configure" script from configure.in and acinclude.m4. + 6) $ ./configure + + Generate a Makefile + + + 7) $ make update + + Use wget to retrieve various other files that GNU make relies on, + but does not keep in its own source tree. + + At this point you have successfully brought your CVS copy of the GNU make source directory up to the point where it can be treated more-or-less like the official package you would get from ftp.gnu.org. That is, you can just run: - $ ./configure && make && make check && make install + $ make && make check && make install to build and install GNU make. @@ -127,6 +136,7 @@ autoheader automake --add-missing autoconf ./configure +make update make make check make distcheck @@ -24,6 +24,12 @@ Boston, MA 02111-1307, USA. */ #include "job.h" #include "commands.h" +#if VMS +# define FILE_LIST_SEPARATOR ',' +#else +# define FILE_LIST_SEPARATOR ' ' +#endif + extern int remote_kill PARAMS ((int id, int sig)); #ifndef HAVE_UNISTD_H @@ -36,7 +42,6 @@ static void set_file_variables (file) register struct file *file; { - register char *p; char *at, *percent, *star, *less; #ifndef NO_ARCHIVES @@ -46,6 +51,8 @@ set_file_variables (file) if (ar_name (file->name)) { unsigned int len; + char *p; + p = strchr (file->name, '('); at = (char *) alloca (p - file->name + 1); bcopy (file->name, at, p - file->name); @@ -120,12 +127,14 @@ set_file_variables (file) /* Compute the values for $^, $+, and $?. */ { - register unsigned int qmark_len, plus_len; + unsigned int qmark_len, plus_len, bar_len; char *caret_value, *plus_value; - register char *cp; + char *cp; char *qmark_value; - register char *qp; - register struct dep *d; + char *bar_value; + char *qp; + char *bp; + struct dep *d; unsigned int len; /* Compute first the value for $+, which is supposed to contain @@ -133,36 +142,35 @@ set_file_variables (file) plus_len = 0; for (d = file->deps; d != 0; d = d->next) - plus_len += strlen (dep_name (d)) + 1; + if (! d->ignore_mtime) + plus_len += strlen (dep_name (d)) + 1; + if (plus_len == 0) + plus_len++; - len = plus_len == 0 ? 1 : plus_len; - cp = plus_value = (char *) alloca (len); + cp = plus_value = (char *) alloca (plus_len); qmark_len = plus_len; /* Will be this or less. */ for (d = file->deps; d != 0; d = d->next) - { - char *c = dep_name (d); + if (! d->ignore_mtime) + { + char *c = dep_name (d); #ifndef NO_ARCHIVES - if (ar_name (c)) - { - c = strchr (c, '(') + 1; - len = strlen (c) - 1; - } - else + if (ar_name (c)) + { + c = strchr (c, '(') + 1; + len = strlen (c) - 1; + } + else #endif - len = strlen (c); + len = strlen (c); - bcopy (c, cp, len); - cp += len; -#if VMS - *cp++ = ','; -#else - *cp++ = ' '; -#endif - if (! d->changed) - qmark_len -= len + 1; /* Don't space in $? for this one. */ - } + bcopy (c, cp, len); + cp += len; + *cp++ = FILE_LIST_SEPARATOR; + if (! d->changed) + qmark_len -= len + 1; /* Don't space in $? for this one. */ + } /* Kill the last space and define the variable. */ @@ -175,11 +183,18 @@ set_file_variables (file) uniquize_deps (file->deps); - /* Compute the values for $^ and $?. */ + bar_len = 0; + for (d = file->deps; d != 0; d = d->next) + if (d->ignore_mtime) + bar_len += strlen (dep_name (d)) + 1; + if (bar_len == 0) + bar_len++; + + /* Compute the values for $^, $?, and $|. */ cp = caret_value = plus_value; /* Reuse the buffer; it's big enough. */ - len = qmark_len == 0 ? 1 : qmark_len; - qp = qmark_value = (char *) alloca (len); + qp = qmark_value = (char *) alloca (qmark_len); + bp = bar_value = (char *) alloca (bar_len); for (d = file->deps; d != 0; d = d->next) { @@ -195,23 +210,24 @@ set_file_variables (file) #endif len = strlen (c); - bcopy (c, cp, len); - cp += len; -#if VMS - *cp++ = ','; -#else - *cp++ = ' '; -#endif - if (d->changed) - { - bcopy (c, qp, len); - qp += len; -#if VMS - *qp++ = ','; -#else - *qp++ = ' '; -#endif + if (d->ignore_mtime) + { + bcopy (c, bp, len); + bp += len; + *bp++ = FILE_LIST_SEPARATOR; } + else + { + bcopy (c, cp, len); + cp += len; + *cp++ = FILE_LIST_SEPARATOR; + if (d->changed) + { + bcopy (c, qp, len); + qp += len; + *qp++ = FILE_LIST_SEPARATOR; + } + } } /* Kill the last spaces and define the variables. */ @@ -221,6 +237,9 @@ set_file_variables (file) qp[qp > qmark_value ? -1 : 0] = '\0'; DEFINE_VARIABLE ("?", 1, qmark_value); + + bp[bp > bar_value ? -1 : 0] = '\0'; + DEFINE_VARIABLE ("|", 1, bar_value); } #undef DEFINE_VARIABLE diff --git a/config.h.W32.template b/config.h.W32.template index 4335776..148b217 100644 --- a/config.h.W32.template +++ b/config.h.W32.template @@ -351,6 +351,9 @@ /* Define if you have the sun library (-lsun). */ /* #undef HAVE_LIBSUN */ +/* Use high resolution file timestamps if nonzero. */ +#define FILE_TIMESTAMP_HI_RES 0 + /* Build host information. */ #define MAKE_HOST "Windows32" diff --git a/configh.dos.template b/configh.dos.template index ba7485b..8fe16fe 100644 --- a/configh.dos.template +++ b/configh.dos.template @@ -1,58 +1,91 @@ -
-/* Many things are defined already by a system header. */
-#include <sys/config.h>
-
-/* Name of this package (needed by automake) */
-#define PACKAGE "%PACKAGE%"
-
-/* Version of this package (needed by automake) */
-#define VERSION "%VERSION%"
-
-#if __DJGPP__ > 2 || __DJGPP_MINOR__ > 1
-
-/* Define if `sys_siglist' is declared by <signal.h>. */
-# define SYS_SIGLIST_DECLARED 1
-
-/* Define this if the C library defines the variable `_sys_siglist'. */
-# define HAVE_SYS_SIGLIST 1
-
-#else
-
-/* Define NSIG. */
-# define NSIG SIGMAX
-
-#endif
-
-/* Define if you have the fdopen function. */
-#define HAVE_FDOPEN 1
-
-/* Define if you have sigsetmask. */
-#define HAVE_SIGSETMASK 1
-
-/* Define if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* 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'
- if <inttypes.h> doesn't define. */
-#define uintmax_t unsigned long long
-
-/* Define the type of the first arg to select(). */
-#define fd_set_size_t int
-
-/* Define if you have the select function. */
-#define HAVE_SELECT 1
-
-/* Define if you have the vprintf library function. */
-#undef HAVE_VPRINTF
-#define HAVE_VPRINTF 1
-
-/* Build host information. */
-#define MAKE_HOST "i386-pc-msdosdjgpp"
+ +/* Many things are defined already by a system header. */ +#include <sys/config.h> + +#if __DJGPP__ > 2 || __DJGPP_MINOR__ > 1 + +/* Define if `sys_siglist' is declared by <signal.h>. */ +# define SYS_SIGLIST_DECLARED 1 + +/* Define this if the C library defines the variable `_sys_siglist'. */ +# define HAVE_SYS_SIGLIST 1 + +#else + +/* Define NSIG. */ +# define NSIG SIGMAX + +#endif + +/* Use high resolution file timestamps if nonzero. */ +#define FILE_TIMESTAMP_HI_RES 0 + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define if you have the fdopen function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `getgroups' function. */ +#define HAVE_GETGROUPS 1 + +/* Define if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define if you have the mkstemp function. */ +#define HAVE_MKSTEMP 1 + +/* Define to 1 if you have the `mktemp' function. */ +#define HAVE_MKTEMP 1 + +/* Define to 1 if you have the `setlinebuf' function. */ +#define HAVE_SETLINEBUF 1 + +/* Define to 1 if you have the `setvbuf' function. */ +#define HAVE_SETVBUF 1 + +#define SCCS_GET "get" + +/* Define to `unsigned long' or `unsigned long long' + if <inttypes.h> doesn't define. */ +#define uintmax_t unsigned long long + +/* Define the type of the first arg to select(). */ +#define fd_set_size_t int + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the vprintf library function. */ +#undef HAVE_VPRINTF +#define HAVE_VPRINTF 1 + +/* Name of the package */ +#define PACKAGE "%PACKAGE%" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "bug-%PACKAGE%@gnu.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "GNU %PACKAGE%" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "GNU %PACKAGE% %VERSION%" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "%PACKAGE%" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "%VERSION%" + +/* Define to 1 if the C compiler supports function prototypes. */ +#define PROTOTYPES 1 + +/* Define to 1 if `sys_siglist' is declared by <signal.h> or <unistd.h>. */ +#define SYS_SIGLIST_DECLARED 1 + +/* Version number of package */ +#define VERSION "%VERSION%" + +/* Build host information. */ +#define MAKE_HOST "i386-pc-msdosdjgpp" @@ -38,7 +38,8 @@ struct dep struct dep *next; char *name; struct file *file; - int changed; + unsigned int changed : 8; + unsigned int ignore_mtime : 1; }; diff --git a/dosbuild.bat b/dosbuild.bat index 34ca4b4..ac1e6cd 100644 --- a/dosbuild.bat +++ b/dosbuild.bat @@ -1,42 +1,42 @@ -@echo Building Make for MSDOS
-@rem Echo ON so they will see what is going on.
-@echo on
-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 -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
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g function.c -o function.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g vpath.c -o vpath.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g version.c -o version.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g ar.c -o ar.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g arscan.c -o arscan.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g signame.c -o signame.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g remote-stub.c -o remote-stub.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt.c -o getopt.o
-gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt1.c -o getopt1.o
-@cd glob
-@if exist libglob.a del libglob.a
-gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g glob.c -o glob.o
-gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g fnmatch.c -o fnmatch.o
-ar rv libglob.a glob.o fnmatch.o
-@echo off
-cd ..
-echo commands.o > respf.$$$
-for %%f in (job dir file misc main read remake rule implicit default variable) do echo %%f.o >> respf.$$$
-for %%f in (expand function vpath version ar arscan signame remote-stub getopt getopt1) do echo %%f.o >> respf.$$$
-echo glob/libglob.a >> respf.$$$
-@echo Linking...
-@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.$$$
+@echo Building Make for MSDOS
+@rem Echo ON so they will see what is going on.
+@echo on
+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 -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
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g function.c -o function.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g vpath.c -o vpath.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g version.c -o version.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g ar.c -o ar.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g arscan.c -o arscan.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g signame.c -o signame.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g remote-stub.c -o remote-stub.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt.c -o getopt.o
+gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt1.c -o getopt1.o
+@cd glob
+@if exist libglob.a del libglob.a
+gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g glob.c -o glob.o
+gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g fnmatch.c -o fnmatch.o
+ar rv libglob.a glob.o fnmatch.o
+@echo off
+cd ..
+echo commands.o > respf.$$$
+for %%f in (job dir file misc main read remake rule implicit default variable) do echo %%f.o >> respf.$$$
+for %%f in (expand function vpath version ar arscan signame remote-stub getopt getopt1) do echo %%f.o >> respf.$$$
+echo glob/libglob.a >> respf.$$$
+@echo Linking...
+@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.$$$
@@ -546,6 +546,7 @@ pattern_search (file, archive, depth, recursions) } dep = (struct dep *) xmalloc (sizeof (struct dep)); + dep->ignore_mtime = 0; s = found_files[deps_found]; if (recursions == 0) { @@ -611,6 +612,8 @@ pattern_search (file, archive, depth, recursions) if (i != matches[foundrule]) { struct dep *new = (struct dep *) xmalloc (sizeof (struct dep)); + /* GKM FIMXE: handle '|' here too */ + new->ignore_mtime = 0; new->name = p = (char *) xmalloc (rule->lens[i] + fullstemlen + 1); bcopy (rule->targets[i], p, rule->suffixes[i] - rule->targets[i] - 1); @@ -905,20 +905,6 @@ int main (int argc, char ** argv) /* Make sure stdout is line-buffered. */ #ifdef HAVE_SETVBUF -# ifndef SETVBUF_REVERSED - setvbuf (stdout, _IOLBF, xmalloc (BUFSIZ), BUFSIZ); -_WAIT_NOHANG -# if defined SIGCHLD - (void) bsd_signal (SIGCHLD, SIG_DFL); -# endif -# if defined SIGCLD && SIGCLD != SIGCHLD - (void) bsd_signal (SIGCLD, SIG_DFL); -# endif -#endif - - /* Make sure stdout is line-buffered. */ - -#ifdef HAVE_SETVBUF # ifdef SETVBUF_REVERSED setvbuf (stdout, _IOLBF, xmalloc (BUFSIZ), BUFSIZ); # else /* setvbuf not reversed. */ @@ -1899,6 +1885,7 @@ _WAIT_NOHANG goals = (struct dep *) xmalloc (sizeof (struct dep)); goals->next = 0; goals->name = 0; + goals->ignore_mtime = 0; goals->file = default_goal_file; } } @@ -2056,6 +2043,7 @@ handle_non_switch_argument (arg, env) } lastgoal->name = 0; lastgoal->file = f; + lastgoal->ignore_mtime = 0; { /* Add this target name to the MAKECMDGOALS variable. */ @@ -2180,9 +2168,11 @@ print_usage (bad) buf, gettext (cs->description)); } - fprintf (usageto, _("\nBuilt for %s"), make_host); - if (remote_description != 0 && *remote_description != '\0') - fprintf (usageto, " (%s)", remote_description); + if (!remote_description || *remote_description == '\0') + fprintf (usageto, _("\nBuilt for %s"), make_host); + else + fprintf (usageto, "\nBuilt for %s (%s)", make_host, remote_description); + fprintf (usageto, _("\nReport bugs to <bug-make@gnu.org>\n")); } @@ -2828,21 +2818,34 @@ log_working_directory (entering) if (print_data_base_flag) fputs ("# ", stdout); - if (makelevel == 0) - printf ("%s: ", program); - else - printf ("%s[%u]: ", program, makelevel); - /* Use entire sentences to give the translators a fighting chance. */ - if (starting_directory == 0) - if (entering) - puts (_("Entering an unknown directory")); + if (makelevel == 0) + if (starting_directory == 0) + if (entering) + printf (_("%s: Entering an unknown directory"), program); + else + printf (_("%s: Leaving an unknown directory"), program); else - puts (_("Leaving an unknown directory")); + if (entering) + printf (_("%s: Entering directory `%s'\n"), + program, starting_directory); + else + printf (_("%s: Leaving directory `%s'\n"), + program, starting_directory); else - if (entering) - printf (_("Entering directory `%s'\n"), starting_directory); + if (starting_directory == 0) + if (entering) + printf (_("%s[%u]: Entering an unknown directory"), + program, makelevel); + else + printf (_("%s[%u]: Leaving an unknown directory"), + program, makelevel); else - printf (_("Leaving directory `%s'\n"), starting_directory); + if (entering) + printf (_("%s[%u]: Entering directory `%s'\n"), + program, makelevel, starting_directory); + else + printf (_("%s[%u]: Leaving directory `%s'\n"), + program, makelevel, starting_directory); } diff --git a/maintMakefile b/maintMakefile index a499972..1910674 100644 --- a/maintMakefile +++ b/maintMakefile @@ -189,4 +189,34 @@ cvs-update: $(cvs-targets) # --------------------- # .PHONY: update -update: wget-update cvs-update po-update +update: wget-update po-update + +# cvs-update + + +## --------------- ## +## Sanity checks. ## +## --------------- ## + +# Checks that don't require cvs. Run `changelog-check' last as +# previous test may reveal problems requiring new ChangeLog entries. +local-check: po-check changelog-check + +# copyright-check writable-files + +changelog-check: + if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ + :; \ + else \ + echo "$(VERSION) not in ChangeLog" 1>&2; \ + exit 1; \ + fi + +# Verify that all source files using _() are listed in po/POTFILES.in. +po-check: + if test -f po/POTFILES.in; then \ + grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \ + grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \ + diff -u $@-1 $@-2 || exit 1; \ + rm -f $@-1 $@-2; \ + fi @@ -1,4 +1,4 @@ -# Set of available languages. +# Set of available languages: 14 languages da de es fr gl he hr ja ko nl pl pt_BR ru tr @@ -251,6 +251,7 @@ read_all_makefiles (makefiles) d->name = 0; d->file = enter_file (*p); d->file->dontcare = 1; + d->ignore_mtime = 0; /* Tell update_goal_chain to bail out as soon as this file is made, and main not to die if we can't make this file. */ d->changed = RM_DONTCARE; @@ -347,6 +348,7 @@ eval_makefile (filename, flags) free (filename); filename = deps->file->name; deps->changed = flags; + deps->ignore_mtime = 0; /* If the makefile can't be found at all, give up entirely. */ @@ -1117,8 +1119,24 @@ eval (ebuf, set_default) /* Parse the dependencies. */ deps = (struct dep *) - multi_glob (parse_file_seq (&p2, '\0', sizeof (struct dep), 1), + multi_glob (parse_file_seq (&p2, '|', sizeof (struct dep), 1), sizeof (struct dep)); + if (*p2) + { + /* Files that follow '|' are special prerequisites that + need only exist in order to satisfy the dependency. + Their modification times are irrelevant. */ + struct dep **deps_ptr = &deps; + struct dep *d; + for (deps_ptr = &deps; *deps_ptr; deps_ptr = &(*deps_ptr)->next) + ; + ++p2; + *deps_ptr = (struct dep *) + multi_glob (parse_file_seq (&p2, '\0', sizeof (struct dep), 1), + sizeof (struct dep)); + for (d = *deps_ptr; d != 0; d = d->next) + d->ignore_mtime = 1; + } commands_idx = 0; if (cmdleft != 0) @@ -1506,7 +1524,8 @@ uniquize_deps (chain) last = d; next = d->next; while (next != 0) - if (streq (dep_name (d), dep_name (next))) + if (streq (dep_name (d), dep_name (next)) + && d->ignore_mtime == next->ignore_mtime) { struct dep *n = next->next; last->next = n; @@ -2825,10 +2844,13 @@ multi_glob (chain, size) if (found == 0) { /* No matches. Use MEMNAME as-is. */ - struct nameseq *elt - = (struct nameseq *) xmalloc (size); unsigned int alen = strlen (gl.gl_pathv[i]); unsigned int mlen = strlen (memname); + struct nameseq *elt + = (struct nameseq *) xmalloc (size); + if (size > sizeof (struct nameseq)) + bzero (((char *) elt) + sizeof (struct nameseq), + size - sizeof (struct nameseq)); elt->name = (char *) xmalloc (alen + 1 + mlen + 2); bcopy (gl.gl_pathv[i], elt->name, alen); elt->name[alen] = '('; @@ -2857,6 +2879,9 @@ multi_glob (chain, size) #endif /* !NO_ARCHIVES */ { struct nameseq *elt = (struct nameseq *) xmalloc (size); + if (size > sizeof (struct nameseq)) + bzero (((char *) elt) + sizeof (struct nameseq), + size - sizeof (struct nameseq)); elt->name = xstrdup (gl.gl_pathv[i]); elt->next = new; new = elt; @@ -349,6 +349,7 @@ update_file_1 (file, depth) int dep_status = 0; register struct dep *d, *lastd; int running = 0; + int maybe_make; DBF (DB_VERBOSE, _("Considering target file `%s'.\n")); @@ -457,7 +458,11 @@ update_file_1 (file, depth) } d->file->parent = file; - dep_status |= check_dep (d->file, depth, this_mtime, &must_make); + maybe_make = must_make; + dep_status |= check_dep (d->file, depth, this_mtime, &maybe_make); + if (! d->ignore_mtime) + must_make = maybe_make; + check_renamed (d->file); { @@ -570,17 +575,21 @@ update_file_1 (file, depth) FILE_TIMESTAMP d_mtime = file_mtime (d->file); check_renamed (d->file); -#if 1 /* %%% In version 4, remove this code completely to + if (! d->ignore_mtime) + { +#if 1 + /* %%% In version 4, remove this code completely to implement not remaking deps if their deps are newer than their parents. */ - if (d_mtime == NONEXISTENT_MTIME && !d->file->intermediate) - /* We must remake if this dep does not - exist and is not intermediate. */ - must_make = 1; + if (d_mtime == NONEXISTENT_MTIME && !d->file->intermediate) + /* We must remake if this dep does not + exist and is not intermediate. */ + must_make = 1; #endif - /* Set DEPS_CHANGED if this dep actually changed. */ - deps_changed |= d->changed; + /* Set DEPS_CHANGED if this dep actually changed. */ + deps_changed |= d->changed; + } /* Set D->changed if either this dep actually changed, or its dependent, FILE, is older or does not exist. */ @@ -590,7 +599,12 @@ update_file_1 (file, depth) { const char *fmt = 0; - if (d_mtime == NONEXISTENT_MTIME) + if (d->ignore_mtime) + { + if (ISDB (DB_VERBOSE)) + fmt = _("Prerequisite `%s' is order-only for target `%s'.\n"); + } + else if (d_mtime == NONEXISTENT_MTIME) { if (ISDB (DB_BASIC)) fmt = _("Prerequisite `%s' of target `%s' does not exist.\n"); @@ -822,8 +836,9 @@ check_dep (file, depth, this_mtime, must_make_ptr) FILE_TIMESTAMP this_mtime; int *must_make_ptr; { - register struct dep *d; + struct dep *d; int dep_status = 0; + int maybe_make; ++depth; start_updating (file); @@ -898,8 +913,11 @@ check_dep (file, depth, this_mtime, must_make_ptr) } d->file->parent = file; + maybe_make = *must_make_ptr; dep_status |= check_dep (d->file, depth, this_mtime, - must_make_ptr); + &maybe_make); + if (! d->ignore_mtime) + *must_make_ptr = maybe_make; check_renamed (d->file); if (dep_status != 0 && !keep_going_flag) break; @@ -230,6 +230,7 @@ convert_suffix_rule (target, source, cmds) deps = (struct dep *) xmalloc (sizeof (struct dep)); deps->next = 0; deps->name = depname; + deps->ignore_mtime = 0; } create_pattern_rule (names, percents, 0, deps, cmds, 0); diff --git a/tests/scripts/features/order_only b/tests/scripts/features/order_only new file mode 100644 index 0000000..81284c5 --- /dev/null +++ b/tests/scripts/features/order_only @@ -0,0 +1,79 @@ +# -*-perl-*- +$description = "Test order-only prerequisites."; + +$details = "\ +Create makefiles with various combinations of normal and order-only +prerequisites and ensure they behave properly. Test the \$| variable."; + +open(MAKEFILE,"> $makefile"); + +print MAKEFILE <<'EOF'; +foo: bar | baz + @echo '$$^ = $^' + @echo '$$? = $?' + @echo '$$| = $|' + touch $@ + +.PHONY: baz + +bar baz: + touch $@ +EOF + +close(MAKEFILE); + + +# TEST #1 -- just the syntax + +&run_make_with_options($makefile, "", &get_logfile); +$answer = "touch bar\ntouch baz\n\$^ = bar\n\$? = bar\n\$| = baz\ntouch foo\n"; +&compare_output($answer,&get_logfile(1)); + + +# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated + +&run_make_with_options($makefile, "", &get_logfile); +$answer = "touch baz\n"; +&compare_output($answer,&get_logfile(1)); + +unlink(qw(foo bar baz)); + +# Test prereqs that are both order and non-order + +$makefile2 = &get_tmpfile; + +open(MAKEFILE,"> $makefile2"); + +print MAKEFILE <<'EOF'; +foo: bar | baz + @echo '$$^ = $^' + @echo '$$? = $?' + @echo '$$| = $|' + touch $@ + +foo: baz + +.PHONY: baz + +bar baz: + touch $@ +EOF + +close(MAKEFILE); + +# TEST #3 -- just the syntax + +&run_make_with_options($makefile2, "", &get_logfile); +$answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$? = bar baz\n\$| = baz\ntouch foo\n"; +&compare_output($answer,&get_logfile(1)); + + +# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated + +&run_make_with_options($makefile2, "", &get_logfile); +$answer = "touch baz\$^ = bar baz\n\$? = baz\n\$| = baz\ntouch foo\n"; +&compare_output($answer,&get_logfile(1)); + +unlink(qw(foo bar baz)); + +1; |