diff options
-rw-r--r-- | AUTHORS | 46 | ||||
-rw-r--r-- | ChangeLog | 69 | ||||
-rw-r--r-- | GNUmakefile | 306 | ||||
-rw-r--r-- | Makefile.am | 63 | ||||
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | README.DOS.template | 14 | ||||
-rw-r--r-- | README.template | 7 | ||||
-rw-r--r-- | acconfig.h | 6 | ||||
-rw-r--r-- | build.template | 4 | ||||
-rw-r--r-- | configure.in | 13 | ||||
-rw-r--r-- | file.c | 17 | ||||
-rw-r--r-- | filedef.h | 2 | ||||
-rw-r--r-- | function.c | 9 | ||||
-rw-r--r-- | glob/ChangeLog | 21 | ||||
-rw-r--r-- | glob/Makefile.am | 10 | ||||
-rw-r--r-- | glob/configure.in | 5 | ||||
-rw-r--r-- | glob/fnmatch.h | 3 | ||||
-rw-r--r-- | glob/glob.c | 47 | ||||
-rw-r--r-- | glob/glob.h | 23 | ||||
-rw-r--r-- | job.c | 12 | ||||
-rw-r--r-- | main.c | 10 | ||||
-rw-r--r-- | maintMakefile | 33 | ||||
-rw-r--r-- | make.1 | 14 | ||||
-rw-r--r-- | make.h | 3 | ||||
-rw-r--r-- | make.texinfo | 227 | ||||
-rw-r--r-- | read.c | 4 | ||||
-rw-r--r-- | remake.c | 66 | ||||
-rw-r--r-- | variable.c | 2 | ||||
-rw-r--r-- | version.c | 7 | ||||
-rw-r--r-- | vpath.c | 21 |
30 files changed, 628 insertions, 443 deletions
@@ -0,0 +1,46 @@ +----------------------------------- + +GNU make and the GNU Make User's Manual were created by: + Roland McGrath <roland@gnu.ai.mit.edu> + Richard M. Stallman <rms@gnu.ai.mit.edu> + + +Development and maintenance up to GNU make 3.75 by: + Roland McGrath <roland@gnu.ai.mit.edu> + + +Development and maintenance starting with GNU make 3.76 by: + Paul D. Smith <psmith@gnu.ai.mit.edu> + + +----------------------------------- +GNU Make porting efforts: + + Port to VMS by: + Klaus Kaempf (kkaempf@progis.de) + + + Port to Amiga by: + Aaron Digulla <digulla@fh-konstanz.de> + + + Port to MS-DOS (DJGPP) and MS-Windows 95/NT by: + DJ Delorie <dj@delorie.com> + Rob Tulloh <rob_tulloh@tivoli.com> + Eli Zaretskii <eliz@is.elta.co.il> + +----------------------------------- +Other contributors: + + Janet Carson <janet_carson@tivoli.com> + Paul Eggert <eggert@twinsun.com> + Klaus Heinz <kamar@ease.rhein-main.de> + Michael Joosten + Jim Kelton <jim_kelton@tivoli.com> + David Lubbren <uhay@rz.uni-karlsruhe.de> + Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + Carl Staelin (Princeton University) + Ian Stewartson (Data Logic Limited) + +With suggestions/comments/bug reports from a cast of ... well ... +hundreds, anyway :) @@ -1,3 +1,72 @@ +Mon Aug 18 09:41:08 1997 Paul D. Smith <psmith@baynetworks.com> + + * Version 3.75.91 + +Fri Aug 15 13:50:54 1997 Paul D. Smith <psmith@baynetworks.com> + + * read.c (do_define): Remember to count the newline after the endef. + +Thu Aug 14 23:14:37 1997 Paul D. Smith <psmith@baynetworks.com> + + * many: Rewrote builds to use Automake 1.2. + + * AUTHORS: New file. + * maintMakefile: Contains maintainer-only make snippets. + * GNUmakefile: This now only runs the initial auto* tools. + * COPYING,texinfo.tex,mkinstalldirs,install-sh: Removed (obtained + automatically by automake). + * compatMakefile: Removed (not needed anymore). + * README,build.sh.in: Removed (built from templates). + * config.h.in,Makefile.in: Removed (built by tools). + +Wed Aug 13 02:22:08 1997 Paul D. Smith <psmith@baynetworks.com> + + * make.texinfo: Updates for DOS/Windows information (Eli Zaretskii) + * README,README.DOS: Ditto. + + * remake.c (update_file_1,f_mtime): Fix GPATH handling. + * vpath.c (gpath_search): Ditto. + + * file.c (rename_file): New function: rehash, but also rename to + the hashname. + * filedef.h: Declare it. + + * variable.c (merge_variable_set_lists): Remove free() of variable + set; since various files can share variable sets we don't want to + free them here. + +Tue Aug 12 10:51:54 1997 Paul D. Smith <psmith@baynetworks.com> + + * configure.in: Require autoconf 2.12 + + * make.texinfo: Replace all "cd subdir; $(MAKE)" examples with a + more stylistically correct "cd subdir && $(MAKE)". + + * main.c: Global variable `clock_skew_detected' defined. + (main): Print final warning if it's set. + * make.h: Declare it. + * remake.c (f_mtime): Test and set it. + + * job.c (start_job_command): Add special optimizations for + "do-nothing" rules, containing just the shell no-op ":". This is + useful for timestamp files and can make a real difference if you + have a lot of them (requested by Fergus Henderson <fjh@cs.mu.oz.au>). + + * configure.in,Makefile.in: Rewrote to use the new autoconf + program_transform_name macro. + + * function.c (function_strip): Strip newlines as well as spaces + and TABs. + +Fri Jun 6 23:41:04 1997 Rob Tulloh <rob_tulloh@tivoli.com> + + * remake.c (f_mtime): Datestamps on FAT-based files are rounded to + even seconds when stored, so if the date check fails on WINDOWS32 + systems, see if this "off-by-one" error is the problem. + + * General: If your TZ environment variable is not set correctly + then all your timestamps will be off by hours. So, set it! + Mon Apr 7 02:06:22 1997 Paul D. Smith <psmith@baynetworks.com> * Version 3.75.1 diff --git a/GNUmakefile b/GNUmakefile index a4d3b36..272e37b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,299 +1,33 @@ -# GNU Make-specific makefile for GNU Make. - -# Copyright (C) 1990, 91, 92, 93, 94, 95, 96 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 2, or (at your option) -# any later version. +# This is a maintainer's-only makefile # -# GNU Make is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# It bootstraps a GNU make maintainer's directory # -# You should have received a copy of the GNU General Public License -# along with GNU Make; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -.PHONY: default -default: +.SUFFIXES: -# Set `ARCH' to a string for the type of machine. -ifndef ARCH -ifdef machine -ARCH = $(machine) -endif # machine -endif # not ARCH +.DEFAULT: + [ -f Makefile ] || ./configure + $(MAKE) -f Makefile $@ -override srcdir := . -override CC := $(CC) +.PHONY: __cfg __cfg_basic -ifeq ($(ARCH),hp300) -#customs=yes -endif -ifdef customs -override REMOTE := cstms -else -override REMOTE := stub -endif +ACCONFIG = acconfig.h -# Get most of the information from the Unix-compatible makefile. -include compatMakefile +__cfg: __cfg_basic config.h.in + cd glob && $(MAKE) -f ../GNUmakefile __cfg_basic ACCONFIG= -MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES) +__cfg_basic: aclocal.m4 stamp-h.in configure Makefile.in -CVS = cvs +aclocal.m4: configure.in + aclocal -# Remove autoconf magic. -prefix = /usr/local -exec_prefix = $(prefix) -extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o -LOADLIBES := $(filter-out @%@,$(LOADLIBES)) -ALLOCA := $(filter-out @%@,$(ALLOCA)) -CPPFLAGS := $(filter-out @%@,$(defines) $(CPPFLAGS)) -DHAVE_CONFIG_H +config.h.in: stamp-h.in +stamp-h.in: configure.in aclocal.m4 $(ACCONFIG) + autoheader + echo timestamp > $@ -ifdef AC_MACRODIR -configure config.h.in: $(patsubst %,$(AC_MACRODIR)/%.m4,acspecific acgeneral) -config.h.in: $(AC_MACRODIR)/acconfig.h -endif configure: configure.in aclocal.m4 - autoconf $(ACFLAGS) - -test -d CVS && $(CVS) commit -m'autoconf $(ACFLAGS)' $@ -config.h.in: configure.in aclocal.m4 - autoheader $(ACFLAGS) - -test -d CVS && $(CVS) commit -m'autoheader $(ACFLAGS)' $@ - -ifdef customs -defines := $(defines) -Ipmake/customs -Ipmake/lib/include -LOADLIBES := $(addprefix pmake/customs/,customslib.o rpc.o xlog.o) \ - pmake/lib/sprite/libsprite.a -endif - -ifdef ARCH - -ifndef no_libc -libc_dir = /home/gd2/gnu/libc/$(ARCH) -ifneq ($(wildcard $(libc_dir)),) -ifneq ($(wildcard $(libc_dir)/works-for-make),) -#CPPFLAGS := -I$(libc_dir)/include -#LDFLAGS := -nostdlib $(libc_dir)/lib/start.o -#LOADLIBES := $(LOADLIBES) \ -# $(libc_dir)/lib/mcheck-init.o \ -# $(libc_dir)/lib/libc.a \ -# -lgcc \ -# $(libc_dir)/lib/libc.a -CC := $(CC) -b glibc - -# getopt is in libc. -GETOPT = -#GETOPT_SRC = Don't clear this or dist will break. - -# glob is in libc too. -GLOB = - -else - -endif # works-for-make -endif # $(libc_dir) -endif # !no_libc - -# We know the type of machine, so put the binaries in subdirectories. -$(ARCH)/%.o: %.c - $(COMPILE.c) -Iglob $< $(OUTPUT_OPTION) -$(ARCH)/glob/libglob.a: FORCE - $(MAKE) -C $(@D) $(@F) -FORCE: -objs := $(addprefix $(ARCH)/,$(objs)) -prog := $(ARCH)/make - -archpfx = $(ARCH)/ - -$(archpfx)load.o: load.c - $(COMPILE.c) $(LOAD_AVG) $< -o $@ -$(archpfx)load.dep: load.c - $(mkdep) $(LOAD_AVG) $< | sed 's,$*\.o,& $@,' > $@ - -CPPFLAGS := -I$(ARCH) -Iglob -DHAVE_CONFIG_H $(filter-out @%@,$(CPPFLAGS)) - -ifneq "$(wildcard $(ARCH)/makefile)" "" -include $(ARCH)/makefile -endif -objs := $(objs) $(addprefix $(ARCH)/,$(ALLOCA) $(extras)) - -else # Not ARCH -prog := make -endif - -ifneq "$(findstring gcc,$(CC))" "" -CFLAGS = -g -Wall -Wtraditional -Wid-clash-31 -Wpointer-arith \ - -Wbad-function-cast -Wconversion -else -CFLAGS = -g -endif -LDFLAGS = -g - -# Define the command to make dependencies. -mkdep-nolib = $(CC) -MM $(CPPFLAGS) -mkdep = $(CC) -M $(CPPFLAGS) - -depfiles = $(patsubst %.o,%.dep,$(filter %.o,$(objs))) - - -.PHONY: default -default: $(prog) - -$(prog): $(objs) $(globdep) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o) - $(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new - mv -f $@.new $@ - -libc-srcdir = ../libc -globfiles = $(addprefix glob/,COPYING.LIB configure.in configure Makefile.in \ - Makefile.ami SCOPTIONS SMakefile \ - configure.bat glob.c fnmatch.c glob.h fnmatch.h) -$(globfiles): stamp-glob ; -stamp-glob: $(libc-srcdir)/posix/glob.tar - -rm -f stamp-glob glob/* - tar xvf $< glob - $(CVS) commit -m'Updated from libc' glob - touch $@ -$(libc-srcdir)/posix/glob.tar: force - $(MAKE) -C $(@D) $(@F) no_deps=t -.PHONY: force -force: - -# Make the Unix-compatible Makefile to be distributed by appending -# the automatically-generated dependencies to compatMakefile. -ifeq ($(mkdep),$(mkdep-nolib)) -nolib-deps = $(depfiles) -else -%.dep: %.c - $(mkdep-nolib) $< | sed -e 's,$*\.o,$(@:.dep=.o) $@,' > $(@:.dep=.dtm) - mv -f $(@:.dep=.dtm) $@ -nolib-deps = $(patsubst $(archpfx)%,%,$(depfiles)) -endif -# The distributed Makefile.in should contain deps for remote-stub only. -Makefile.in: compatMakefile $(nolib-deps:remote-%.dep=remote-stub.dep) - (sed 's/^MAKE[ ]*=.*$$/@SET_MAKE@/' $<; \ - echo '# Automatically generated dependencies.'; \ - sed -e 's/ [^ ]*\.dep//' -e 's=$(archpfx)==' $(filter-out $<,$^) \ - ) > $@ - $(CVS) commit -mRegenerated $@ - -.SUFFIXES: .dep -# Maintain the automatically-generated dependencies. -ifndef no_deps --include $(depfiles) -endif -$(archpfx)%.dep: %.c - $(mkdep) $< | sed 's,$*\.o,$(@:.dep=.o) $@,' > $@ - -ETAGS = etags -T # for v19 etags - -# Run the tests. -.PHONY: tests -testdir := $(shell ls -d1 make-test-?.? | sort -n +0.10 -0.11 +0.12 | tail -1l) -tests:# $(testdir)/run_make_tests.pl $(prog) -# cd $(<D); MAKELEVEL=0 perl $(<F) - -build.sh.in: build.template compatMakefile - sed -e 's@%objs%@$(filter-out remote-% $(GLOB) $(ALLOCA) $(extras),\ - $(patsubst $(archpfx)%,%,$(objs)))\ - $(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \ - $< > $@.new - chmod a+x $@.new - mv -f $@.new $@ - $(CVS) commit -mRegenerated $@ - -# Make the distribution tar files. - -.PHONY: dist -# Figure out the version number from the source of `version.c'. -version := \ - $(strip $(shell sed -e '/=/!d' -e 's/^.*"\(.*\)";$$/\1/' < version.c)) -tarfiles := make # make-doc -tarfiles := $(addsuffix -$(version).tar,$(tarfiles)) -tarfiles := $(tarfiles:%=%.gz) # no more compress $(tarfiles:%=%.Z) -# Depend on default and doc so we don't ship anything that won't compile. -dist: cvs-mark default info dvi tests tarfiles -.PHONY: tarfiles -tarfiles: $(tarfiles) - -vmsfiles = config.h-vms makefile.com makefile.vms readme.vms \ - vmsdir.h vmsfunctions.c vmsify.c -amigafiles = README.Amiga config.ami Makefile.ami SCOPTIONS SMakefile \ - amiga.c amiga.h make.lnk -dosfiles = README.DOS dosbuild.bat -w32files = README.W32 build_w32.bat config.h.W32 subproc.bat NMakefile \ - $(addprefix w32/,pathstuff.c compat/dirent.c include/dirent.h \ - include/pathstuff.h include/sub_proc.h \ - include/w32err.h subproc/NMakefile \ - subproc/build.bat subproc/misc.c \ - subproc/proc.h subproc/sub_proc.c \ - subproc/w32err.c) -distfiles=README INSTALL COPYING ChangeLog NEWS \ - configure Makefile.in configure.in build.sh.in mkinstalldirs \ - configh.dos configure.bat \ - $(amigafiles) $(vmsfiles) $(w32files) $(dosfiles) \ - aclocal.m4 acconfig.h $(srcs) remote-*.c $(globfiles) \ - make.texinfo make-stds.texi \ - $(wildcard make.?? make.??s make.toc make.aux) make.man texinfo.tex \ - TAGS tags install-sh \ - make.info make.info* - -ifndef dist-flavor -dist-flavor = alpha -endif -.PHONY: cvs-mark -cvs-mark: $(distfiles) - $(CVS) tag -F make-$(subst .,-,$(version)) - -dist: local-inst -.PHONY: local-inst -local-inst: $(prog) - install -c -g kmem -o $(USER) -m 2755 $< /usr/local/gnubin/make - -# Put the alpha distribution files in the anonymous FTP directory. -alpha-files = $(tarfiles) GNUmakefile compatMakefile $(testdir).tar.Z -dist: alpha -.PHONY: alpha -alpha-dir := ~ftp/gnu -alpha-files := $(addprefix $(alpha-dir)/,$(alpha-files)) -alpha: $(alpha-dir) $(alpha-files) -$(alpha-dir)/%: % - @rm -f $@ - cp $< $@ - -# Implicit rule to make README and README-doc. -%: %.template version.c - rm -f $@ - sed 's/VERSION/$(version)/' < $< > $@ -# Make sure I don't edit it by accident. - chmod a-w $@ - $(CVS) commit -m'Regenerated for $(version)' $@ - -define make-tar -@rm -fr make-$(version) -ln -s . make-$(version) -tar cvhof $@ $(addprefix make-$(version)/,$^) -rm -f make-$(version) -endef - -%.Z: %; compress -c $< > $@ -%.gz: %; gzip -9 -c -v $< > $@ - -make-$(version).tar: $(distfiles) - $(make-tar) - -ifneq (,) -tests := $(filter-out %~,$(wildcard tests/*)) -make-tests-$(version).tar.Z: $(tests) - @rm -fr make-tests-$(version) - ln -s tests make-tests-$(version) - tar cvhf $(@:.Z=) $(patsubst tests/%,make-tests-$(version)/%,$^) - rm -f make-tests-$(version) - compress -f $(@:.Z=) -endif + autoconf -$(archpfx)loadtest: $(archpfx)load.o +Makefile.in: configure.in config.h.in Makefile.am aclocal.m4 + automake --add-missing diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6960f08 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,63 @@ +# -*-Makefile-*-, or close enough + +AUTOMAKE_OPTIONS = 1.2 + +bin_PROGRAMS = make + +make_SOURCES = main.c commands.c job.c dir.c file.c misc.c read.c remake.c \ + rule.c implicit.c default.c variable.c expand.c function.c \ + vpath.c version.c ar.c arscan.c remote-$(REMOTE).c \ + commands.h dep.h filedef.h job.h make.h rule.h variable.h \ + signame.c signame.h \ + getopt.c getopt1.c getopt.h +make_LDADD = @LIBOBJS@ @ALLOCA@ glob/libglob.a + +info_TEXINFOS = make.texinfo + +INCLUDES = -I$(srcdir)/glob -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" + +BUILT_SOURCES = README build.sh.in + +EXTRA_DIST = make.man $(BUILT_SOURCES) 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 + +# Look for the make test suite, and run it if found. Look in MAKE_TEST, or +# in the srcdir and its parent and the distdir and its parent. +# +check-local: + @here=`pwd`; test=""; \ + case "$(MAKE_TEST)" in "") \ + for d1 in $$here $(srcdir); do \ + for d2 in .. .; do \ + try=`ls -1 $$d1/$$d2/make-test-*/run_make_tests 2>/dev/null | tail -1`; \ + case "$$try" in "") : ;; *) test="$$try" ;; esac; \ + done; done ;; \ + *) test="$(MAKE_TEST)" ;; \ + esac; \ + case "$$test" in \ + "") echo "Couldn't find make-test-* test suite."; exit 1;; \ + esac; \ + testdir=`dirname $$test`; \ + echo "cd $$testdir && ./run_make_tests -make_path $$here/make"; \ + cd $$testdir && ./run_make_tests -make_path $$here/make" + +# Install the w32 subdirectory +# +dist-hook: + (cd $(srcdir); \ + w32=`find w32 -follow \( -name CVS -prune \) -o -type f -print`; \ + tar chf - $$w32) \ + | (cd $(distdir); tar xfBp -) + +if MAINT_MAKEFILE +# Note this requires GNU make. Not to worry, since it will only be included +# in the Makefile if we're in the maintainer's environment. +include $(srcdir)/maintMakefile +endif @@ -1,6 +1,6 @@ GNU make NEWS -*-indented-text-*- History of user-visible changes. - 06 Apr 1996 + 18 Aug 1997 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. See the end for copying conditions. @@ -21,7 +21,8 @@ Version 3.76 list of words from number S to number E (inclusive) of TEXT. * Instead of an error, detection of future modification times gives a - warning and continues. + warning and continues. The warning is repeated just before GNU make + exits, so it is less likely to be lost. * Fix the $(basename) and $(suffix) functions so they only operate on the last filename, not the entire string: @@ -33,6 +34,8 @@ Version 3.76 $(suffix a.b) b b $(suffix a.b/c) b/c <empty> +* The $(strip) function now removes newlines as well as TABs and spaces. + * Updates to the Windows 95/NT port from Rob Tulloh (see README.W32). * Eli Zaretskii has updated the port to 32-bit protected mode on MSDOS diff --git a/README.DOS.template b/README.DOS.template index 49fd0e7..6226f7b 100644 --- a/README.DOS.template +++ b/README.DOS.template @@ -75,10 +75,10 @@ Notes: When shell features like redirection or filename wildcards are involved, Make calls the shell. - This port supports both DOS shells (the stock COMMAND.COM and - its 4DOS/NDOS replacements), and Unix-style shells (tested with - the venerable Stewartson's `ms_sh' 2.3 and the recent DJGPP port - of `bash' by Daisuke Aoyama <jack@st.rim.or.jp>). + This port supports both DOS shells (the stock COMMAND.COM and its + 4DOS/NDOS replacements), and Unix-style shells (tested with the + venerable Stewartson's `ms_sh' 2.3 and the DJGPP port of `bash' by + Daisuke Aoyama <jack@st.rim.or.jp>). When the $SHELL variable points to a Unix-style shell, Make works just like you'd expect on Unix, calling the shell for any @@ -204,8 +204,8 @@ Notes: doesn't include characters illegal on MSDOS FAT filesystems, will be automatically down-cased.) User reports that I have indicate that this default behavior is generally what you'd - expect; however, since this is the first DJGPP port of Make that - supports long filenames, your input is most welcome. + expect; however, since support for long filenames in the DJGPP + port of GNU Make is relatively new, your input is most welcome. In any case, if you hit a situation where you must force Make to get the 8+3 DOS filenames in upper case, set FNCASE=y in the @@ -218,7 +218,7 @@ Notes: make implicit assumptions about the pathname syntax. In particular, the directories are assumed to be separated by `/', and any pathname which doesn't begin with a `/' is assumed to be - releative to the current directory. This port attempts to + relative to the current directory. This port attempts to support DOS-style pathnames which might include the drive letter and use backslashes instead of forward slashes. However, this support is not complete; I feel that pursuing this support too diff --git a/README.template b/README.template index 0d3bbfc..735815c 100644 --- a/README.template +++ b/README.template @@ -1,4 +1,4 @@ -This directory contains the VERSION test release of GNU Make. +This directory contains the %VERSION% test release of GNU Make. All bugs reported for previous test releases have been fixed. Some bugs surely remain. @@ -16,8 +16,9 @@ Make, try using `build.sh' instead. See README.W32 for details about GNU Make on Windows NT or 95. See README.Amiga for details about GNU Make on AmigaDOS. -The MSDOS port of GNU Make is available as part of DJGPP; see the -WWW page http://www.delorie.com/djgpp/ for more information. +A precompiled binary of the MSDOS port of GNU Make is available as part +of DJGPP; see the WWW page http://www.delorie.com/djgpp/ for more +information. It has been reported that the XLC 1.2 compiler on AIX 3.2 is buggy such that if you compile make with `cc -O' on AIX 3.2, it will not work correctly. @@ -1,3 +1,9 @@ +/* Name of this package (needed by automake) */ +#undef PACKAGE + +/* Version of this package (needed by automake) */ +#undef VERSION + /* Define to the name of the SCCS `get' command. */ #undef SCCS_GET diff --git a/build.template b/build.template index 1e65ac5..40307ff 100644 --- a/build.template +++ b/build.template @@ -4,7 +4,7 @@ # Copyright (C) 1993, 1994 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 2, or (at your option) @@ -14,7 +14,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Make; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/configure.in b/configure.in index c6f6583..4eb6091 100644 --- a/configure.in +++ b/configure.in @@ -1,14 +1,21 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION([$Id$]) -AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. +AC_PREREQ(2.12)dnl dnl Minimum Autoconf version required. AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. -AC_CONFIG_HEADER(config.h) -AC_CONFIG_SUBDIRS(glob) dnl Run configure in glob subdirectory. + +AM_INIT_AUTOMAKE(make, 3.75.91) +AM_CONFIG_HEADER(config.h) +AC_CONFIG_SUBDIRS(glob) + +AM_CONDITIONAL(MAINT_MAKEFILE, test -r $srcdir/maintMakefile) + +dnl Regular configure stuff AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_INSTALL AC_PROG_CPP dnl Later checks need this. +AC_ARG_PROGRAM AC_AIX AC_ISC_POSIX AC_MINIX @@ -187,6 +187,23 @@ rehash_file (file, name) file_hash_enter (file, name, oldhash, file->name); } +/* Rename FILE to NAME. This is not as simple as resetting + the `name' member, since it must be put in a new hash bucket, + and possibly merged with an existing file called NAME. */ + +void +rename_file (file, name) + register struct file *file; + char *name; +{ + rehash_file(file, name); + while (file) + { + file->name = file->hname; + file = file->prev; + } +} + void file_hash_enter (file, name, oldhash, oldname) register struct file *file; @@ -91,7 +91,7 @@ extern struct file *default_goal_file, *suffix_file, *default_file; extern struct file *lookup_file (), *enter_file (); extern void remove_intermediates (), snap_deps (); -extern void rehash_file (), file_hash_enter (); +extern void rename_file (), rehash_file (), file_hash_enter (); extern void set_command_state (); @@ -1049,8 +1049,15 @@ expand_function (o, function, text, end) text = expand_argument (text, end); p2 = text; - while ((p = find_next_token (&p2, &i)) != 0) + while (*p2 != '\0') { + while (isspace(*p2)) + ++p2; + p = p2; + for (i=0; *p2 != '\0' && !isspace(*p2); ++p2, ++i) + {} + if (!i) + break; o = variable_buffer_output (o, p, i); o = variable_buffer_output (o, " ", 1); doneany = 1; diff --git a/glob/ChangeLog b/glob/ChangeLog index de04c4b..92c5e7c 100644 --- a/glob/ChangeLog +++ b/glob/ChangeLog @@ -1,3 +1,24 @@ +Tue Aug 12 10:52:34 1997 Paul D. Smith <psmith@baynetworks.com> + + * configure.in: Require autoconf 2.12. + + * glob: Updates from latest GNU libc glob code. + + * glob.c,glob.h,fnmatch.h: Change all WIN32 references to WINDOWS32. + + * glob.h: OSF4 defines macros in such a way that GLOB_ALTDIRFUNC + is not defined. Added a test to the #if which defines it if + _GNU_SOURCE is defined; that's set by both glob.c and GNU make. + + * glob.c: SunOS4 w/ cc needs #include <stdio.h>, since assert.h + requires stderr but doesn't include stdio.h :-/. + (next_brace_sub): De-protoize function definition. + (glob): Cast __alloca(); on SunOS4 it uses the default return type + of int. + (glob): Irix defines getlogin_r() to return a char*; move the + extern for that into the _LIBC area since it isn't used except in + LIBC anyway. Likewise, move extern getlogin() into the "else". + Sat Jul 20 21:55:31 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> Win32 hacks from <Rob_Tulloh@tivoli.com>. diff --git a/glob/Makefile.am b/glob/Makefile.am new file mode 100644 index 0000000..3c4ab7a --- /dev/null +++ b/glob/Makefile.am @@ -0,0 +1,10 @@ +# -*-Makefile-*-, or close enough + +AUTOMAKE_OPTIONS = 1.2 foreign + +noinst_LIBRARIES = libglob.a + +libglob_a_SOURCES = glob.c glob.h fnmatch.c fnmatch.h + +EXTRA_DIST = COPYING.LIB Makefile.ami SCOPTIONS SMakefile \ + configure.bat diff --git a/glob/configure.in b/glob/configure.in index 8dc68e4..cf0a408 100644 --- a/glob/configure.in +++ b/glob/configure.in @@ -1,6 +1,9 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(fnmatch.c) dnl A distinctive file to look for in srcdir. -AC_PREREQ(2.1) dnl Minimum Autoconf version required. +AC_PREREQ(2.12) dnl Minimum Autoconf version required. + +AM_INIT_AUTOMAKE(glob, 0.0, nodefs) + AC_PROG_CC AC_CHECK_PROG(AR, ar, ar, ar) AC_PROG_RANLIB diff --git a/glob/fnmatch.h b/glob/fnmatch.h index 20ed659..38b7255 100644 --- a/glob/fnmatch.h +++ b/glob/fnmatch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,7 +17,6 @@ Boston, MA 02111-1307, USA. */ #ifndef _FNMATCH_H - #define _FNMATCH_H 1 #ifdef __cplusplus diff --git a/glob/glob.c b/glob/glob.c index 8474766..6a82fe0 100644 --- a/glob/glob.c +++ b/glob/glob.c @@ -37,6 +37,8 @@ /* #define NDEBUG 1 */ #include <assert.h> +#include <stdio.h> /* Needed on stupid SunOS for assert. */ + /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C @@ -250,7 +252,6 @@ extern char *alloca (); #undef GLOB_PERIOD #include <glob.h> -static int glob_pattern_p __P ((const char *pattern, int quote)); static int glob_in_dir __P ((const char *pattern, const char *directory, int flags, int (*errfunc) __P ((const char *, int)), @@ -266,7 +267,8 @@ static inline #endif const char * -next_brace_sub (const char *begin) +next_brace_sub (begin) + const char *begin; { unsigned int depth = 0; const char *cp = begin; @@ -288,7 +290,7 @@ next_brace_sub (const char *begin) while (*cp != '\0' && (*cp != '}' || depth > 0)) { if (*cp == '}') - ++depth; + --depth; ++cp; } if (*cp == '\0') @@ -308,7 +310,7 @@ next_brace_sub (const char *begin) If a directory cannot be opened or read and ERRFUNC is not nil, it is called with the pathname that caused the error, and the `errno' value from the failing call; if it returns non-zero - `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. + `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ int @@ -511,11 +513,9 @@ glob (pattern, flags, errfunc, pglob) #else if (home_dir == NULL || home_dir[0] == '\0') { - extern char *getlogin __P ((void)); - extern int getlogin_r __P ((char *, size_t)); int success; - #if defined HAVE_GETLOGIN_R || defined _LIBC + extern int getlogin_r __P ((char *, size_t)); size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1; char *name; @@ -523,11 +523,13 @@ glob (pattern, flags, errfunc, pglob) /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try a moderate value. */ buflen = 16; - name = __alloca (buflen); + name = (char *) __alloca (buflen); success = getlogin_r (name, buflen) >= 0; #else + extern char *getlogin __P ((void)); char *name; + success = (name = getlogin ()) != NULL; #endif if (success) @@ -537,7 +539,7 @@ glob (pattern, flags, errfunc, pglob) char *pwtmpbuf; struct passwd pwbuf, *p; - pwtmpbuf = __alloca (pwbuflen); + pwtmpbuf = (char *) __alloca (pwbuflen); success = (__getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) >= 0); @@ -560,7 +562,7 @@ glob (pattern, flags, errfunc, pglob) { char *newp; size_t home_len = strlen (home_dir); - newp = __alloca (home_len + dirlen); + newp = (char *) __alloca (home_len + dirlen); memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], &dirname[1], dirlen); dirname = newp; @@ -577,7 +579,7 @@ glob (pattern, flags, errfunc, pglob) user_name = dirname + 1; else { - user_name = __alloca (end_name - dirname); + user_name = (char *) __alloca (end_name - dirname); memcpy (user_name, dirname + 1, end_name - dirname); user_name[end_name - dirname - 1] = '\0'; } @@ -586,7 +588,7 @@ glob (pattern, flags, errfunc, pglob) { #if defined HAVE_GETPWNAM_R || defined _LIBC size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); - char *pwtmpbuf = __alloca (buflen); + char *pwtmpbuf = (char *) __alloca (buflen); struct passwd pwbuf, *p; if (__getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0) home_dir = p->pw_dir; @@ -606,18 +608,18 @@ glob (pattern, flags, errfunc, pglob) char *newp; size_t home_len = strlen (home_dir); size_t rest_len = end_name == NULL ? 0 : strlen (end_name); - newp = __alloca (home_len + rest_len + 1); + newp = (char *) __alloca (home_len + rest_len + 1); memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], end_name, rest_len); newp[home_len + rest_len] = '\0'; dirname = newp; } } -#endif /* Not Amiga && not Windows32. */ +#endif /* Not Amiga && not WINDOWS32. */ } #endif /* Not VMS. */ - if (glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE))) + if (__glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE))) { /* The directory name contains metacharacters, so we have to glob for the directory, and then glob for @@ -648,7 +650,7 @@ glob (pattern, flags, errfunc, pglob) { globfree (&dirs); globfree (&files); - return GLOB_ABEND; + return GLOB_ABORTED; } } #endif /* SHELL. */ @@ -844,8 +846,8 @@ prefix_array (dirname, array, n) /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ -static int -glob_pattern_p (pattern, quote) +int +__glob_pattern_p (pattern, quote) const char *pattern; int quote; { @@ -876,6 +878,9 @@ glob_pattern_p (pattern, quote) return 0; } +#ifdef _LIBC +weak_alias (__glob_pattern_p, glob_pattern_p) +#endif /* Like `glob', but PATTERN is a final pathname component, @@ -900,7 +905,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) struct globlink *names = NULL; size_t nfound = 0; - if (!glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE))) + if (!__glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE))) { stream = NULL; flags |= GLOB_NOCHECK; @@ -916,7 +921,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) { if ((errfunc != NULL && (*errfunc) (directory, errno)) || (flags & GLOB_ERR)) - return GLOB_ABEND; + return GLOB_ABORTED; } else while (1) @@ -958,7 +963,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) } if (nfound == 0 && (flags & GLOB_NOMAGIC) && - ! glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE))) + ! __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE))) flags |= GLOB_NOCHECK; if (nfound == 0 && (flags & GLOB_NOCHECK)) diff --git a/glob/glob.h b/glob/glob.h index d4d7e7b..515514a 100644 --- a/glob/glob.h +++ b/glob/glob.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. @@ -19,7 +19,6 @@ Boston, MA 02111-1307, USA. */ #ifndef _GLOB_H - #define _GLOB_H 1 #ifdef __cplusplus @@ -55,7 +54,7 @@ extern "C" GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ GLOB_NOMAGIC|GLOB_TILDE) -#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE) +#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE) || defined (_GNU_SOURCE) #define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ #define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ #define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ @@ -65,9 +64,15 @@ extern "C" /* Error returns from `glob'. */ #define GLOB_NOSPACE 1 /* Ran out of memory. */ -#define GLOB_ABEND 2 /* Read error. */ +#define GLOB_ABORTED 2 /* Read error. */ #define GLOB_NOMATCH 3 /* No matches found. */ +#ifdef _GNU_SOURCE +/* Previous versions of this file defined GLOB_ABEND instead of + GLOB_ABORTED. Provide a compatibility definition here. */ +# define GLOB_ABEND GLOB_ABORTED +#endif + /* Structure describing a globbing run. */ #if !defined (_AMIGA) && !defined (VMS) /* Buggy compiler. */ struct stat; @@ -104,6 +109,16 @@ extern int glob __P ((const char *__pattern, int __flags, extern void globfree __P ((glob_t *__pglob)); +#ifdef _GNU_SOURCE +/* Return nonzero if PATTERN contains any metacharacters. + Metacharacters can be quoted with backslashes if QUOTE is nonzero. + + This function is not part of the interface specified by POSIX.2 + but several programs want to use it. */ +extern int __glob_pattern_p __P ((__const char *__pattern, int __quote)); +extern int glob_pattern_p __P ((__const char *__pattern, int __quote)); +#endif + #ifdef __cplusplus } #endif @@ -785,6 +785,18 @@ start_job_command (child) message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag)) ? "%s" : (char *) 0, p); + /* Optimize an empty command. People use this for timestamp rules, + and forking a useless shell all the time leads to inefficiency. */ + + if ((argv[0] && !strcmp(argv[0], "/bin/sh")) + && (argv[1] && !strcmp(argv[1], "-c")) + && (argv[2] && !strcmp(argv[2], ":")) + && argv[3] == NULL) + { + set_command_state (child->file, cs_running); + goto next_command; + } + /* Tell update_goal_chain that a command has been started on behalf of this target. It is important that this happens here and not in reap_children (where we used to do it), because reap_children might be @@ -392,6 +392,12 @@ struct file *default_file; This turns on pedantic compliance with POSIX.2. */ int posix_pedantic; + +/* Nonzero if some rule detected clock skew; we keep track so (a) we only + print one warning about it during the run, and (b) we can print a final + warning at the end of the run. */ + +int clock_skew_detected; /* Mask of signals that are being caught with fatal_error_signal. */ @@ -1554,6 +1560,10 @@ int main (int argc, char ** argv) fatal ("No targets"); } + /* If we detected some clock skew, generate one last warning */ + if (clock_skew_detected) + error("*** Warning: Clock skew detected. Your build may be incomplete."); + /* Exit. */ die (status); } diff --git a/maintMakefile b/maintMakefile new file mode 100644 index 0000000..aeb5616 --- /dev/null +++ b/maintMakefile @@ -0,0 +1,33 @@ +# Maintainer-only makefile segment. This contains things that are relevant +# only if you have the full copy of the GNU make sources, not a dist copy. +# + +# Find the glob source files... this might be dangerous, but we're maintainers! +# +globsrc := $(wildcard glob/*.c) + +# General rule for turning a .template into a regular file. +# +README : % : %.template configure.in + rm -f $@ + sed 's/%VERSION%/$(version)/' < $< > $@ + chmod a-w $@ + +# Construct build.sh.in +# +build.sh.in: build.template Makefile.am + rm -f $@ + sed -e 's@%objs%@$(filter-out remote-%, $(make_OBJECTS)\ + $(patsubst %.c,%.o,$(globsrc)))@' \ + $< > $@ + chmod a-w+x $@ + +# Put the alpha distribution files up for anonymous FTP. +# +ALPHA := ~ftp/gnu +TARFILE := $(distdir).tar.gz + +.PHONY: alpha +alpha: $(ALPHA) $(TARFILE) + @rm -f $(ALPHA)/$(TARFILE) + cp -p $(TARFILE) $(ALPHA) @@ -8,7 +8,7 @@ make \- GNU make utility to maintain groups of programs makefile ] [ option ] ... target ... .SH WARNING -This man paage is an extract of the documentation of +This man page is an extract of the documentation of .I GNU make . It is updated only occasionally, because the GNU project does not use nroff. For complete, current documentation, refer to the Info file @@ -110,7 +110,7 @@ or if the target does not exist. .B \-b .TP 0.5i .B \-m -These options are ignored for compatibility with other versions of +These options are ignored for compatibility with other versions of .IR make . .TP 0.5i .BI "\-C " dir @@ -157,7 +157,7 @@ If several .B \-I options are used to specify several directories, the directories are searched in the order specified. -Unlike the arguments to other flags of +Unlike the arguments to other flags of .IR make , directories given with .B \-I @@ -236,11 +236,11 @@ Silent operation; do not print the commands as they are executed. Cancel the effect of the .B \-k option. -This is never necessary except in a recursive +This is never necessary except in a recursive .I make where .B \-k -might be inherited from the top-level +might be inherited from the top-level .I make via MAKEFLAGS or if you set .B \-k @@ -254,7 +254,7 @@ future invocations of .IR make . .TP 0.5i .B \-v -Print the version of the +Print the version of the .I make program plus a copyright, a list of authors and a notice that there is no warranty. @@ -285,7 +285,7 @@ it is almost the same as running a .I touch command on the given file before running .IR make , -except that the modification time is changed only in the imagination of +except that the modification time is changed only in the imagination of .IR make . .SH "SEE ALSO" .PD 0 @@ -376,7 +376,7 @@ extern void child_access (); #endif /* We omit these declarations on non-POSIX systems which define _POSIX_VERSION, - because such systems often declare the in header files anyway. */ + because such systems often declare them in header files anyway. */ #if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32) @@ -407,6 +407,7 @@ extern int debug_flag, print_data_base_flag, question_flag, touch_flag; extern int env_overrides, no_builtin_rules_flag, print_version_flag; extern int print_directory_flag, warn_undefined_variables_flag; extern int posix_pedantic; +extern int clock_skew_detected; extern unsigned int job_slots; #ifndef NO_FLOAT diff --git a/make.texinfo b/make.texinfo index 14b38fc..25c7ec9 100644 --- a/make.texinfo +++ b/make.texinfo @@ -37,7 +37,7 @@ and issues the commands to recompile them. This is Edition @value{EDITION}, last updated @value{UPDATED}, of @cite{The GNU Make Manual}, for @code{make}, Version @value{VERSION}. -Copyright (C) 1988, '89, '90, '91, '92, '93, '94, '95, '96 +Copyright (C) 1988, '89, '90, '91, '92, '93, '94, '95, '96, '97 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of @@ -264,7 +264,7 @@ Functions for Transforming Text * Syntax of Functions:: How to write a function call. * Text Functions:: General-purpose text manipulation functions. -* Filename Functions:: Functions for manipulating file names. +* File Name Functions:: Functions for manipulating file names. * Foreach Function:: Repeat some text with controlled variation. * Origin Function:: Find where a variable got its value. * Shell Function:: Substitute the output of a shell command. @@ -1102,6 +1102,8 @@ makefile as has been traditionally done with other versions of @cindex @code{-I} @cindex @code{--include-dir} +@cindex included makefiles, default directries +@cindex default directries for included makefiles @findex /usr/gnu/include @findex /usr/local/include @findex /usr/include @@ -1112,7 +1114,10 @@ First, any directories you have specified with the @samp{-I} or (@pxref{Options Summary, ,Summary of Options}). Then the following directories (if they exist) are searched, in this order: -@file{@var{prefix}/include} (normally @file{/usr/local/include}) +@file{@var{prefix}/include} (normally @file{/usr/local/include} +@footnote{GNU Make compiled for MS-DOS and MS-Windows behaves as if +@var{prefix} has been defined to be the root of the DJGPP tree +hierarchy.}) @file{/usr/gnu/include}, @file{/usr/local/include}, @file{/usr/include}. @@ -1464,7 +1469,10 @@ significance. If alone, or followed by a slash, it represents your home directory. For example @file{~/bin} expands to @file{/home/you/bin}. If the @samp{~} is followed by a word, the string represents the home directory of the user named by that word. For example @file{~john/bin} -expands to @file{/home/john/bin}.@refill +expands to @file{/home/john/bin}. On systems which don't have a home +directory for each user (such as MS-DOS or MS-Windows), this +functionality can be simulated by setting the environment variable +@var{HOME}.@refill Wildcard expansion happens automatically in targets, in dependencies, and in commands (where the shell does the expansion). In other @@ -1578,6 +1586,24 @@ expansion, but you need more sophisticated techniques, including the These are described in the following section. @end iftex +@cindex wildcards and MS-DOS/MS-Windows backslashes +@cindex backslashes in pathnames and wildcard expansion + +Microsoft operating systems (MS-DOS and MS-Windows) use backslashes to +separate directories in pathnames, like so: + +@example + c:\foo\bar\baz.c +@end example + +This is equivalent to the Unix-style @file{c:/foo/bar/baz.c} (the +@file{c:} part is the so-called drive letter). When @code{make} runs on +these systems, it supports backslashes as well as the Unix-style forward +slashes in pathnames. However, this support does @emph{not} include the +wildcard expansion, where backslash is a quote character. Therefore, +you @emph{must} use Unix-style slashes in these cases. + + @node Wildcard Function, , Wildcard Pitfall, Wildcards @subsection The Function @code{wildcard} @findex wildcard @@ -1676,13 +1702,15 @@ Thus, if a file that is listed as a target or dependency does not exist in the current directory, @code{make} searches the directories listed in @code{VPATH} for a file with that name. If a file is found in one of them, that file may become the dependency (see below). Rules may then -specify the names of source files in the dependencies as if they all +specify the names of files in the dependency list as if they all existed in the current directory. @xref{Commands/Search, ,Writing Shell Commands with Directory Search}. In the @code{VPATH} variable, directory names are separated by colons or blanks. The order in which directories are listed is the order followed -by @code{make} in its search. +by @code{make} in its search. (On MS-DOS and MS-Windows, semi-colons +are used as separators of directory names in @code{VPATH}, since the +colon can be used in the pathname itself, after the drive letter.) For example, @@ -1715,11 +1743,12 @@ is found in the directory @file{src}. @subsection The @code{vpath} Directive @findex vpath -Similar to the @code{VPATH} variable but more selective is the @code{vpath} -directive (note lower case), which allows you to specify a search path for a particular class -of file names, those that match a particular pattern. Thus you can supply -certain search directories for one class of file names and other directories -(or none) for other file names. +Similar to the @code{VPATH} variable, but more selective, is the +@code{vpath} directive (note lower case), which allows you to specify a +search path for a particular class of file names: those that match a +particular pattern. Thus you can supply certain search directories for +one class of file names and other directories (or none) for other file +names. There are three forms of the @code{vpath} directive: @@ -1729,8 +1758,8 @@ Specify the search path @var{directories} for file names that match @var{pattern}. The search path, @var{directories}, is a list of directories to be -searched, separated by colons or blanks, just like the search path used -in the @code{VPATH} variable. +searched, separated by colons (semi-colons on MS-DOS and MS-Windows) or +blanks, just like the search path used in the @code{VPATH} variable. @item vpath @var{pattern} Clear out the search path associated with @var{pattern}. @@ -1817,7 +1846,7 @@ will look for a file ending in @samp{.c} in @file{foo}, then When a dependency is found through directory search, regardless of type (general or selective), the pathname located may not be the one that -@code{make} actually provides you in the dependency list. Sometimes, +@code{make} actually provides you in the dependency list. Sometimes the path discovered through directory search is thrown away. The algorithm @code{make} uses to decide whether to keep or abandon a @@ -1829,7 +1858,7 @@ If a target file does not exist at the path specified in the makefile, directory search is performed. @item -If the directory search is successful that path is kept, and this file +If the directory search is successful, that path is kept and this file is tentatively stored as the target. @item @@ -1843,17 +1872,20 @@ rebuilt: @item If the target does @emph{not} need to be rebuilt, the path to the file found during directory search is used for any dependency lists which -contain this target. +contain this target. In short, if @code{make} doesn't need to rebuild +the target then you use the path found via directory search. @item If the target @emph{does} need to be rebuilt (is out-of-date), the pathname found during directory search is @emph{thrown away}, and the -target is rebuilt using the filename specified in the makefile. +target is rebuilt using the file name specified in the makefile. In +short, if @code{make} must rebuild, then the target is rebuilt locally, +not in the directory found via directory search. @end enumerate @end enumerate -This may seem overly complex, but in fact it is almost always exactly -what you want. +This algorithm may seem complex, but in practice it is quite often +exactly what you want. @cindex traditional directory search @cindex directory search, traditional @@ -1958,7 +1990,9 @@ handles it specially by searching for the file @file{lib@var{name}.a} in the current directory, in directories specified by matching @code{vpath} search paths and the @code{VPATH} search path, and then in the directories @file{/lib}, @file{/usr/lib}, and @file{@var{prefix}/lib} -(normally @file{/usr/local/lib}). +(normally @file{/usr/local/lib}, but MS-DOS/MS-Windows versions of +@code{make} behave as if @var{prefix} is defined to be the root of the +DJGPP installation tree). For example, @@ -2834,13 +2868,15 @@ by making a new subshell for each line. (In practice, @code{make} may take shortcuts that do not affect the results.) @cindex @code{cd} (shell command) -@strong{Please note:} this implies that shell commands such as -@code{cd} that set variables local to each process will not affect the -following command lines. If you want to use @code{cd} to affect the -next command, put the two on a single line with a semicolon between -them. Then @code{make} will consider them a single command and pass -them, together, to a shell which will execute them in sequence. For -example: +@strong{Please note:} this implies that shell commands such as @code{cd} +that set variables local to each process will not affect the following +command lines. @footnote{On MS-DOS, the value of current working +directory is @strong{global}, so changing it @emph{will} affect the +following command lines on those systems.} If you want to use @code{cd} +to affect the next command, put the two on a single line with a +semicolon between them. Then @code{make} will consider them a single +command and pass them, together, to a shell which will execute them in +sequence. For example: @example foo : bar/lose @@ -2871,13 +2907,75 @@ foo : bar/lose The program used as the shell is taken from the variable @code{SHELL}. By default, the program @file{/bin/sh} is used. +@vindex COMSPEC +On MS-DOS, if @code{SHELL} is not set, the value of the variable +@code{COMSPEC} (which is always set) is used instead. + +@cindex @code{SHELL}, MS-DOS specifics +The processing of lines that set the variable @code{SHELL} in Makefiles +is different on MS-DOS. The stock shell, @file{command.com}, is +ridiculously limited in its functionality and many users of @code{make} +tend to install a replacement shell. Therefore, on MS-DOS, @code{make} +examines the value of @code{SHELL}, and changes its behavior based on +whether it points to a Unix-style or DOS-style shell. This allows +reasonable functionality even if @code{SHELL} points to +@file{command.com}. + +If @code{SHELL} points to a Unix-style shell, @code{make} on MS-DOS +additionally checks whether that shell can indeed be found; if not, it +ignores the line that sets @code{SHELL}. In MS-DOS, GNU @code{make} +searches for the shell in the following places: + +@enumerate +@item +In the precise place pointed to by the value of @code{SHELL}. For +example, if the makefile specifies @samp{SHELL = /bin/sh}, @code{make} +will look in the directory @file{/bin} on the current drive. + +@item +In the current directory. + +@item +In each of the directories in the @code{PATH} variable, in order. + +@end enumerate + +In every directory it examines, @code{make} will first look for the +specific file (@file{sh} in the example above). If this is not found, +it will also look in that directory for that file with one of the known +extensions which identify executable files. For example @file{.exe}, +@file{.com}, @file{.bat}, @file{.btm}, @file{.sh}, and some others. + +If any of these attempts is successful, the value of @code{SHELL} will +be set to the full pathname of the shell as found. However, if none of +these is found, the value of @code{SHELL} will not be changed, and thus +the line that sets it will be effectively ignored. This is so +@code{make} will only support features specific to a Unix-style shell if +such a shell is actually installed on the system where @code{make} runs. + +Note that this extended search for the shell is limited to the cases +where @code{SHELL} is set from the Makefile; if it is set in the +environment or command line, you are expected to set it to the full +pathname of the shell, exactly as things are on Unix. + +The effect of the above DOS-specific processing is that a Makefile that +says @samp{SHELL = /bin/sh} (as many Unix makefiles do), will work +on MS-DOS unaltered if you have e.g. @file{sh.exe} installed in some +directory along your @code{PATH}. + @cindex environment, @code{SHELL} in Unlike most variables, the variable @code{SHELL} is never set from the environment. This is because the @code{SHELL} environment variable is used to specify your personal choice of shell program for interactive -use. It would be very bad for personal choices like this to affect -the functioning of makefiles. @xref{Environment, ,Variables from the -Environment}. +use. It would be very bad for personal choices like this to affect the +functioning of makefiles. @xref{Environment, ,Variables from the +Environment}. However, on MS-DOS and MS-Windows the value of +@code{SHELL} in the environment @strong{is} used, since on those systems +most users do not set this variable, and therefore it is most likely set +specifically to be used by @code{make}. On MS-DOS, if the setting of +@code{SHELL} is not suitable for @code{make}, you can set the variable +@code{MAKESHELL} to the shell that @code{make} should use; this will +override the value of @code{SHELL}. @node Parallel, Errors, Execution, Commands @section Parallel Execution @@ -2894,6 +2992,9 @@ for it to finish before executing the next. However, the @samp{-j} or @samp{--jobs} option tells @code{make} to execute many commands simultaneously.@refill +On MS-DOS, the @samp{-j} option has no effect, since that system doesn't +support multi-processing. + If the @samp{-j} option is followed by an integer, this is the number of commands to execute at once; this is called the number of @dfn{job slots}. If there is nothing looking like an integer after the @samp{-j} option, @@ -3110,7 +3211,7 @@ subdirectory. You can do it by writing this: @example subsystem: - cd subdir; $(MAKE) + cd subdir && $(MAKE) @end example @noindent @@ -3146,13 +3247,13 @@ not the explicit command name @samp{make}, as shown here: @example @group subsystem: - cd subdir; $(MAKE) + cd subdir && $(MAKE) @end group @end example The value of this variable is the file name with which @code{make} was invoked. If this file name was @file{/bin/make}, then the command executed -is @samp{cd subdir; /bin/make}. If you use a special version of +is @samp{cd subdir && /bin/make}. If you use a special version of @code{make} to run the top-level makefile, the same special version will be executed for recursive invocations. @cindex @code{cd} (shell command) @@ -3169,7 +3270,7 @@ Consider the command @samp{make -t} in the above example. (The any commands; see @ref{Instead of Execution}.) Following the usual definition of @samp{-t}, a @samp{make -t} command in the example would create a file named @file{subsystem} and do nothing else. What you -really want it to do is run @samp{@w{cd subdir;} @w{make -t}}; but that would +really want it to do is run @samp{@w{cd subdir &&} @w{make -t}}; but that would require executing the command, and @samp{-t} says not to execute commands.@refill @cindex @code{-t}, and recursion @@ -3420,7 +3521,7 @@ value of @code{MAKEFLAGS}, like this: @example subsystem: - cd subdir; $(MAKE) MAKEFLAGS= + cd subdir && $(MAKE) MAKEFLAGS= @end example @vindex MAKEOVERRIDES @@ -3459,7 +3560,7 @@ this: @example subsystem: - cd subdir; $(MAKE) $(MFLAGS) + cd subdir && $(MAKE) $(MFLAGS) @end example @noindent @@ -4585,7 +4686,9 @@ Such problems would be especially likely with the variable @code{SHELL}, which is normally present in the environment to specify the user's choice of interactive shell. It would be very undesirable for this choice to affect @code{make}. So @code{make} ignores the environment value of -@code{SHELL}.@refill +@code{SHELL} (except on MS-DOS and MS-Windows, where @code{SHELL} is +usually not set. @xref{Execution, ,Special handling of SHELL on +MS-DOS}.)@refill @node Conditionals, Functions, Using Variables, Top @chapter Conditional Parts of Makefiles @@ -4882,7 +4985,7 @@ call, just as a variable might be substituted. @menu * Syntax of Functions:: How to write a function call. * Text Functions:: General-purpose text manipulation functions. -* Filename Functions:: Functions for manipulating file names. +* File Name Functions:: Functions for manipulating file names. * Foreach Function:: Repeat some text with controlled variation. * Origin Function:: Find where a variable got its value. * Shell Function:: Substitute the output of a shell command. @@ -4951,7 +5054,7 @@ bar:= $(subst $(space),$(comma),$(foo)) Here the @code{subst} function replaces each space with a comma, through the value of @code{foo}, and substitutes the result. -@node Text Functions, Filename Functions, Syntax of Functions, Functions +@node Text Functions, File Name Functions, Syntax of Functions, Functions @section Functions for String Substitution and Analysis @cindex functions, for text @@ -5215,7 +5318,7 @@ used so that the new value is assigned even if the previous value of @code{CFLAGS} was specified with a command argument (@pxref{Override Directive, , The @code{override} Directive}). -@node Filename Functions, Foreach Function, Text Functions, Functions +@node File Name Functions, Foreach Function, Text Functions, Functions @section Functions for File Names @cindex functions, for file names @cindex file name functions @@ -5282,11 +5385,11 @@ file names. For example, @example -$(suffix src/foo.c hacks) +$(suffix src/foo.c src-1.0/bar.c hacks) @end example @noindent -produces the result @samp{.c}. +produces the result @samp{.c .c}. @item $(basename @var{names}@dots{}) @findex basename @@ -5294,15 +5397,16 @@ produces the result @samp{.c}. @cindex file name, basename of Extracts all but the suffix of each file name in @var{names}. If the file name contains a period, the basename is everything starting up to -(and not including) the last period. Otherwise, the basename is the -entire file name. For example, +(and not including) the last period. Periods in the directory part are +ignored. If there is no period, the basename is the entire file name. +For example, @example -$(basename src/foo.c hacks) +$(basename src/foo.c src-1.0/bar hacks) @end example @noindent -produces the result @samp{src/foo hacks}. +produces the result @samp{src/foo src-1.0/bar hacks}. @c plural convention with dots (be consistent) @item $(addsuffix @var{suffix},@var{names}@dots{}) @@ -5429,7 +5533,7 @@ that match the pattern. @xref{Wildcards, ,Using Wildcard Characters in File Names}. @end table -@node Foreach Function, Origin Function, Filename Functions, Functions +@node Foreach Function, Origin Function, File Name Functions, Functions @section The @code{foreach} Function @findex foreach @cindex words, iterating over @@ -6197,6 +6301,7 @@ argument, @code{make} runs as many jobs simultaneously as possible. If there is more than one @samp{-j} option, the last one is effective. @xref{Parallel, ,Parallel Execution}, for more information on how commands are run. +Note that this option is ignored on MS-DOS. @item -k @cindex @code{-k} @@ -7355,7 +7460,7 @@ variants that get just the file's directory name or just the file name within the directory. The variant variables' names are formed by appending @samp{D} or @samp{F}, respectively. These variants are semi-obsolete in GNU @code{make} since the functions @code{dir} and -@code{notdir} can be used to get a similar effect (@pxref{Filename +@code{notdir} can be used to get a similar effect (@pxref{File Name Functions, , Functions for File Names}). Note, however, that the @samp{F} variants all omit the trailing slash which always appears in the output of the @code{dir} function. Here is a table of the variants: @@ -8529,43 +8634,43 @@ Sort the words in @var{list} lexicographically, removing duplicates.@* @item $(dir @var{names}@dots{}) Extract the directory part of each file name.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(notdir @var{names}@dots{}) Extract the non-directory part of each file name.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(suffix @var{names}@dots{}) Extract the suffix (the last @samp{.} and following characters) of each file name.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(basename @var{names}@dots{}) Extract the base name (name without suffix) of each file name.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(addsuffix @var{suffix},@var{names}@dots{}) Append @var{suffix} to each word in @var{names}.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(addprefix @var{prefix},@var{names}@dots{}) Prepend @var{prefix} to each word in @var{names}.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(join @var{list1},@var{list2}) Join two parallel lists of words.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(word @var{n},@var{text}) Extract the @var{n}th word (one-origin) of @var{text}.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(words @var{text}) Count the number of words in @var{text}.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(firstword @var{names}@dots{}) Extract the first word of @var{names}.@* -@xref{Filename Functions, ,Functions for File Names}. +@xref{File Name Functions, ,Functions for File Names}. @item $(wildcard @var{pattern}@dots{}) Find file names matching a shell file name pattern (@emph{not} a @@ -8669,6 +8774,12 @@ The name of the system default command interpreter, usually @file{/bin/sh}. You can set @code{SHELL} in the makefile to change the shell used to run commands. @xref{Execution, ,Command Execution}. +@item MAKESHELL + +On MS-DOS only, the name of the command interpreter that is to be used +by @code{make}. This value takes precedence over the value of +@code{SHELL}. @xref{Execution, ,MAKESHELL variable}. + @item MAKE The name with which @code{make} was invoked. @@ -474,7 +474,7 @@ read_makefile (filename, flags) ++p2; if (*p2 == '\0') p2 = NULL; - else if (*p2 == ':') + else if (p2[0] == ':' && p2[1] == '\0') goto check_var; /* We must first check for conditional and `define' directives before @@ -928,7 +928,7 @@ do_define (name, namelen, origin, lineno, infile, filename) (void) define_variable (var, strlen (var), definition, origin, 1); free (definition); freebuffer (&lb); - return lineno; + return (lineno + nlines); } else { @@ -597,34 +597,17 @@ update_file_1 (file, depth) DEBUGPR ("Must remake target `%s'.\n"); - /* It needs to be remade. If it's VPATH and not GPATH, toss the VPATH */ + /* It needs to be remade. If it's VPATH and not reset via GPATH, toss the + VPATH */ if (!streq(file->name, file->hname)) { - char *name = file->name; - - if (gpath_search (&name, NULL)) - { - register struct file *fp = file; - - /* Since we found the file on GPATH, convert it to use the - VPATH filename. */ - while (fp) - { - fp->name = fp->hname; - fp = fp->prev; - } - DEBUGPR (" Using VPATH `%s' due to GPATH.\n"); - } - else + if (debug_flag) { - if (debug_flag) - { - print_spaces (depth); - printf(" Ignoring VPATH name `%s'.\n", file->hname); - fflush(stdout); - } - file->ignore_vpath = 1; + print_spaces (depth); + printf(" Ignoring VPATH name `%s'.\n", file->hname); + fflush(stdout); } + file->ignore_vpath = 1; } /* Now, take appropriate actions to remake the file. */ @@ -1070,6 +1053,17 @@ f_mtime (file, search) /* vpath_search and library_search store zero in MTIME if they didn't need to do a stat call for their work. */ file->last_mtime = mtime; + + /* If we found it in VPATH, see if it's in GPATH too; if so, + change the name right now; if not, defer until after the + dependencies are updated. */ + if (gpath_search (name, strlen(name) - strlen(file->name) - 1)) + { + rename_file (file, name); + check_renamed (file); + return file_mtime (file); + } + rehash_file (file, name); check_renamed (file); mtime = name_mtime (name); @@ -1080,10 +1074,12 @@ f_mtime (file, search) { /* Files can have bogus timestamps that nothing newly made will be "newer" than. Updating their dependents could just result in loops. - So notify the user of the anomaly with a warning. */ + So notify the user of the anomaly with a warning. + + We only need to do this once, for now. */ static time_t now = 0; - if (mtime != -1 && mtime > now && ! file->updated) + if (!clock_skew_detected && mtime != -1 && mtime > now && ! file->updated) { /* This file's time appears to be in the future. Update our concept of the present, and compare again. */ @@ -1096,9 +1092,21 @@ f_mtime (file, search) extern time_t time (); time (&now); #endif - if (mtime > now) - error ("*** Warning: File `%s' has modification time in the future", - file->name); +#ifdef WINDOWS32 + /* + * FAT filesystems round time to nearest even second(!). Just + * allow for any file (NTFS or FAT) to perhaps suffer from this + * braindamage. + */ + if (mtime > now && (((mtime % 2) == 0) && ((mtime-1) > now))) +#else + if (mtime > now) +#endif + { + error("*** Warning: File `%s' has modification time in the future", + file->name); + clock_skew_detected = 1; + } } } @@ -333,8 +333,6 @@ merge_variable_set_lists (setlist0, setlist1) merge_variable_sets (list0->set, next->set); - free ((char *) next); - last0 = list0; list0 = list0->next; } @@ -1,4 +1,9 @@ -char *version_string = "3.75.1"; +/* We use <config.h> instead of "config.h" so that a compilation + using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h + (which it would do because make.h was found in $srcdir). */ +#include <config.h> + +char *version_string = VERSION; /* Local variables: @@ -310,19 +310,20 @@ construct_vpath_list (pattern, dirpath) } } -/* Search the GPATH list for a directory where the name pointed to by FILE - exists. If it is found, we set *FILE to the newly malloc'd name of the - existing file, *MTIME_PTR (if MTIME_PTR is not NULL) to its modtime (or - zero if no stat call was done), and return 1. Otherwise we return 0. */ +/* Search the GPATH list for a pathname string that matches the one passed + in. If it is found, return 1. Otherwise we return 0. */ int -gpath_search (file, mtime_ptr) - char **file; - time_t *mtime_ptr; +gpath_search (file, len) + char *file; + int len; { - if (gpaths != 0 - && selective_vpath_search (gpaths, file, mtime_ptr)) - return 1; + register char **gp; + + if (gpaths && (len <= gpaths->maxlen)) + for (gp = gpaths->searchpath; *gp != NULL; ++gp) + if (!strncmp(*gp, file, len) && (*gp)[len] == '\0') + return 1; return 0; } |