Compare commits

...

41 Commits

Author SHA1 Message Date
Roland McGrath
2cbfa1024a (variable_expand): Fix braino in last change. 1995-01-15 16:33:35 +00:00
Roland McGrath
258dad0f9a Fix nits in last change. 1995-01-15 16:32:10 +00:00
Roland McGrath
37358a9a82 (start_job_command): Save and restore environ around vfork call.
(search_path): Function #if 0'd out.
(exec_command): Use execvp instead of search_path.
1995-01-15 15:57:48 +00:00
Roland McGrath
e167e0a3c2 (variable_expand): Rewrote computed variable name and substitution
reference handling to be simpler.  First expand the entire text between the
parens if it contains any $s, then examine the result of that for
subtitution references and do no further expansion while parsing them.
1995-01-15 15:32:37 +00:00
Roland McGrath
7879457545 (construct_command_argv_internal): Handle " quoting too, when no
backslash, $ or ` characters appear inside the quotes.
1995-01-15 13:43:48 +00:00
Roland McGrath
d525f4dd72 (union wait check): If WEXITSTATUS and WTERMSIG are defined, just use int. 1995-01-15 13:23:03 +00:00
Roland McGrath
bd19554ea7 (Foreach Function): Correccion de gramatica espanola. 1995-01-13 06:30:39 +00:00
Roland McGrath
fffc384bfc (default_variables) [__hpux]: Remove special definition of ARFLAGS.
Existence of the `f' flag is not consistent across HPUX versions;
and one might be using GNU ar anyway.
1995-01-11 00:14:53 +00:00
Roland McGrath
afd1d69e7d (clean): Don't remove Info files. 1995-01-10 11:30:56 +00:00
Roland McGrath
c1305a1a18 ($(bindir)/make): Fix typo in echo. 1995-01-10 11:29:08 +00:00
Roland McGrath
43d5fbfc88 Fix typo in comment. 1995-01-10 11:28:12 +00:00
Roland McGrath
a4642a6a57 (check): Remove gratuitous target declaration. 1995-01-10 11:27:24 +00:00
Roland McGrath
11ca7f1ead (ETAGS, CTAGS): Don't use -t. 1995-01-07 16:59:15 +00:00
Roland McGrath
4aa992616f Include config.h first. 1995-01-07 16:57:36 +00:00
Roland McGrath
ab0fb2fa6f (ar_name_equal) [cray]: Subtract 1 like [__hpux]. 1995-01-07 16:55:30 +00:00
Roland McGrath
e1dd3bfa4a (decode_switches): For --help, print usage to stdout. 1995-01-07 16:38:08 +00:00
Richard M. Stallman
86238ec9d3 install, uninstall, installdirs should not alter the build dir. 1995-01-04 19:37:36 +00:00
Roland McGrath
2e9779fdb4 (update_file_1): Do set_command_state (FILE, cs_not_started) only if old
state was deps_running.
1994-12-05 17:42:13 +00:00
Roland McGrath
b61a13463d (start_waiting_job): Use set_command_state. 1994-11-29 01:10:47 +00:00
Roland McGrath
d3b9c35c8f (CPPFLAGS): New variable.
(prefix, exec_prefix): Set from @...@.
(compilation loop): Pass $CPPFLAGS to compiler.
1994-11-28 23:06:28 +00:00
Roland McGrath
c50b75b439 (build.sh.in): Make it executable. 1994-11-28 23:02:42 +00:00
Roland McGrath
7376280c33 (globfiles): Add configure.in, configure. 1994-11-28 22:02:23 +00:00
Roland McGrath
3c767901f6 (make-$(version).tar): Rename install.sh to install-sh. 1994-11-28 20:54:38 +00:00
Roland McGrath
c6dfff5f1b (prefix, exec_prefix): Set.
(CPPFLAGS): Filter out @...@.
($(ARCH)/glob/libglob.a): Don't pass down variables.
1994-11-28 20:51:40 +00:00
Roland McGrath
74540a1e91 Abbreviate copyright years. 1994-11-28 20:50:45 +00:00
Roland McGrath
5159db0aa4 (AC_OUTPUT): Don't write glob/Makefile. 1994-11-28 20:48:43 +00:00
Roland McGrath
e495d2380d (AC_CHECK_SYMBOL): Use AC_DEFINE_UNQUOTED. 1994-11-28 20:28:26 +00:00
Roland McGrath
1ed34a0118 Don't check for ranlib. 1994-11-28 20:20:43 +00:00
Roland McGrath
e8f64b2c88 (notice_finished_file): Only mark also_make's as updated if really ran
cmds.
1994-11-23 03:42:34 +00:00
Roland McGrath
4867409da2 Put dnls before random whitespace. 1994-11-15 11:32:39 +00:00
Roland McGrath
f801fc3521 (CPPFLAGS): New variable, set from @CPPFLAGS@.
(RANLIB): Variable removed.
(prefix, exec_prefix): Set these from @...@.
(.c.o): Use $(CPPFLAGS).
(glob/libglob.a): Don't pass down variables to sub-make.
glob/Makefile should be configured properly by configure.
(distclean): Remove config.log and config.cache (autoconf stuff).
1994-11-13 10:02:19 +00:00
David J. MacKenzie
b2c0446e71 Explain reason for new filesystem layout. 1994-11-11 04:33:24 +00:00
Roland McGrath
8f98ceb724 Add #undef HAVE_UNION_WAIT. 1994-11-08 02:09:49 +00:00
Roland McGrath
dea9990bc8 Converted to Autoconf v2. 1994-11-08 02:08:24 +00:00
Roland McGrath
e4c43aab3e Test HAVE_DIRENT_H, HAVE_SYS_DIR_H, HAVE_NDIR_H instead of DIRENT, SYSDIR,
NDIR.
1994-11-08 00:14:50 +00:00
Roland McGrath
e55ed78080 (prefix, exec_prefix): Set these from @...@.
(CPPFLAGS): New variable, set from @CPPFLAGS@.
(compiling loop): Pass $CPPFLAGS before $CFLAGS.
1994-11-07 23:42:58 +00:00
Roland McGrath
ca54a0b991 Initial revision 1994-11-07 23:40:44 +00:00
Roland McGrath
e25e2fb7f5 (define_makeflags): When no flags, set WORDS to zero. 1994-11-07 18:57:56 +00:00
Roland McGrath
1a886b6359 (define_makeflags): Terminate properly when FLAGSTRING is empty. 1994-11-06 23:33:55 +00:00
Roland McGrath
b511712f25 (rcs-mark-{alpha,beta}): Let make do the globbing instead of sh. 1994-11-04 21:08:52 +00:00
Roland McGrath
30fcca501f Remove `DRAFT' from edition. 1994-11-04 20:23:23 +00:00
16 changed files with 384 additions and 292 deletions

View File

@@ -45,6 +45,8 @@ include compatMakefile
MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES) MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES)
# Remove autoconf magic. # Remove autoconf magic.
prefix = /usr/local
exec_prefix = $(prefix)
extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o
LOADLIBES := $(filter-out @%@,$(LOADLIBES)) LOADLIBES := $(filter-out @%@,$(LOADLIBES))
ALLOCA := $(filter-out @%@,$(ALLOCA)) ALLOCA := $(filter-out @%@,$(ALLOCA))
@@ -86,7 +88,7 @@ GLOB =
else else
CPPFLAGS := $(CPPFLAGS) -Iglob CPPFLAGS := $(filter-out @%@,$(CPPFLAGS)) -Iglob
endif # works-for-make endif # works-for-make
endif # $(libc_dir) endif # $(libc_dir)
@@ -96,9 +98,7 @@ endif # !no_libc
$(ARCH)/%.o: %.c $(ARCH)/%.o: %.c
$(COMPILE.c) -Iglob $< $(OUTPUT_OPTION) $(COMPILE.c) -Iglob $< $(OUTPUT_OPTION)
$(ARCH)/glob/libglob.a: FORCE $(ARCH)/glob/libglob.a: FORCE
$(MAKE) -C $(@D) $(@F) \ $(MAKE) -C $(@D) $(@F)
CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \
CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H'
FORCE: FORCE:
objs := $(addprefix $(ARCH)/,$(objs)) objs := $(addprefix $(ARCH)/,$(objs))
prog := $(ARCH)/make prog := $(ARCH)/make
@@ -147,7 +147,7 @@ $(prog): $(objs) $(globdep) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o)
$(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new $(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new
mv -f $@.new $@ mv -f $@.new $@
globfiles = $(addprefix glob/,COPYING.LIB Makefile.in \ globfiles = $(addprefix glob/,COPYING.LIB configure.in configure Makefile.in \
glob.c fnmatch.c glob.h fnmatch.h) glob.c fnmatch.c glob.h fnmatch.h)
$(globfiles): stamp-glob ; $(globfiles): stamp-glob ;
stamp-glob: /home/gd/gnu/libc/posix/glob.tar stamp-glob: /home/gd/gnu/libc/posix/glob.tar
@@ -197,6 +197,7 @@ build.sh.in: build.template compatMakefile
$(patsubst $(archpfx)%,%,$(objs)))\ $(patsubst $(archpfx)%,%,$(objs)))\
$(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \ $(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
$< > $@.new $< > $@.new
chmod a+x $@.new
mv -f $@.new $@ mv -f $@.new $@
# Make the distribution tar files. # Make the distribution tar files.
@@ -218,8 +219,8 @@ dist-flavor = alpha
endif endif
.PHONY: rcs-mark rcs-mark-alpha rcs-mark-beta .PHONY: rcs-mark rcs-mark-alpha rcs-mark-beta
rcs-mark: rcs-mark-$(dist-flavor) rcs-mark: rcs-mark-$(dist-flavor)
rcs-mark-alpha:;rcs -sAlpha -Nmake-$(version-): RCS/[!=]*,v rcs-mark-alpha: RCS/[!=]*,v;rcs -sAlpha -Nmake-$(version-): $^
rcs-mark-beta:;rcs -sBeta -Nmake-$(version-): RCS/[!=]*,v rcs-mark-beta: RCS/[!=]*,v;rcs -sBeta -Nmake-$(version-): $^
version- = $(subst .,-,$(version)) version- = $(subst .,-,$(version))
dist: local-inst dist: local-inst
@@ -262,7 +263,7 @@ make-$(version).tar: README INSTALL COPYING ChangeLog NEWS \
acconfig.h $(srcs) remote-*.c $(globfiles) \ acconfig.h $(srcs) remote-*.c $(globfiles) \
make.texinfo make-stds.texi \ make.texinfo make-stds.texi \
make.?? make.??s make.toc make.aux make.man texinfo.tex TAGS tags \ make.?? make.??s make.toc make.aux make.man texinfo.tex TAGS tags \
install.sh \ install-sh \
make.info make.info* make.info make.info*
$(make-tar) $(make-tar)

View File

@@ -9,3 +9,6 @@
/* Define this if the C library defines the variable `_sys_siglist'. */ /* Define this if the C library defines the variable `_sys_siglist'. */
#undef HAVE__SYS_SIGLIST #undef HAVE__SYS_SIGLIST
/* Define this if you have the `union wait' type in <sys/wait.h>. */
#undef HAVE_UNION_WAIT

View File

@@ -429,11 +429,11 @@ ar_name_equal (name, mem, truncated)
struct ar_hdr hdr; struct ar_hdr hdr;
return !strncmp (name, mem, return !strncmp (name, mem,
sizeof (hdr.ar_name) - sizeof (hdr.ar_name) -
#ifndef __hpux #if !defined (__hpux) && !defined (cray)
1 1
#else #else
2 2
#endif /* __hpux */ #endif /* !__hpux && !cray */
); );
#endif #endif
} }

69
build.sh.in Normal file
View File

@@ -0,0 +1,69 @@
#!/bin/sh
# Shell script to build GNU Make in the absence of any `make' program.
# 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)
# any later version.
#
# 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.
#
# 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.
# See Makefile.in for comments describing these variables.
srcdir='@srcdir@'
CC='@CC@'
CFLAGS='@CFLAGS@'
CPPFLAGS='@CPPFLAGS@'
LDFLAGS='@LDFLAGS@'
defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
ALLOCA='@ALLOCA@'
LOADLIBES='@LIBS@'
extras='@LIBOBJS@'
REMOTE='@REMOTE@'
# Common prefix for machine-independent installed files.
prefix=@prefix@
# Common prefix for machine-dependent installed files.
exec_prefix=@exec_prefix@
# Directory to find libraries in for `-lLIB'.
libdir=${exec_prefix}/lib
# Directory to search by default for included makefiles.
includedir=${prefix}/include
# Exit as soon as any command fails.
set -e
# These are all the objects we need to link together.
objs="commands.o job.o dir.o file.o misc.o main.o read.o remake.o rule.o implicit.o default.o variable.o expand.o function.o vpath.o version.o ar.o arscan.o signame.o getopt.o getopt1.o glob/glob.o glob/fnmatch.o remote-${REMOTE}.o ${extras} ${ALLOCA}"
# Compile the source files into those objects.
for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
echo compiling ${file}...
$CC $CPPFLAGS $CFLAGS $defines -c \
-I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file
done
# The object files were actually all put in the current directory.
# Remove the source directory names from the list.
srcobjs="$objs"
objs=
for obj in $srcobjs; do
objs="$objs `basename $obj`"
done
# Link all the objects together.
echo linking make...
$CC $LDFLAGS $objs $LOADLIBES -o make.new
echo done
mv -f make.new make

View File

@@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# Shell script to build GNU Make in the absence of any `make' program. # Shell script to build GNU Make in the absence of any `make' program.
# @configure_input@
# Copyright (C) 1993 Free Software Foundation, Inc. # Copyright (C) 1993, 1994 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify # GNU Make is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
srcdir='@srcdir@' srcdir='@srcdir@'
CC='@CC@' CC='@CC@'
CFLAGS='@CFLAGS@' CFLAGS='@CFLAGS@'
CPPFLAGS='@CPPFLAGS@'
LDFLAGS='@LDFLAGS@' LDFLAGS='@LDFLAGS@'
defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"' defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
ALLOCA='@ALLOCA@' ALLOCA='@ALLOCA@'
@@ -32,9 +33,9 @@ extras='@LIBOBJS@'
REMOTE='@REMOTE@' REMOTE='@REMOTE@'
# Common prefix for machine-independent installed files. # Common prefix for machine-independent installed files.
prefix=/usr/local prefix='@prefix@'
# Common prefix for machine-dependent installed files. # Common prefix for machine-dependent installed files.
exec_prefix=/usr/local exec_prefix='@exec_prefix@'
# Directory to find libraries in for `-lXXX'. # Directory to find libraries in for `-lXXX'.
libdir=${exec_prefix}/lib libdir=${exec_prefix}/lib
# Directory to search by default for included makefiles. # Directory to search by default for included makefiles.
@@ -49,7 +50,8 @@ objs="%objs% remote-${REMOTE}.o ${extras} ${ALLOCA}"
# Compile the source files into those objects. # Compile the source files into those objects.
for file in `echo ${objs} | sed 's/\.o/.c/g'`; do for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
echo compiling ${file}... echo compiling ${file}...
$CC $CFLAGS $defines -c -I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file $CC $defines $CPPFLAGS $CFLAGS \
-c -I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file
done done
# The object files were actually all put in the current directory. # The object files were actually all put in the current directory.

View File

@@ -1,7 +1,7 @@
# NOTE: If you have no `make' program at all to process this makefile, run # NOTE: If you have no `make' program at all to process this makefile, run
# `build.sh' instead. # `build.sh' instead.
# #
# Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. # Copyright (C) 1988, 89, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify # GNU Make is free software; you can redistribute it and/or modify
@@ -30,11 +30,9 @@ srcdir = @srcdir@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
# How to invoke ranlib. This is only used by the `glob' subdirectory.
RANLIB = @RANLIB@
# Define these for your system as follows: # Define these for your system as follows:
# -DNO_ARCHIVES To disable `ar' archive support. # -DNO_ARCHIVES To disable `ar' archive support.
# -DNO_FLOAT To avoid using floating-point numbers. # -DNO_FLOAT To avoid using floating-point numbers.
@@ -77,9 +75,9 @@ LOADLIBES = @LIBS@
extras = @LIBOBJS@ extras = @LIBOBJS@
# Common prefix for machine-independent installed files. # Common prefix for machine-independent installed files.
prefix = /usr/local prefix = @prefix@
# Common prefix for machine-dependent installed files. # Common prefix for machine-dependent installed files.
exec_prefix = $(prefix) exec_prefix = @exec_prefix@
# Directory to install `make' in. # Directory to install `make' in.
bindir = $(exec_prefix)/bin bindir = $(exec_prefix)/bin
@@ -119,8 +117,8 @@ MAKEINFO = makeinfo
TEXI2DVI = texi2dvi TEXI2DVI = texi2dvi
# Programs to make tags files. # Programs to make tags files.
ETAGS = etags -tw ETAGS = etags -w
CTAGS = ctags -tw CTAGS = ctags -w
objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \ objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
rule.o implicit.o default.o variable.o expand.o function.o \ rule.o implicit.o default.o variable.o expand.o function.o \
@@ -144,10 +142,9 @@ srcs = $(srcdir)/commands.c $(srcdir)/job.c $(srcdir)/dir.c \
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo .SUFFIXES: .o .c .h .ps .dvi .info .texinfo
all: make all: make
check: # No tests.
info: make.info info: make.info
dvi: make.dvi dvi: make.dvi
# Some makes apparently use .PHONY as the default goal is it is before `all'. # Some makes apparently use .PHONY as the default goal if it is before `all'.
.PHONY: all check info dvi .PHONY: all check info dvi
make.info: make.texinfo make.info: make.texinfo
@@ -166,17 +163,14 @@ make: $(objs)
# -I. is needed to find config.h in the build directory. # -I. is needed to find config.h in the build directory.
.c.o: .c.o:
$(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \ $(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \
$(CFLAGS) $< $(OUTPUT_OPTION) $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
# For some losing Unix makes. # For some losing Unix makes.
SHELL = /bin/sh SHELL = /bin/sh
MAKE = make MAKE = make
glob/libglob.a: FORCE config.h glob/libglob.a: FORCE config.h
cd glob; $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \ cd glob; $(MAKE) libglob.a
CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H' \
RANLIB='$(RANLIB)' \
libglob.a
FORCE: FORCE:
tagsrcs = $(srcs) $(srcdir)/remote-*.c tagsrcs = $(srcs) $(srcdir)/remote-*.c
@@ -201,7 +195,7 @@ $(bindir)/$(binprefix)make: make
else \ else \
echo "$@ needs to be owned by group $(group) and setgid;"; \ echo "$@ needs to be owned by group $(group) and setgid;"; \
echo "otherwise the \`-l' option will probably not work."; \ echo "otherwise the \`-l' option will probably not work."; \
echo "You may need special priveleges to install $@."; \ echo "You may need special privileges to install $@."; \
fi; \ fi; \
else true; fi else true; fi
# Some systems can't deal with renaming onto a running binary. # Some systems can't deal with renaming onto a running binary.
@@ -247,9 +241,10 @@ check: check-loadavg
.PHONY: clean realclean distclean mostlyclean .PHONY: clean realclean distclean mostlyclean
clean: glob-clean clean: glob-clean
-rm -f make loadavg *.o core make.info* make.dvi -rm -f make loadavg *.o core make.dvi
distclean: clean glob-realclean distclean: clean glob-realclean
-rm -f Makefile config.h config.status build.sh stamp-config -rm -f Makefile config.h config.status build.sh stamp-config
-rm -f config.log config.cache
-rm -f TAGS tags -rm -f TAGS tags
-rm -f make.?? make.??s make.log make.toc make.*aux -rm -f make.?? make.??s make.log make.toc make.*aux
-rm -f loadavg.c -rm -f loadavg.c

View File

@@ -1,52 +1,64 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_REVISION([$Id$]) AC_REVISION([$Id$])
AC_INIT(vpath.c) dnl A distinctive file to look for in srcdir. AC_PREREQ(2.1)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_HEADER(config.h)
AC_CONFIG_SUBDIRS(glob) dnl Run configure in glob subdirectory.
# We want these before the checks, so the checks can modify their values. # We want these before the checks, so the checks can modify their values.
test -z "$CFLAGS" && CFLAGS=-g AC_SUBST(CFLAGS) test -z "$CFLAGS" && CFLAGS=-g AC_SUBST(CFLAGS)
test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS) test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)
AC_SET_MAKE AC_PROG_MAKE_SET
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_CPP dnl Later checks need this. AC_PROG_CPP dnl Later checks need this.
AC_AIX AC_AIX
AC_ISC_POSIX AC_ISC_POSIX
AC_MINIX AC_MINIX
AC_STDC_HEADERS AC_HEADER_STDC
AC_DIR_HEADER AC_HEADER_DIRENT
AC_UID_T dnl Also does gid_t. AC_TYPE_UID_T dnl Also does gid_t.
AC_GETGROUPS_T AC_TYPE_GETGROUPS
AC_PID_T AC_TYPE_PID_T
AC_RETSIGTYPE AC_TYPE_SIGNAL
AC_HAVE_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \ AC_CHECK_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
sys/timeb.h) sys/timeb.h)
AC_MINUS_C_MINUS_O AC_PROG_CC_C_O
AC_CONST dnl getopt needs this. AC_C_CONST dnl getopt needs this.
AC_STAT_MACROS_BROKEN AC_HEADER_STAT
AC_SUBST(LIBOBJS) AC_SUBST(LIBOBJS)
AC_HAVE_FUNCS(getdtablesize psignal \ AC_DEFUN(AC_CHECK_SYMBOL, [dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
AC_TRY_LINK(, [extern char *sys_siglist[]; puts(*sys_siglist);],
ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
if test "$ac_cv_check_symbol_$1" = yes; then
changequote(,)dnl
ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
changequote([,])dnl
AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
fi
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
AC_CHECK_FUNCS(getdtablesize psignal \
dup2 getcwd sigsetmask getgroups setlinebuf \ dup2 getcwd sigsetmask getgroups setlinebuf \
seteuid setegid setreuid setregid strerror) seteuid setegid setreuid setregid strerror)
AC_COMPILE_CHECK(sys_siglist, , AC_CHECK_SYMBOL(sys_siglist)
[extern char *sys_siglist[]; puts(*sys_siglist);], AC_CHECK_SYMBOL(_sys_siglist)
AC_DEFINE(HAVE_SYS_SIGLIST)) AC_FUNC_ALLOCA
AC_COMPILE_CHECK(_sys_siglist, , AC_FUNC_VFORK
[extern char *_sys_siglist[]; puts(*_sys_siglist);], AC_FUNC_SETVBUF_REVERSED
AC_DEFINE(HAVE__SYS_SIGLIST)) AC_FUNC_GETLOADAVG
AC_ALLOCA AC_FUNC_STRCOLL
AC_VFORK
AC_SETVBUF_REVERSED
AC_GETLOADAVG
AC_STRCOLL
dnl Check out the wait reality. # Check out the wait reality.
AC_HAVE_HEADERS(sys/wait.h) AC_HAVE_FUNCS(waitpid wait3) AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_FUNCS(waitpid wait3)
AC_COMPILE_CHECK(union wait, [#include <sys/types.h> AC_MSG_CHECKING(for union wait)
AC_CACHE_VAL(make_cv_union_wait, [dnl
AC_TRY_LINK([#include <sys/types.h>
#include <sys/wait.h>], #include <sys/wait.h>],
[union wait status; int pid; pid = wait (&status); [union wait status; int pid; pid = wait (&status);
#ifdef WEXITSTATUS #ifdef WEXITSTATUS
@@ -54,25 +66,31 @@ AC_COMPILE_CHECK(union wait, [#include <sys/types.h>
union wait type, and they do not work together. If union wait union wait type, and they do not work together. If union wait
conflicts with WEXITSTATUS et al, we don't want to use it at all. */ conflicts with WEXITSTATUS et al, we don't want to use it at all. */
if (WEXITSTATUS (status) != 0) pid = -1; if (WEXITSTATUS (status) != 0) pid = -1;
#ifdef WTERMSIG
/* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
-- blow chunks here --
#endif
#endif #endif
#ifdef HAVE_WAITPID #ifdef HAVE_WAITPID
/* Make sure union wait works with waitpid. */ /* Make sure union wait works with waitpid. */
pid = waitpid (-1, &status, 0); pid = waitpid (-1, &status, 0);
#endif #endif
], ],
AC_DEFINE(HAVE_UNION_WAIT)) [make_cv_union_wait=yes], [make_cv_union_wait=no])])
if test "$make_cv_union_wait" = yes; then
AC_DEFINE(HAVE_UNION_WAIT)
fi
AC_MSG_RESULT($make_cv_union_wait)
AC_SYS_SIGLIST_DECLARED AC_DECL_SYS_SIGLIST
# The presence of the following is not meant to imply # The presence of the following is not meant to imply
# that make necessarily works on those systems. # that make necessarily works on those systems.
AC_DYNIX_SEQ AC_CHECK_LIB(sun, getpwnam)
AC_XENIX_DIR
AC_IRIX_SUN
AC_SUBST(REMOTE) REMOTE=stub AC_SUBST(REMOTE) REMOTE=stub
AC_WITH(customs, [REMOTE=cstms AC_ARG_WITH(customs, [export jobs with the Customs daemon (NOT SUPPORTED)],
LIBS="$LIBS libcustoms.a"]) [REMOTE=cstms LIBS="$LIBS libcustoms.a"])
echo checking for location of SCCS get command echo checking for location of SCCS get command
if test -f /usr/sccs/get; then if test -f /usr/sccs/get; then
@@ -94,7 +112,7 @@ if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
fi fi
rm -f s.conftest conftoast rm -f s.conftest conftoast
AC_OUTPUT(Makefile build.sh glob/Makefile, [ AC_OUTPUT(Makefile build.sh, [
# Makefile uses this timestamp file to know when to remake Makefile, # Makefile uses this timestamp file to know when to remake Makefile,
# build.sh, and glob/Makefile. # build.sh, and glob/Makefile.
touch stamp-config]) touch stamp-config])

View File

@@ -1,5 +1,5 @@
/* Data base of default implicit rules for GNU Make. /* Data base of default implicit rules for GNU Make.
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc. Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify GNU Make is free software; you can redistribute it and/or modify
@@ -209,13 +209,7 @@ static char *default_suffix_rules[] =
static char *default_variables[] = static char *default_variables[] =
{ {
"AR", "ar", "AR", "ar",
#ifndef __hpux
"ARFLAGS", "rv", "ARFLAGS", "rv",
#else
/* HPUX ar's f flag says to truncate the file names to archive member
name length in comparisons, so replacement notices the equality. */
"ARFLAGS", "rfv",
#endif
"AS", "as", "AS", "as",
#ifdef GCC_IS_NATIVE #ifdef GCC_IS_NATIVE
"CC", "gcc", "CC", "gcc",

18
dir.c
View File

@@ -18,26 +18,26 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "make.h" #include "make.h"
#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__) #if defined (POSIX) || defined (HAVE_DIRENT_H) || defined (__GNU_LIBRARY__)
#include <dirent.h> #include <dirent.h>
#ifndef __GNU_LIBRARY__ #ifndef __GNU_LIBRARY__
#define D_NAMLEN(d) strlen((d)->d_name) #define D_NAMLEN(d) strlen((d)->d_name)
#else /* GNU C library. */ #else /* GNU C library. */
#define D_NAMLEN(d) ((d)->d_namlen) #define D_NAMLEN(d) ((d)->d_namlen)
#endif /* Not GNU C library. */ #endif /* Not GNU C library. */
#else /* Not POSIX or DIRENT. */ #else /* Not POSIX or HAVE_DIRENT_H. */
#define direct dirent #define direct dirent
#define D_NAMLEN(d) ((d)->d_namlen) #define D_NAMLEN(d) ((d)->d_namlen)
#ifdef SYSNDIR #ifdef HAVE_SYS_NDIR_H
#include <sys/ndir.h> #include <sys/ndir.h>
#endif /* SYSNDIR */ #endif /* HAVE_SYS_NDIR_H */
#ifdef SYSDIR #ifdef HAVE_SYS_DIR_H
#include <sys/dir.h> #include <sys/dir.h>
#endif /* SYSDIR */ #endif /* HAVE_SYS_DIR_H */
#ifdef NDIR #ifdef HAVE_NDIR_H
#include <ndir.h> #include <ndir.h>
#endif /* NDIR */ #endif /* HAVE_NDIR_H */
#endif /* POSIX or DIRENT or __GNU_LIBRARY__. */ #endif /* POSIX or HAVE_DIRENT_H or __GNU_LIBRARY__. */
#if defined (POSIX) && !defined (__GNU_LIBRARY__) #if defined (POSIX) && !defined (__GNU_LIBRARY__)
/* Posix does not require that the d_ino field be present, and some /* Posix does not require that the d_ino field be present, and some

246
expand.c
View File

@@ -1,5 +1,5 @@
/* Variable expansion functions for GNU Make. /* Variable expansion functions for GNU Make.
Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. Copyright (C) 1988, 89, 91, 92, 93, 95 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify GNU Make is free software; you can redistribute it and/or modify
@@ -197,9 +197,9 @@ variable_expand (line)
char openparen = *p; char openparen = *p;
char closeparen = (openparen == '(') ? ')' : '}'; char closeparen = (openparen == '(') ? ')' : '}';
register char *beg = p + 1; register char *beg = p + 1;
int free_beg = 0;
char *op, *begp; char *op, *begp;
char *end; char *end, *colon;
char *colon = 0;
op = o; op = o;
begp = p; begp = p;
@@ -213,132 +213,6 @@ variable_expand (line)
/* Is there a variable reference inside the parens or braces? /* Is there a variable reference inside the parens or braces?
If so, expand it before expanding the entire reference. */ If so, expand it before expanding the entire reference. */
p1 = index (beg, closeparen);
if (p1 != 0)
p1 = lindex (beg, p1, '$');
if (p1 != 0 && lindex (beg, p1, ':') == 0)
{
/* BEG now points past the opening paren or brace.
Count parens or braces until it is matched. */
int count = 0;
for (p = beg; *p != '\0'; ++p)
{
if (*p == openparen)
++count;
else if (*p == closeparen && --count < 0)
break;
else if (colon == 0 && count == 0 && *p == ':')
/* Record where we found a colon, which
indicates a substitution reference.
We want to expand the text before the
reference only. */
colon = p;
}
/* If COUNT is >= 0, there were unmatched opening parens
or braces, so we go to the simple case of a variable name
such as `$($(a)'. */
if (count < 0)
{
char *name = expand_argument (beg, colon == 0 ? p : colon);
unsigned int namelen = strlen (name);
if (colon == 0)
{
/* This is a simple reference to the expanded name. */
o = reference_variable (o, name, namelen);
free (name);
break;
}
else
{
/* This is a substitution reference to the expanded
name. We replace the pending text with a copy
containing the expanded name in place of the
original name, and then fall through to
the normal substitution reference code below. */
unsigned int restlen = strlen (colon) + 1;
beg = (char *) alloca (namelen + restlen);
bcopy (name, beg, namelen);
bcopy (colon, &beg[namelen], restlen);
/* Point COLON into the new copy. */
colon = &beg[namelen];
}
}
}
/* This is not a reference to a built-in function and
it does not contain any variable references inside.
There are several things it could be. */
if (colon == 0)
colon = index (beg, ':');
if (colon != 0 && lindex (beg, colon, closeparen) == 0)
{
/* This is a substitution reference: $(FOO:A=B). */
int count;
char *subst_beg, *subst_end, *replace_beg, *replace_end;
v = lookup_variable (beg, colon - beg);
if (v == 0)
warn_undefined (beg, colon - beg);
subst_beg = colon + 1;
count = 0;
for (p = subst_beg; *p != '\0'; ++p)
{
if (*p == openparen)
++count;
else if (*p == closeparen)
--count;
else if (*p == '=' && count <= 0)
break;
}
if (count > 0)
/* There were unmatched opening parens. */
return initialize_variable_output ();
subst_end = p;
replace_beg = p + 1;
count = 0;
for (p = replace_beg; *p != '\0'; ++p)
{
if (*p == openparen)
++count;
else if (*p == closeparen && --count < 0)
break;
}
if (count > 0)
/* There were unmatched opening parens. */
return initialize_variable_output ();
end = p;
replace_end = p;
p = expand_argument (subst_beg, subst_end);
p1 = expand_argument (replace_beg, replace_end);
if (v != 0 && *v->value != '\0')
{
char *value = (v->recursive ? recursively_expand (v)
: v->value);
char *percent = find_percent (p);
if (percent != 0)
o = patsubst_expand (o, value, p, p1,
percent, (char *) 0);
else
o = subst_expand (o, value,
p, p1, strlen (p), strlen (p1),
0, 1);
if (v->recursive)
free (value);
}
free (p);
free (p1);
}
/* No, this must be an ordinary variable reference. */
else
{
/* Look up the value of the variable. */
end = index (beg, closeparen); end = index (beg, closeparen);
if (end == 0) if (end == 0)
{ {
@@ -349,11 +223,119 @@ variable_expand (line)
else else
fatal ("unterminated variable reference"); fatal ("unterminated variable reference");
} }
o = reference_variable (o, beg, end - beg); p1 = lindex (beg, end, '$');
if (p1 != 0)
{
/* BEG now points past the opening paren or brace.
Count parens or braces until it is matched. */
int count = 0;
for (p = beg; *p != '\0'; ++p)
{
if (*p == openparen)
++count;
else if (*p == closeparen && --count < 0)
break;
}
/* If COUNT is >= 0, there were unmatched opening parens
or braces, so we go to the simple case of a variable name
such as `$($(a)'. */
if (count < 0)
{
beg = expand_argument (beg, p); /* Expand the name. */
free_beg = 1; /* Remember to free BEG when finished. */
end = index (beg, '\0');
}
}
else
/* Advance P to the end of this reference. After we are
finished expanding this one, P will be incremented to
continue the scan. */
p = end;
/* This is not a reference to a built-in function and
any variable references inside are now expanded.
Is the resultant text a substitution reference? */
colon = lindex (beg, end, ':');
if (colon != 0)
{
/* This looks like a substitution reference: $(FOO:A=B). */
char *subst_beg, *subst_end, *replace_beg, *replace_end;
subst_beg = colon + 1;
subst_end = index (subst_beg, '=');
if (subst_end == 0)
/* There is no = in sight. Punt on the substitution
reference and treat this as a variable name containing
a colon, in the code below. */
colon = 0;
else
{
replace_beg = subst_end + 1;
replace_end = end;
/* Extract the variable name before the colon
and look up that variable. */
v = lookup_variable (beg, colon - beg);
if (v == 0)
warn_undefined (beg, colon - beg);
if (v != 0 && *v->value != '\0')
{
char *value = (v->recursive ? recursively_expand (v)
: v->value);
char *pattern, *percent;
if (free_beg)
{
*subst_end = '\0';
pattern = subst_beg;
}
else
{
pattern = alloca (subst_end - subst_beg + 1);
bcopy (subst_beg, pattern, subst_end - subst_beg);
pattern[subst_end - subst_beg] = '\0';
}
percent = find_percent (pattern);
if (percent != 0)
{
char *replace;
if (free_beg)
{
*replace_end = '\0';
replace = replace_beg;
}
else
{
replace = alloca (replace_end - replace_beg
+ 1);
bcopy (replace_beg, replace,
replace_end - replace_beg);
replace[replace_end - replace_beg] = '\0';
} }
/* Advance p past the variable reference to resume scan. */ o = patsubst_expand (o, value, pattern, replace,
p = end; percent, (char *) 0);
}
else
o = subst_expand (o, value,
pattern, replace_beg,
strlen (pattern),
end - replace_beg,
0, 1);
if (v->recursive)
free (value);
}
}
}
if (colon == 0)
/* This is an ordinary variable reference.
Look up the value of the variable. */
o = reference_variable (o, beg, end - beg);
if (free_beg)
free (beg);
} }
break; break;

View File

@@ -1,5 +1,5 @@
/* Get the system load averages. /* Get the system load averages.
Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994 Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994, 1995
Free Software Foundation, Inc. Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -59,6 +59,11 @@
We also #define LDAV_PRIVILEGED if a program will require We also #define LDAV_PRIVILEGED if a program will require
special installation to be able to call getloadavg. */ special installation to be able to call getloadavg. */
/* This should always be first. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/types.h> #include <sys/types.h>
/* Both the Emacs and non-Emacs sections want this. Some /* Both the Emacs and non-Emacs sections want this. Some
@@ -69,10 +74,6 @@
#endif #endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/* Exclude all the code except the test program at the end /* Exclude all the code except the test program at the end
if the system has its own `getloadavg' function. if the system has its own `getloadavg' function.

118
job.c
View File

@@ -1,5 +1,5 @@
/* Job execution and handling for GNU Make. /* Job execution and handling for GNU Make.
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc. Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify GNU Make is free software; you can redistribute it and/or modify
@@ -23,9 +23,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "variable.h" #include "variable.h"
#include <assert.h> #include <assert.h>
/* Default path to search for executables. */
static char default_path[] = ":/bin:/usr/bin";
/* Default shell to use. */ /* Default shell to use. */
char default_shell[] = "/bin/sh"; char default_shell[] = "/bin/sh";
@@ -689,6 +686,8 @@ start_job_command (child)
{ {
/* Fork the child process. */ /* Fork the child process. */
char **parent_environ;
#ifdef POSIX #ifdef POSIX
(void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0); (void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0);
#else #else
@@ -698,7 +697,9 @@ start_job_command (child)
#endif #endif
child->remote = 0; child->remote = 0;
parent_environ = environ;
child->pid = vfork (); child->pid = vfork ();
environ = parent_environ; /* Restore value child may have clobbered. */
if (child->pid == 0) if (child->pid == 0)
{ {
/* We are the child side. */ /* We are the child side. */
@@ -768,7 +769,7 @@ start_waiting_job (c)
{ {
/* Put this child on the chain of children waiting /* Put this child on the chain of children waiting
for the load average to go down. */ for the load average to go down. */
c->file->command_state = cs_running; set_command_state (c->file, cs_running);
c->next = waiting_jobs; c->next = waiting_jobs;
waiting_jobs = c; waiting_jobs = c;
return 0; return 0;
@@ -1073,6 +1074,11 @@ child_execute_job (stdin_fd, stdout_fd, argv, envp)
exec_command (argv, envp); exec_command (argv, envp);
} }
#if 0
/* Default path to search for executables. */
static char default_path[] = ":/bin:/usr/bin";
/* Search PATH for FILE. /* Search PATH for FILE.
If successful, store the full pathname in PROGRAM and return 1. If successful, store the full pathname in PROGRAM and return 1.
If not sucessful, return zero. */ If not sucessful, return zero. */
@@ -1171,6 +1177,7 @@ search_path (file, path, program)
return 0; return 0;
} }
#endif /* search_path commented out */
/* Replace the current process with one running the command in ARGV, /* Replace the current process with one running the command in ARGV,
with environment ENVP. This function does not return. */ with environment ENVP. This function does not return. */
@@ -1179,59 +1186,36 @@ void
exec_command (argv, envp) exec_command (argv, envp)
char **argv, **envp; char **argv, **envp;
{ {
char *shell, *path;
PATH_VAR (program);
register char **ep;
shell = path = 0;
for (ep = envp; *ep != 0; ++ep)
{
if (shell == 0 && !strncmp(*ep, "SHELL=", 6))
shell = &(*ep)[6];
else if (path == 0 && !strncmp(*ep, "PATH=", 5))
path = &(*ep)[5];
else if (path != 0 && shell != 0)
break;
}
/* Be the user, permanently. */ /* Be the user, permanently. */
child_access (); child_access ();
if (!search_path (argv[0], path, program))
error ("%s: Command not found", argv[0]);
else
{
/* Run the program. */ /* Run the program. */
execve (program, argv, envp); environ = envp;
execvp (argv[0], argv);
if (errno == ENOEXEC) switch (errno)
{ {
PATH_VAR (shell_program); case ENOENT:
char *shell_path; error ("%s: Command not found", argv[0]);
if (shell == 0) break;
shell_path = default_shell; case ENOEXEC:
else
{
if (search_path (shell, path, shell_program))
shell_path = shell_program;
else
{
shell_path = 0;
error ("%s: Shell program not found", shell);
}
}
if (shell_path != 0)
{ {
/* The file is not executable. Try it as a shell script. */
extern char *getenv ();
char *shell;
char **new_argv; char **new_argv;
int argc; int argc;
shell = getenv ("SHELL");
if (shell == 0)
shell = default_shell;
argc = 1; argc = 1;
while (argv[argc] != 0) while (argv[argc] != 0)
++argc; ++argc;
new_argv = (char **) alloca ((1 + argc + 1) * sizeof (char *)); new_argv = (char **) alloca ((1 + argc + 1) * sizeof (char *));
new_argv[0] = shell_path; new_argv[0] = shell;
new_argv[1] = program; new_argv[1] = program;
while (argc > 0) while (argc > 0)
{ {
@@ -1239,22 +1223,28 @@ exec_command (argv, envp)
--argc; --argc;
} }
execve (shell_path, new_argv, envp); execvp (shell, new_argv);
perror_with_name ("execve: ", shell_path); if (errno == ENOENT)
} error ("%s: Shell program not found", shell);
}
else else
perror_with_name ("execve: ", program); perror_with_name ("execvp: ", shell);
break;
}
default:
perror_with_name ("execvp: ", argv[0]);
break;
} }
_exit (127); _exit (127);
} }
/* Figure out the argument list necessary to run LINE as a command. /* Figure out the argument list necessary to run LINE as a command. Try to
Try to avoid using a shell. This routine handles only ' quoting. avoid using a shell. This routine handles only ' quoting, and " quoting
Starting quotes may be escaped with a backslash. If any of the when no backslash, $ or ` characters are seen in the quotes. Starting
characters in sh_chars[] is seen, or any of the builtin commands quotes may be escaped with a backslash. If any of the characters in
listed in sh_cmds[] is the first word of a line, the shell is used. sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
is the first word of a line, the shell is used.
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE. If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
If *RESTP is NULL, newlines will be ignored. If *RESTP is NULL, newlines will be ignored.
@@ -1332,7 +1322,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
string_char: string_char:
/* Inside a string, just copy any char except a closing quote /* Inside a string, just copy any char except a closing quote
or a backslash-newline combination. */ or a backslash-newline combination. */
if (*p == '\'') if (*p == instring)
instring = 0; instring = 0;
else if (*p == '\\' && p[1] == '\n') else if (*p == '\\' && p[1] == '\n')
goto swallow_escaped_newline; goto swallow_escaped_newline;
@@ -1342,6 +1332,10 @@ construct_command_argv_internal (line, restp, shell, ifs)
*restp = p; *restp = p;
goto end_of_line; goto end_of_line;
} }
/* Backslash, $, and ` are special inside double quotes.
If we see any of those, punt. */
else if (instring == '"' && index ("\\$`", *p) != 0)
goto slow;
else else
*ap++ = *p; *ap++ = *p;
} }
@@ -1399,7 +1393,8 @@ construct_command_argv_internal (line, restp, shell, ifs)
break; break;
case '\'': case '\'':
instring = 1; case '"':
instring = *p;
break; break;
case '\n': case '\n':
@@ -1564,7 +1559,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
continue; continue;
} }
if (*p == '\\' || *p == '\'' if (*p == '\\' || *p == '\'' || *p == '"'
|| isspace (*p) || isspace (*p)
|| index (sh_chars, *p) != 0) || index (sh_chars, *p) != 0)
*ap++ = '\\'; *ap++ = '\\';
@@ -1580,11 +1575,12 @@ construct_command_argv_internal (line, restp, shell, ifs)
return new_argv; return new_argv;
} }
/* Figure out the argument list necessary to run LINE as a command. /* Figure out the argument list necessary to run LINE as a command. Try to
Try to avoid using a shell. This routine handles only ' quoting. avoid using a shell. This routine handles only ' quoting, and " quoting
Starting quotes may be escaped with a backslash. If any of the when no backslash, $ or ` characters are seen in the quotes. Starting
characters in sh_chars[] is seen, or any of the builtin commands quotes may be escaped with a backslash. If any of the characters in
listed in sh_cmds[] is the first word of a line, the shell is used. sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
is the first word of a line, the shell is used.
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE. If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
If *RESTP is NULL, newlines will be ignored. If *RESTP is NULL, newlines will be ignored.

18
main.c
View File

@@ -1,5 +1,5 @@
/* Argument parsing and main program of GNU Make. /* Argument parsing and main program of GNU Make.
Copyright (C) 1988, 89, 90, 91, 94 Free Software Foundation, Inc. Copyright (C) 1988, 89, 90, 91, 94, 1995 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify GNU Make is free software; you can redistribute it and/or modify
@@ -1367,13 +1367,16 @@ positive integral argument",
if (!env && (bad || print_usage_flag)) if (!env && (bad || print_usage_flag))
{ {
/* Print a nice usage message. */ /* Print a nice usage message. */
FILE *usageto;
if (print_version_flag) if (print_version_flag)
print_version (); print_version ();
fprintf (stderr, "Usage: %s [options] [target] ...\n", program); usageto = bad ? stderr : stdout;
fputs ("Options:\n", stderr); fprintf (usageto, "Usage: %s [options] [target] ...\n", program);
fputs ("Options:\n", usageto);
for (cs = switches; cs->c != '\0'; ++cs) for (cs = switches; cs->c != '\0'; ++cs)
{ {
char buf[1024], shortarg[50], longarg[50], *p; char buf[1024], shortarg[50], longarg[50], *p;
@@ -1444,11 +1447,11 @@ positive integral argument",
line with the description, leaving at least two spaces. line with the description, leaving at least two spaces.
Print it on its own line instead. */ Print it on its own line instead. */
{ {
fprintf (stderr, "%s\n", buf); fprintf (usageto, "%s\n", buf);
buf[0] = '\0'; buf[0] = '\0';
} }
fprintf (stderr, "%*s%s.\n", fprintf (usageto, "%*s%s.\n",
- DESCRIPTION_COLUMN, - DESCRIPTION_COLUMN,
buf, cs->description); buf, cs->description);
} }
@@ -1781,6 +1784,11 @@ define_makeflags (all, makefile)
p += sizeof ref - 1; p += sizeof ref - 1;
} }
} }
else if (p == &flagstring[1])
{
words = 0;
--p;
}
else if (p[-1] == '-') else if (p[-1] == '-')
/* Kill the final space and dash. */ /* Kill the final space and dash. */
p -= 2; p -= 2;

View File

@@ -163,6 +163,11 @@ the file names where they should reside for actual use. If there is a
simple test to verify that a program is properly installed, this target simple test to verify that a program is properly installed, this target
should run that test. should run that test.
If possible, write the @code{install} target rule so that it does not
modify anything in the directory where the program was built, provided
@samp{make all} has just been done. This is convenient for building the
program under one user name and installing it under another.
The commands should create all the directories in which files are to be The commands should create all the directories in which files are to be
installed, if they don't already exist. This includes the directories installed, if they don't already exist. This includes the directories
specified as the values of the variables @code{prefix} and specified as the values of the variables @code{prefix} and
@@ -205,6 +210,9 @@ Delete all the installed files that the @samp{install} target would
create (but not the noninstalled files such as @samp{make all} would create (but not the noninstalled files such as @samp{make all} would
create). create).
This rule should not modify the directories where compilation is done,
only the directories where files are installed.
@comment The gratuitous blank line here is to make the table look better @comment The gratuitous blank line here is to make the table look better
@comment in the printed Make manual. Please leave it in. @comment in the printed Make manual. Please leave it in.
@item clean @item clean
@@ -327,6 +335,9 @@ installdirs: mkinstalldirs
$(libdir) $(infodir) \ $(libdir) $(infodir) \
$(mandir) $(mandir)
@end smallexample @end smallexample
This rule should not modify the directories where compilation is done.
It should do nothing but create installation directories.
@end table @end table
@node Command Variables @node Command Variables
@@ -401,7 +412,9 @@ installed.
Installation directories should always be named by variables, so it is Installation directories should always be named by variables, so it is
easy to install in a nonstandard place. The standard names for these easy to install in a nonstandard place. The standard names for these
variables are as follows. variables are described below. They are based on a standard filesystem
layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and
other modern operating systems.
These two variables set the root for the installation. All the other These two variables set the root for the installation. All the other
installation directories should be subdirectories of one of these two, installation directories should be subdirectories of one of these two,
@@ -411,7 +424,8 @@ and nothing should be directly installed into these two directories.
@item prefix @item prefix
A prefix used in constructing the default values of the variables listed A prefix used in constructing the default values of the variables listed
below. The default value of @code{prefix} should be @file{/usr/local} below. The default value of @code{prefix} should be @file{/usr/local}
(at least for now). When building the complete GNU system, the prefix will be empty and
@file{/usr} will be a symbolic link to @file{/}.
@item exec_prefix @item exec_prefix
A prefix used in constructing the default values of some of the A prefix used in constructing the default values of some of the

View File

@@ -8,7 +8,7 @@
@c FSF publishers: format makebook.texi instead of using this file directly. @c FSF publishers: format makebook.texi instead of using this file directly.
@set RCSID $Id$ @set RCSID $Id$
@set EDITION 0.47 DRAFT @set EDITION 0.47
@set VERSION 3.72 Beta @set VERSION 3.72 Beta
@set UPDATED 1 November 1994 @set UPDATED 1 November 1994
@set UPDATE-MONTH November 1994 @set UPDATE-MONTH November 1994
@@ -5400,12 +5400,12 @@ variable names because many strange things are valid variable names, but
are probably not what you intended. For example, are probably not what you intended. For example,
@smallexample @smallexample
files := $(foreach Es escrito en espanol!,b c ch,$(find_files)) files := $(foreach Esta escrito en espanol!,b c ch,$(find_files))
@end smallexample @end smallexample
@noindent @noindent
might be useful if the value of @code{find_files} references the variable might be useful if the value of @code{find_files} references the variable
whose name is @samp{Es escrito en espanol!} (es un nombre bastante largo, whose name is @samp{Esta escrito en espanol!} (es un nombre bastante largo,
no?), but it is more likely to be a mistake. no?), but it is more likely to be a mistake.
@node Origin Function, Shell Function, Foreach Function, Functions @node Origin Function, Shell Function, Foreach Function, Functions

View File

@@ -491,6 +491,15 @@ update_file_1 (file, depth)
return dep_status; return dep_status;
} }
if (file->command_state == cs_deps_running)
/* The commands for some deps were running on the last iteration, but
they have finished now. Reset the command_state to not_started to
simplify later bookkeeping. It is important that we do this only
when the prior state was cs_deps_running, because that prior state
was definitely propagated to FILE's also_make's by set_command_state
(called above), but in another state an also_make may have
independently changed to finished state, and we would confuse that
file's bookkeeping (updated, but not_started is bogus state). */
set_command_state (file, cs_not_started); set_command_state (file, cs_not_started);
/* Now record which dependencies are more /* Now record which dependencies are more
@@ -639,7 +648,7 @@ notice_finished_file (file)
f->last_mtime = file->last_mtime; f->last_mtime = file->last_mtime;
} }
if (file->update_status != -1) if (ran && file->update_status != -1)
/* We actually tried to update FILE, which has /* We actually tried to update FILE, which has
updated its also_make's as well (if it worked). updated its also_make's as well (if it worked).
If it didn't work, it wouldn't work again for them. If it didn't work, it wouldn't work again for them.