mirror of
https://github.com/mirror/make.git
synced 2026-08-20 00:43:29 +08:00
Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
016e1beef5 | ||
|
|
21a8ec0d72 | ||
|
|
fecd9e661a | ||
|
|
2914c705e5 | ||
|
|
3f506aaf90 | ||
|
|
75ea6c3ce2 | ||
|
|
3fb9ebf83f | ||
|
|
b4890bdb1c | ||
|
|
2cbfa1024a | ||
|
|
258dad0f9a | ||
|
|
37358a9a82 | ||
|
|
e167e0a3c2 | ||
|
|
7879457545 | ||
|
|
d525f4dd72 | ||
|
|
bd19554ea7 | ||
|
|
fffc384bfc | ||
|
|
afd1d69e7d | ||
|
|
c1305a1a18 | ||
|
|
43d5fbfc88 | ||
|
|
a4642a6a57 | ||
|
|
11ca7f1ead | ||
|
|
4aa992616f | ||
|
|
ab0fb2fa6f | ||
|
|
e1dd3bfa4a | ||
|
|
86238ec9d3 | ||
|
|
2e9779fdb4 | ||
|
|
b61a13463d | ||
|
|
d3b9c35c8f | ||
|
|
c50b75b439 | ||
|
|
7376280c33 | ||
|
|
3c767901f6 | ||
|
|
c6dfff5f1b | ||
|
|
74540a1e91 | ||
|
|
5159db0aa4 | ||
|
|
e495d2380d | ||
|
|
1ed34a0118 | ||
|
|
e8f64b2c88 | ||
|
|
4867409da2 | ||
|
|
f801fc3521 | ||
|
|
b2c0446e71 | ||
|
|
8f98ceb724 | ||
|
|
dea9990bc8 | ||
|
|
e4c43aab3e | ||
|
|
e55ed78080 | ||
|
|
ca54a0b991 | ||
|
|
e25e2fb7f5 | ||
|
|
1a886b6359 | ||
|
|
b511712f25 |
17
GNUmakefile
17
GNUmakefile
@@ -45,6 +45,8 @@ include compatMakefile
|
||||
MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES)
|
||||
|
||||
# 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))
|
||||
@@ -86,7 +88,7 @@ GLOB =
|
||||
|
||||
else
|
||||
|
||||
CPPFLAGS := $(CPPFLAGS) -Iglob
|
||||
CPPFLAGS := $(filter-out @%@,$(CPPFLAGS)) -Iglob
|
||||
|
||||
endif # works-for-make
|
||||
endif # $(libc_dir)
|
||||
@@ -96,9 +98,7 @@ endif # !no_libc
|
||||
$(ARCH)/%.o: %.c
|
||||
$(COMPILE.c) -Iglob $< $(OUTPUT_OPTION)
|
||||
$(ARCH)/glob/libglob.a: FORCE
|
||||
$(MAKE) -C $(@D) $(@F) \
|
||||
CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \
|
||||
CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H'
|
||||
$(MAKE) -C $(@D) $(@F)
|
||||
FORCE:
|
||||
objs := $(addprefix $(ARCH)/,$(objs))
|
||||
prog := $(ARCH)/make
|
||||
@@ -147,7 +147,7 @@ $(prog): $(objs) $(globdep) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o)
|
||||
$(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.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)
|
||||
$(globfiles): stamp-glob ;
|
||||
stamp-glob: /home/gd/gnu/libc/posix/glob.tar
|
||||
@@ -197,6 +197,7 @@ build.sh.in: build.template compatMakefile
|
||||
$(patsubst $(archpfx)%,%,$(objs)))\
|
||||
$(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
|
||||
$< > $@.new
|
||||
chmod a+x $@.new
|
||||
mv -f $@.new $@
|
||||
|
||||
# Make the distribution tar files.
|
||||
@@ -218,8 +219,8 @@ dist-flavor = alpha
|
||||
endif
|
||||
.PHONY: rcs-mark rcs-mark-alpha rcs-mark-beta
|
||||
rcs-mark: rcs-mark-$(dist-flavor)
|
||||
rcs-mark-alpha:;rcs -sAlpha -Nmake-$(version-): RCS/[!=]*,v
|
||||
rcs-mark-beta:;rcs -sBeta -Nmake-$(version-): RCS/[!=]*,v
|
||||
rcs-mark-alpha: RCS/[!=]*,v;rcs -sAlpha -Nmake-$(version-): $^
|
||||
rcs-mark-beta: RCS/[!=]*,v;rcs -sBeta -Nmake-$(version-): $^
|
||||
version- = $(subst .,-,$(version))
|
||||
|
||||
dist: local-inst
|
||||
@@ -262,7 +263,7 @@ make-$(version).tar: README INSTALL COPYING ChangeLog NEWS \
|
||||
acconfig.h $(srcs) remote-*.c $(globfiles) \
|
||||
make.texinfo make-stds.texi \
|
||||
make.?? make.??s make.toc make.aux make.man texinfo.tex TAGS tags \
|
||||
install.sh \
|
||||
install-sh \
|
||||
make.info make.info*
|
||||
$(make-tar)
|
||||
|
||||
|
||||
@@ -9,3 +9,9 @@
|
||||
|
||||
/* Define this if the C library defines the variable `_sys_siglist'. */
|
||||
#undef HAVE__SYS_SIGLIST
|
||||
|
||||
/* Define this if you have the `union wait' type in <sys/wait.h>. */
|
||||
#undef HAVE_UNION_WAIT
|
||||
|
||||
/* Define this if the POSIX.1 call `sysconf (_SC_OPEN_MAX)' works properly. */
|
||||
#undef HAVE_SYSCONF_OPEN_MAX
|
||||
|
||||
4
arscan.c
4
arscan.c
@@ -429,11 +429,11 @@ ar_name_equal (name, mem, truncated)
|
||||
struct ar_hdr hdr;
|
||||
return !strncmp (name, mem,
|
||||
sizeof (hdr.ar_name) -
|
||||
#ifndef __hpux
|
||||
#if !defined (__hpux) && !defined (cray)
|
||||
1
|
||||
#else
|
||||
2
|
||||
#endif /* __hpux */
|
||||
#endif /* !__hpux && !cray */
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
69
build.sh.in
Normal file
69
build.sh.in
Normal 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
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 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.
|
||||
#
|
||||
# GNU Make is free software; you can redistribute it and/or modify
|
||||
@@ -24,6 +24,7 @@
|
||||
srcdir='@srcdir@'
|
||||
CC='@CC@'
|
||||
CFLAGS='@CFLAGS@'
|
||||
CPPFLAGS='@CPPFLAGS@'
|
||||
LDFLAGS='@LDFLAGS@'
|
||||
defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
|
||||
ALLOCA='@ALLOCA@'
|
||||
@@ -32,9 +33,9 @@ extras='@LIBOBJS@'
|
||||
REMOTE='@REMOTE@'
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix=/usr/local
|
||||
prefix='@prefix@'
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix=/usr/local
|
||||
exec_prefix='@exec_prefix@'
|
||||
# Directory to find libraries in for `-lXXX'.
|
||||
libdir=${exec_prefix}/lib
|
||||
# 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.
|
||||
for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
|
||||
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
|
||||
|
||||
# The object files were actually all put in the current directory.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# NOTE: If you have no `make' program at all to process this makefile, run
|
||||
# `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.
|
||||
#
|
||||
# GNU Make is free software; you can redistribute it and/or modify
|
||||
@@ -30,11 +30,9 @@ srcdir = @srcdir@
|
||||
CC = @CC@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
# How to invoke ranlib. This is only used by the `glob' subdirectory.
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
# Define these for your system as follows:
|
||||
# -DNO_ARCHIVES To disable `ar' archive support.
|
||||
# -DNO_FLOAT To avoid using floating-point numbers.
|
||||
@@ -77,9 +75,9 @@ LOADLIBES = @LIBS@
|
||||
extras = @LIBOBJS@
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix = /usr/local
|
||||
prefix = @prefix@
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix = $(prefix)
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
# Directory to install `make' in.
|
||||
bindir = $(exec_prefix)/bin
|
||||
@@ -119,8 +117,8 @@ MAKEINFO = makeinfo
|
||||
TEXI2DVI = texi2dvi
|
||||
|
||||
# Programs to make tags files.
|
||||
ETAGS = etags -tw
|
||||
CTAGS = ctags -tw
|
||||
ETAGS = etags -w
|
||||
CTAGS = ctags -w
|
||||
|
||||
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 \
|
||||
@@ -144,10 +142,9 @@ srcs = $(srcdir)/commands.c $(srcdir)/job.c $(srcdir)/dir.c \
|
||||
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
|
||||
|
||||
all: make
|
||||
check: # No tests.
|
||||
info: make.info
|
||||
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
|
||||
|
||||
make.info: make.texinfo
|
||||
@@ -166,17 +163,14 @@ make: $(objs)
|
||||
# -I. is needed to find config.h in the build directory.
|
||||
.c.o:
|
||||
$(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \
|
||||
$(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
# For some losing Unix makes.
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
|
||||
glob/libglob.a: FORCE config.h
|
||||
cd glob; $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \
|
||||
CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H' \
|
||||
RANLIB='$(RANLIB)' \
|
||||
libglob.a
|
||||
cd glob; $(MAKE) libglob.a
|
||||
FORCE:
|
||||
|
||||
tagsrcs = $(srcs) $(srcdir)/remote-*.c
|
||||
@@ -201,7 +195,7 @@ $(bindir)/$(binprefix)make: make
|
||||
else \
|
||||
echo "$@ needs to be owned by group $(group) and setgid;"; \
|
||||
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; \
|
||||
else true; fi
|
||||
# Some systems can't deal with renaming onto a running binary.
|
||||
@@ -247,13 +241,15 @@ check: check-loadavg
|
||||
|
||||
.PHONY: clean realclean distclean mostlyclean
|
||||
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
|
||||
-rm -f Makefile config.h config.status build.sh stamp-config
|
||||
-rm -f config.log config.cache
|
||||
-rm -f TAGS tags
|
||||
-rm -f make.?? make.??s make.log make.toc make.*aux
|
||||
-rm -f loadavg.c
|
||||
realclean: distclean
|
||||
-rm -f make.info*
|
||||
mostlyclean: clean
|
||||
|
||||
.PHONY: glob-clean glob-realclean
|
||||
|
||||
109
configure.in
109
configure.in
@@ -1,78 +1,107 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
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_SUBDIRS(glob) dnl Run configure in glob subdirectory.
|
||||
|
||||
# We want these before the checks, so the checks can modify their values.
|
||||
test -z "$CFLAGS" && CFLAGS=-g AC_SUBST(CFLAGS)
|
||||
test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)
|
||||
|
||||
AC_SET_MAKE
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_CPP dnl Later checks need this.
|
||||
AC_AIX
|
||||
AC_ISC_POSIX
|
||||
AC_MINIX
|
||||
AC_STDC_HEADERS
|
||||
AC_DIR_HEADER
|
||||
AC_UID_T dnl Also does gid_t.
|
||||
AC_GETGROUPS_T
|
||||
AC_PID_T
|
||||
AC_RETSIGTYPE
|
||||
AC_HAVE_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
|
||||
sys/timeb.h)
|
||||
AC_MINUS_C_MINUS_O
|
||||
AC_CONST dnl getopt needs this.
|
||||
AC_STAT_MACROS_BROKEN
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_DIRENT
|
||||
AC_TYPE_UID_T dnl Also does gid_t.
|
||||
AC_TYPE_GETGROUPS
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
|
||||
sys/timeb.h)
|
||||
AC_PROG_CC_C_O
|
||||
AC_C_CONST dnl getopt needs this.
|
||||
AC_HEADER_STAT
|
||||
|
||||
AC_SUBST(LIBOBJS)
|
||||
|
||||
AC_HAVE_FUNCS(getdtablesize psignal \
|
||||
dup2 getcwd sigsetmask getgroups setlinebuf \
|
||||
seteuid setegid setreuid setregid strerror)
|
||||
AC_COMPILE_CHECK(sys_siglist, ,
|
||||
[extern char *sys_siglist[]; puts(*sys_siglist);],
|
||||
AC_DEFINE(HAVE_SYS_SIGLIST))
|
||||
AC_COMPILE_CHECK(_sys_siglist, ,
|
||||
[extern char *_sys_siglist[]; puts(*_sys_siglist);],
|
||||
AC_DEFINE(HAVE__SYS_SIGLIST))
|
||||
AC_ALLOCA
|
||||
AC_VFORK
|
||||
AC_SETVBUF_REVERSED
|
||||
AC_GETLOADAVG
|
||||
AC_STRCOLL
|
||||
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
|
||||
|
||||
dnl Check out the wait reality.
|
||||
AC_HAVE_HEADERS(sys/wait.h) AC_HAVE_FUNCS(waitpid wait3)
|
||||
AC_COMPILE_CHECK(union wait, [#include <sys/types.h>
|
||||
AC_CHECK_FUNCS(getdtablesize psignal mktemp \
|
||||
dup2 getcwd sigsetmask getgroups setlinebuf \
|
||||
seteuid setegid setreuid setregid strerror)
|
||||
AC_CHECK_SYMBOL(sys_siglist)
|
||||
AC_CHECK_SYMBOL(_sys_siglist)
|
||||
AC_FUNC_ALLOCA
|
||||
AC_FUNC_VFORK
|
||||
AC_FUNC_SETVBUF_REVERSED
|
||||
AC_FUNC_GETLOADAVG
|
||||
AC_FUNC_STRCOLL
|
||||
|
||||
if test $ac_cv_func_getdtablesize = no; then
|
||||
AC_MSG_CHECKING(for sysconf (_SC_OPEN_MAX))
|
||||
AC_CACHE_VAL(make_cv_sysconf_open_max, [dnl
|
||||
AC_TRY_LINK([#include <unistd.h>], [int max = sysconf (_SC_OPEN_MAX);],
|
||||
[make_cv_sysconf_open_max=yes], [make_cv_sysconf_open_max=no])])
|
||||
if test $make_cv_sysconf_open_max = yes; then
|
||||
AC_DEFINE(HAVE_SYSCONF_OPEN_MAX)
|
||||
fi
|
||||
AC_MSG_RESULT($make_cv_sysconf_open_max)
|
||||
fi
|
||||
|
||||
# Check out the wait reality.
|
||||
AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_FUNCS(waitpid wait3)
|
||||
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>],
|
||||
[union wait status; int pid; pid = wait (&status);
|
||||
[union wait status; int pid; pid = wait (&status);
|
||||
#ifdef WEXITSTATUS
|
||||
/* Some POSIXoid systems have both the new-style macros and the old
|
||||
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. */
|
||||
if (WEXITSTATUS (status) != 0) pid = -1;
|
||||
#ifdef WTERMSIG
|
||||
/* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
|
||||
-- blow chunks here --
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_WAITPID
|
||||
/* Make sure union wait works with waitpid. */
|
||||
pid = waitpid (-1, &status, 0);
|
||||
#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
|
||||
# that make necessarily works on those systems.
|
||||
AC_DYNIX_SEQ
|
||||
AC_XENIX_DIR
|
||||
AC_IRIX_SUN
|
||||
AC_CHECK_LIB(sun, getpwnam)
|
||||
|
||||
AC_SUBST(REMOTE) REMOTE=stub
|
||||
AC_WITH(customs, [REMOTE=cstms
|
||||
LIBS="$LIBS libcustoms.a"])
|
||||
AC_ARG_WITH(customs, [export jobs with the Customs daemon (NOT SUPPORTED)],
|
||||
[REMOTE=cstms LIBS="$LIBS libcustoms.a"])
|
||||
|
||||
echo checking for location of SCCS get command
|
||||
if test -f /usr/sccs/get; then
|
||||
@@ -94,7 +123,7 @@ if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
|
||||
fi
|
||||
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,
|
||||
# build.sh, and glob/Makefile.
|
||||
touch stamp-config])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
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[] =
|
||||
{
|
||||
"AR", "ar",
|
||||
#ifndef __hpux
|
||||
"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",
|
||||
#ifdef GCC_IS_NATIVE
|
||||
"CC", "gcc",
|
||||
|
||||
18
dir.c
18
dir.c
@@ -18,26 +18,26 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
|
||||
#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__)
|
||||
#if defined (POSIX) || defined (HAVE_DIRENT_H) || defined (__GNU_LIBRARY__)
|
||||
#include <dirent.h>
|
||||
#ifndef __GNU_LIBRARY__
|
||||
#define D_NAMLEN(d) strlen((d)->d_name)
|
||||
#else /* GNU C library. */
|
||||
#define D_NAMLEN(d) ((d)->d_namlen)
|
||||
#endif /* Not GNU C library. */
|
||||
#else /* Not POSIX or DIRENT. */
|
||||
#else /* Not POSIX or HAVE_DIRENT_H. */
|
||||
#define direct dirent
|
||||
#define D_NAMLEN(d) ((d)->d_namlen)
|
||||
#ifdef SYSNDIR
|
||||
#ifdef HAVE_SYS_NDIR_H
|
||||
#include <sys/ndir.h>
|
||||
#endif /* SYSNDIR */
|
||||
#ifdef SYSDIR
|
||||
#endif /* HAVE_SYS_NDIR_H */
|
||||
#ifdef HAVE_SYS_DIR_H
|
||||
#include <sys/dir.h>
|
||||
#endif /* SYSDIR */
|
||||
#ifdef NDIR
|
||||
#endif /* HAVE_SYS_DIR_H */
|
||||
#ifdef HAVE_NDIR_H
|
||||
#include <ndir.h>
|
||||
#endif /* NDIR */
|
||||
#endif /* POSIX or DIRENT or __GNU_LIBRARY__. */
|
||||
#endif /* HAVE_NDIR_H */
|
||||
#endif /* POSIX or HAVE_DIRENT_H or __GNU_LIBRARY__. */
|
||||
|
||||
#if defined (POSIX) && !defined (__GNU_LIBRARY__)
|
||||
/* Posix does not require that the d_ino field be present, and some
|
||||
|
||||
206
expand.c
206
expand.c
@@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
GNU Make is free software; you can redistribute it and/or modify
|
||||
@@ -197,9 +197,9 @@ variable_expand (line)
|
||||
char openparen = *p;
|
||||
char closeparen = (openparen == '(') ? ')' : '}';
|
||||
register char *beg = p + 1;
|
||||
int free_beg = 0;
|
||||
char *op, *begp;
|
||||
char *end;
|
||||
char *colon = 0;
|
||||
char *end, *colon;
|
||||
|
||||
op = o;
|
||||
begp = p;
|
||||
@@ -213,10 +213,18 @@ variable_expand (line)
|
||||
/* Is there a variable reference inside the parens or braces?
|
||||
If so, expand it before expanding the entire reference. */
|
||||
|
||||
p1 = index (beg, closeparen);
|
||||
end = index (beg, closeparen);
|
||||
if (end == 0)
|
||||
{
|
||||
/* Unterminated variable reference. */
|
||||
if (reading_filename != 0)
|
||||
makefile_fatal (reading_filename, *reading_lineno_ptr,
|
||||
"unterminated variable reference");
|
||||
else
|
||||
fatal ("unterminated variable reference");
|
||||
}
|
||||
p1 = lindex (beg, end, '$');
|
||||
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. */
|
||||
@@ -227,133 +235,107 @@ variable_expand (line)
|
||||
++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];
|
||||
}
|
||||
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
|
||||
it does not contain any variable references inside.
|
||||
There are several things it could be. */
|
||||
any variable references inside are now expanded.
|
||||
Is the resultant text a substitution reference? */
|
||||
|
||||
if (colon == 0)
|
||||
colon = index (beg, ':');
|
||||
if (colon != 0 && lindex (beg, colon, closeparen) == 0)
|
||||
colon = lindex (beg, end, ':');
|
||||
if (colon != 0)
|
||||
{
|
||||
/* This is a substitution reference: $(FOO:A=B). */
|
||||
int count;
|
||||
/* This looks like a substitution reference: $(FOO:A=B). */
|
||||
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)
|
||||
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
|
||||
{
|
||||
if (*p == openparen)
|
||||
++count;
|
||||
else if (*p == closeparen)
|
||||
--count;
|
||||
else if (*p == '=' && count <= 0)
|
||||
break;
|
||||
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';
|
||||
}
|
||||
|
||||
o = patsubst_expand (o, value, pattern, replace,
|
||||
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 (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);
|
||||
if (end == 0)
|
||||
{
|
||||
/* Unterminated variable reference. */
|
||||
if (reading_filename != 0)
|
||||
makefile_fatal (reading_filename, *reading_lineno_ptr,
|
||||
"unterminated variable reference");
|
||||
else
|
||||
fatal ("unterminated variable reference");
|
||||
}
|
||||
if (colon == 0)
|
||||
/* This is an ordinary variable reference.
|
||||
Look up the value of the variable. */
|
||||
o = reference_variable (o, beg, end - beg);
|
||||
}
|
||||
|
||||
/* Advance p past the variable reference to resume scan. */
|
||||
p = end;
|
||||
if (free_beg)
|
||||
free (beg);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
11
getloadavg.c
11
getloadavg.c
@@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
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
|
||||
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>
|
||||
|
||||
/* Both the Emacs and non-Emacs sections want this. Some
|
||||
@@ -69,10 +74,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/* Exclude all the code except the test program at the end
|
||||
if the system has its own `getloadavg' function.
|
||||
|
||||
|
||||
150
job.c
150
job.c
@@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
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 <assert.h>
|
||||
|
||||
/* Default path to search for executables. */
|
||||
static char default_path[] = ":/bin:/usr/bin";
|
||||
|
||||
/* Default shell to use. */
|
||||
char default_shell[] = "/bin/sh";
|
||||
|
||||
@@ -125,6 +122,9 @@ extern int setgid (), getgid ();
|
||||
#ifdef HAVE_GETDTABLESIZE
|
||||
extern int getdtablesize ();
|
||||
#else
|
||||
#ifdef HAVE_SYSCONF_OPEN_MAX
|
||||
#define getdtablesize() ((int) sysconf (_SC_OPEN_MAX))
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
#define getdtablesize() NOFILE
|
||||
#if !defined (NOFILE) && defined (NOFILES_MAX)
|
||||
@@ -133,6 +133,7 @@ extern int getdtablesize ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern int getloadavg ();
|
||||
extern int start_remote_job_p ();
|
||||
@@ -689,6 +690,8 @@ start_job_command (child)
|
||||
{
|
||||
/* Fork the child process. */
|
||||
|
||||
char **parent_environ;
|
||||
|
||||
#ifdef POSIX
|
||||
(void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0);
|
||||
#else
|
||||
@@ -698,7 +701,9 @@ start_job_command (child)
|
||||
#endif
|
||||
|
||||
child->remote = 0;
|
||||
parent_environ = environ;
|
||||
child->pid = vfork ();
|
||||
environ = parent_environ; /* Restore value child may have clobbered. */
|
||||
if (child->pid == 0)
|
||||
{
|
||||
/* We are the child side. */
|
||||
@@ -768,7 +773,7 @@ start_waiting_job (c)
|
||||
{
|
||||
/* Put this child on the chain of children waiting
|
||||
for the load average to go down. */
|
||||
c->file->command_state = cs_running;
|
||||
set_command_state (c->file, cs_running);
|
||||
c->next = waiting_jobs;
|
||||
waiting_jobs = c;
|
||||
return 0;
|
||||
@@ -1073,6 +1078,11 @@ child_execute_job (stdin_fd, stdout_fd, 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.
|
||||
If successful, store the full pathname in PROGRAM and return 1.
|
||||
If not sucessful, return zero. */
|
||||
@@ -1171,6 +1181,7 @@ search_path (file, path, program)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* search_path commented out */
|
||||
|
||||
/* Replace the current process with one running the command in ARGV,
|
||||
with environment ENVP. This function does not return. */
|
||||
@@ -1179,82 +1190,65 @@ void
|
||||
exec_command (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. */
|
||||
child_access ();
|
||||
|
||||
if (!search_path (argv[0], path, program))
|
||||
error ("%s: Command not found", argv[0]);
|
||||
else
|
||||
/* Run the program. */
|
||||
environ = envp;
|
||||
execvp (argv[0], argv);
|
||||
|
||||
switch (errno)
|
||||
{
|
||||
/* Run the program. */
|
||||
execve (program, argv, envp);
|
||||
case ENOENT:
|
||||
error ("%s: Command not found", argv[0]);
|
||||
break;
|
||||
case ENOEXEC:
|
||||
{
|
||||
/* The file is not executable. Try it as a shell script. */
|
||||
extern char *getenv ();
|
||||
char *shell;
|
||||
char **new_argv;
|
||||
int argc;
|
||||
|
||||
if (errno == ENOEXEC)
|
||||
{
|
||||
PATH_VAR (shell_program);
|
||||
char *shell_path;
|
||||
if (shell == 0)
|
||||
shell_path = default_shell;
|
||||
else
|
||||
{
|
||||
if (search_path (shell, path, shell_program))
|
||||
shell_path = shell_program;
|
||||
else
|
||||
{
|
||||
shell_path = 0;
|
||||
error ("%s: Shell program not found", shell);
|
||||
}
|
||||
}
|
||||
shell = getenv ("SHELL");
|
||||
if (shell == 0)
|
||||
shell = default_shell;
|
||||
|
||||
if (shell_path != 0)
|
||||
{
|
||||
char **new_argv;
|
||||
int argc;
|
||||
argc = 1;
|
||||
while (argv[argc] != 0)
|
||||
++argc;
|
||||
|
||||
argc = 1;
|
||||
while (argv[argc] != 0)
|
||||
++argc;
|
||||
new_argv = (char **) alloca ((1 + argc + 1) * sizeof (char *));
|
||||
new_argv[0] = shell;
|
||||
new_argv[1] = program;
|
||||
while (argc > 0)
|
||||
{
|
||||
new_argv[1 + argc] = argv[argc];
|
||||
--argc;
|
||||
}
|
||||
|
||||
new_argv = (char **) alloca ((1 + argc + 1) * sizeof (char *));
|
||||
new_argv[0] = shell_path;
|
||||
new_argv[1] = program;
|
||||
while (argc > 0)
|
||||
{
|
||||
new_argv[1 + argc] = argv[argc];
|
||||
--argc;
|
||||
}
|
||||
execvp (shell, new_argv);
|
||||
if (errno == ENOENT)
|
||||
error ("%s: Shell program not found", shell);
|
||||
else
|
||||
perror_with_name ("execvp: ", shell);
|
||||
break;
|
||||
}
|
||||
|
||||
execve (shell_path, new_argv, envp);
|
||||
perror_with_name ("execve: ", shell_path);
|
||||
}
|
||||
}
|
||||
else
|
||||
perror_with_name ("execve: ", program);
|
||||
default:
|
||||
perror_with_name ("execvp: ", argv[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
_exit (127);
|
||||
}
|
||||
|
||||
/* Figure out the argument list necessary to run LINE as a command.
|
||||
Try to avoid using a shell. This routine handles only ' quoting.
|
||||
Starting quotes may be escaped with a backslash. If any of the
|
||||
characters in 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.
|
||||
/* Figure out the argument list necessary to run LINE as a command. Try to
|
||||
avoid using a shell. This routine handles only ' quoting, and " quoting
|
||||
when no backslash, $ or ` characters are seen in the quotes. Starting
|
||||
quotes may be escaped with a backslash. If any of the characters in
|
||||
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 NULL, newlines will be ignored.
|
||||
@@ -1332,7 +1326,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
||||
string_char:
|
||||
/* Inside a string, just copy any char except a closing quote
|
||||
or a backslash-newline combination. */
|
||||
if (*p == '\'')
|
||||
if (*p == instring)
|
||||
instring = 0;
|
||||
else if (*p == '\\' && p[1] == '\n')
|
||||
goto swallow_escaped_newline;
|
||||
@@ -1342,6 +1336,10 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
||||
*restp = p;
|
||||
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
|
||||
*ap++ = *p;
|
||||
}
|
||||
@@ -1399,7 +1397,8 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
instring = 1;
|
||||
case '"':
|
||||
instring = *p;
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
@@ -1564,7 +1563,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*p == '\\' || *p == '\''
|
||||
if (*p == '\\' || *p == '\'' || *p == '"'
|
||||
|| isspace (*p)
|
||||
|| index (sh_chars, *p) != 0)
|
||||
*ap++ = '\\';
|
||||
@@ -1580,11 +1579,12 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
||||
return new_argv;
|
||||
}
|
||||
|
||||
/* Figure out the argument list necessary to run LINE as a command.
|
||||
Try to avoid using a shell. This routine handles only ' quoting.
|
||||
Starting quotes may be escaped with a backslash. If any of the
|
||||
characters in 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.
|
||||
/* Figure out the argument list necessary to run LINE as a command. Try to
|
||||
avoid using a shell. This routine handles only ' quoting, and " quoting
|
||||
when no backslash, $ or ` characters are seen in the quotes. Starting
|
||||
quotes may be escaped with a backslash. If any of the characters in
|
||||
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 NULL, newlines will be ignored.
|
||||
|
||||
39
main.c
39
main.c
@@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
GNU Make is free software; you can redistribute it and/or modify
|
||||
@@ -397,6 +397,15 @@ enter_command_line_file (name)
|
||||
return enter_file (savestring (name, strlen (name)));
|
||||
}
|
||||
|
||||
/* Toggle -d on receipt of SIGUSR1. */
|
||||
|
||||
static RETSIGTYPE
|
||||
debug_signal_handler (sig)
|
||||
int sig;
|
||||
{
|
||||
debug_flag = ! debug_flag;
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv, envp)
|
||||
int argc;
|
||||
@@ -691,11 +700,16 @@ main (argc, argv, envp)
|
||||
/* This makefile is standard input. Since we may re-exec
|
||||
and thus re-read the makefiles, we read standard input
|
||||
into a temporary file and read from that. */
|
||||
static char name[] = "/tmp/GmXXXXXX";
|
||||
FILE *outfile;
|
||||
|
||||
/* Make a unique filename. */
|
||||
#ifdef HAVE_MKTEMP
|
||||
static char name[] = "/tmp/GmXXXXXX";
|
||||
(void) mktemp (name);
|
||||
#else
|
||||
static char name[L_tmpnam];
|
||||
(void) tmpnam ();
|
||||
#endif
|
||||
|
||||
outfile = fopen (name, "w");
|
||||
if (outfile == 0)
|
||||
@@ -744,6 +758,11 @@ main (argc, argv, envp)
|
||||
(void) signal (SIGCLD, child_handler);
|
||||
#endif
|
||||
|
||||
/* Let the user send us SIGUSR1 to toggle the -d flag during the run. */
|
||||
#ifdef SIGUSR1
|
||||
(void) signal (SIGUSR1, debug_signal_handler);
|
||||
#endif
|
||||
|
||||
/* Define the initial list of suffixes for old-style rules. */
|
||||
|
||||
set_default_suffixes ();
|
||||
@@ -1367,13 +1386,16 @@ positive integral argument",
|
||||
if (!env && (bad || print_usage_flag))
|
||||
{
|
||||
/* Print a nice usage message. */
|
||||
FILE *usageto;
|
||||
|
||||
if (print_version_flag)
|
||||
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)
|
||||
{
|
||||
char buf[1024], shortarg[50], longarg[50], *p;
|
||||
@@ -1444,11 +1466,11 @@ positive integral argument",
|
||||
line with the description, leaving at least two spaces.
|
||||
Print it on its own line instead. */
|
||||
{
|
||||
fprintf (stderr, "%s\n", buf);
|
||||
fprintf (usageto, "%s\n", buf);
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
fprintf (stderr, "%*s%s.\n",
|
||||
fprintf (usageto, "%*s%s.\n",
|
||||
- DESCRIPTION_COLUMN,
|
||||
buf, cs->description);
|
||||
}
|
||||
@@ -1781,6 +1803,11 @@ define_makeflags (all, makefile)
|
||||
p += sizeof ref - 1;
|
||||
}
|
||||
}
|
||||
else if (p == &flagstring[1])
|
||||
{
|
||||
words = 0;
|
||||
--p;
|
||||
}
|
||||
else if (p[-1] == '-')
|
||||
/* Kill the final space and dash. */
|
||||
p -= 2;
|
||||
|
||||
@@ -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
|
||||
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
|
||||
installed, if they don't already exist. This includes the directories
|
||||
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).
|
||||
|
||||
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 in the printed Make manual. Please leave it in.
|
||||
@item clean
|
||||
@@ -327,6 +335,9 @@ installdirs: mkinstalldirs
|
||||
$(libdir) $(infodir) \
|
||||
$(mandir)
|
||||
@end smallexample
|
||||
|
||||
This rule should not modify the directories where compilation is done.
|
||||
It should do nothing but create installation directories.
|
||||
@end table
|
||||
|
||||
@node Command Variables
|
||||
@@ -401,7 +412,9 @@ installed.
|
||||
|
||||
Installation directories should always be named by variables, so it is
|
||||
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
|
||||
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
|
||||
A prefix used in constructing the default values of the variables listed
|
||||
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
|
||||
A prefix used in constructing the default values of some of the
|
||||
|
||||
@@ -5400,12 +5400,12 @@ variable names because many strange things are valid variable names, but
|
||||
are probably not what you intended. For example,
|
||||
|
||||
@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
|
||||
|
||||
@noindent
|
||||
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.
|
||||
|
||||
@node Origin Function, Shell Function, Foreach Function, Functions
|
||||
|
||||
29
remake.c
29
remake.c
@@ -1,5 +1,5 @@
|
||||
/* Basic dependency engine 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.
|
||||
|
||||
GNU Make is free software; you can redistribute it and/or modify
|
||||
@@ -491,7 +491,16 @@ update_file_1 (file, depth)
|
||||
return dep_status;
|
||||
}
|
||||
|
||||
set_command_state (file, cs_not_started);
|
||||
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);
|
||||
|
||||
/* Now record which dependencies are more
|
||||
recent than this file, so we can define $?. */
|
||||
@@ -547,7 +556,6 @@ update_file_1 (file, depth)
|
||||
if (!must_make)
|
||||
{
|
||||
DEBUGPR ("No need to remake target `%s'.\n");
|
||||
file->update_status = 0;
|
||||
notice_finished_file (file);
|
||||
return 0;
|
||||
}
|
||||
@@ -596,12 +604,12 @@ notice_finished_file (file)
|
||||
|
||||
if (touch_flag
|
||||
/* The update status will be:
|
||||
-1 if no commands were run;
|
||||
0 if some commands (+ or ${MAKE}) were run and won;
|
||||
-1 if this target was not remade;
|
||||
0 if 0 or more commands (+ or ${MAKE}) were run and won;
|
||||
1 if some commands were run and lost.
|
||||
The only time we don't want to touch the target is if
|
||||
it had some recursive commands, and they lost. */
|
||||
&& file->update_status != 1)
|
||||
We touch the target if it has commands which either were not run
|
||||
or won when they ran (i.e. status is 0). */
|
||||
&& file->update_status == 0)
|
||||
{
|
||||
if (file->cmds != 0 && file->cmds->any_recurse)
|
||||
{
|
||||
@@ -639,7 +647,7 @@ notice_finished_file (file)
|
||||
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
|
||||
updated its also_make's as well (if it worked).
|
||||
If it didn't work, it wouldn't work again for them.
|
||||
@@ -845,6 +853,9 @@ remake_file (file)
|
||||
execute_file_commands (file);
|
||||
return;
|
||||
}
|
||||
else
|
||||
/* This tells notice_finished_file it is ok to touch the file. */
|
||||
file->update_status = 0;
|
||||
}
|
||||
|
||||
/* This does the touching under -t. */
|
||||
|
||||
Reference in New Issue
Block a user