Compare commits

..

No commits in common. "master" and "3.99.91" have entirely different histories.

324 changed files with 26690 additions and 45410 deletions

28
.ccls
View File

@ -1,28 +0,0 @@
clang
%h --include=makeint.h
-DHAVE_CONFIG_H
-Isrc
-Ilib
-DLIBDIR="/usr/local/lib"
-DLOCALEDIR="/usr/local/share/locale"
-DMAKE_MAINTAINER_MODE
-pthread
-isystem
/usr/include/guile/2.0
-Wall
-Wextra
-Werror
-Wwrite-strings
-Wshadow
-Wdeclaration-after-statement
-Wbad-function-cast
-Wformat-security
-Wtype-limits
-Wunused-but-set-parameter
-Wlogical-op
-Wpointer-arith
-Wignored-qualifiers
-Wformat-signedness
-Wduplicated-cond
-Wno-address
-Wno-string-compare

14
.clangd
View File

@ -1,14 +0,0 @@
CompileFlags:
Add: [-xc, -DHAVE_CONFIG_H, -DMAKE_MAINTAINER_MODE, -DLIBDIR="/usr/local/lib", -DLOCALEDIR="/usr/local/share/locale", -I../src, -Isrc, -I../lib, -Ilib, -Wall, -Wextra, -Wwrite-strings, -Wshadow, -Wdeclaration-after-statement, -Wbad-function-cast, -Wformat-security, -Wtype-limits, -Wunused-but-set-parameter, -Wlogical-op, -Wpointer-arith, -Wignored-qualifiers, -Wformat-signedness, -Wduplicated-cond, -Wno-string-compare, -Wno-unused-includes]
---
If:
PathMatch: .*\.h
CompileFlags:
Add: [-xc-header, --include=makeint.h]
---
If:
PathMatch: .*/makeint\.h
Diagnostics:
UnusedIncludes: None

View File

@ -1,21 +0,0 @@
(
(nil . ((bug-reference-bug-regexp . "\\(\\bSV[- ]\\([0-9]+\\)\\)")
(bug-reference-url-format . "https://savannah.gnu.org/bugs/?%s")
(ccls-initialization-options
. (:index (:threads 6
:initialBlacklist ["/make-[0-9]" "tests/work/" "/\\.deps"
"/\\..*cache" "/\\.git"])))
(lsp-file-watch-ignored-directories
. ("[/\\\\]\\.git$"
"[/\\\\]\\..*cache$"
;; autotools content
"[/\\\\]\\.deps$"
"[/\\\\]autom4te\\.cache$"
"[/\\\\]build-aux$"
;; make-specific content
"[/\\\\]doc[/\\\\]manual$"
"[/\\\\]tests[/\\\\]work$"
"[/\\\\]make-[0-9]"))
))
(c-mode . ((c-file-style . "gnu")))
)

62
.gitignore vendored
View File

@ -1,78 +1,46 @@
# Development artifacts
ID
TAGS
GPATH
GRTAGS
GTAGS
.*cache
.*gdbinit
.gdb_history
.vscode
*~
#*
.#*
*.diff
*.patch
*.orig
*.rej
# Configure artifacts
/lib/
/m4/
ABOUT-NLS
INSTALL
Makefile
Makefile.in
Basic.mk
aclocal.m4
autom4te.cache/
build-aux/
config.cache
autom4te.cache
config.h
config.h.in
config.log
config.status
configure
/mk/Posix.mk
stamp-*
.dirstamp
gnulib
*.sed
stamp-h1
# Build artifacts
.deps/
.deps
gmk-default.h
loadavg
make
*.i
*.o
*.a
*.exe
*.dll.a
*.obj
*.lib
*.pdb
*.sbr
# Windows build artifacts
WinDebug/
WinRel/
GccDebug/
GccRel/
TccDebug/
TccRel/
# Test artifacts
makeerror-*
test-suite.log
# Distribution artifacts
.dep_segment
.check-git-HEAD
ChangeLog
Makefile.DOS
NMakefile
README
build.cfg
mkconfig.h
README.DOS
README.OS2
README.W32
SMakefile
build.sh
build.sh.in
config.ami
config.h-vms
config.h.W32
configh.dos
make-[0-9]*/
make-[0-9]*.tar.*
checkcfg.*.log

12
.purify Normal file
View File

@ -0,0 +1,12 @@
# Solaris (2.5.1) has a couple if issues.
#
suppress plk malloc; setvbuf "libc*"; main "main.c"
suppress umr kstat_read; kstat_chain_update; kstat_open; getloadavg
suppress umr kstat_chain_update; kstat_open; getloadavg
# The command line options stuff leaks a little bit. No big deal.
#
suppress mlk malloc; xmalloc "misc.c"; decode_env_switches "main.c"
suppress plk malloc; xmalloc "misc.c"; decode_env_switches "main.c"
suppress mlk malloc; xmalloc "misc.c"; concat "misc.c"; decode_env_switches "main.c"
suppress plk malloc; xmalloc "misc.c"; concat "misc.c"; decode_env_switches "main.c"

70
AUTHORS
View File

@ -1,16 +1,15 @@
-----------------------------------
GNU Make development starting with GNU Make 3.76 by:
GNU make development up to version 3.75 by:
Roland McGrath <roland@gnu.org>
Development starting with GNU make 3.76 by:
Paul D. Smith <psmith@gnu.org>
Additional development starting with GNU Make 4.3 by:
Dmitry Goncharov <dgoncharov@users.sf.net>
Additional development starting with GNU Make 3.81 by:
Additional development starting with GNU make 3.81 by:
Boris Kolpackov <boris@kolpackov.net>
GNU Make development up to version 3.75 by:
Roland McGrath <roland@gnu.org>
GNU Make User's Manual
Written by:
@ -23,7 +22,7 @@ GNU Make User's Manual
Paul D. Smith <psmith@gnu.org>
-----------------------------------
GNU Make porting efforts:
GNU make porting efforts:
Port to VMS by:
Klaus Kaempf <kkaempf@progis.de>
@ -32,8 +31,8 @@ GNU Make porting efforts:
John W. Eaton <jwe@bevo.che.wisc.edu>
Martin Zinser <zinser@decus.decus.de>
Port to MS-Windows (native/MinGW) maintained by:
Eli Zaretskii <eliz@gnu.org>
Port to Amiga by:
Aaron Digulla <digulla@fh-konstanz.de>
Port to MS-DOS (DJGPP), OS/2, and MS-Windows (native/MinGW) by:
DJ Delorie <dj@delorie.com>
@ -43,76 +42,37 @@ GNU Make porting efforts:
Andreas Beuning <andreas.buening@nexgo.de>
Earnie Boyd <earnie@uses.sf.net>
Troy Runkel <Troy.Runkel@mathworks.com>
Juan M. Guerrero <juan.guerrero@gmx.de>
KO Myung-Hun <komh78@gmail.com>
Port to z/OS by:
Igor Todorovski <itodorov@ca.ibm.com>
-----------------------------------
Other contributors:
Luke Allardyce <lukeallardyce@gmail.com>
Costas Argyris <costas.argyris@gmail.com>
Aron Barath <baratharon@caesar.elte.hu>
David Boyce <dsb@boyski.com>
Kevin Buettner <kevinb@redhat.com>
Janet Carson <janet_carson@tivoli.com>
Howard Chu <hyc@highlandsun.com>
Ludovic Courtès <ludo@gnu.org>
Joe Crayne <oh.hello.joe@gmail.com>
Jeremy Devenport <jeremy.devenport@gmail.com>
Pete Dietl <petedietl@gmail.com>
Aaron Digulla <digulla@fh-konstanz.de>
Hannes Domani <ssbssa@yahoo.de>
Martin Dorey <martin.dorey@hds.com>
Christian Eggers <ceggers@arri.de>
Paul Eggert <eggert@twinsun.com>
Mike Frysinger <vapier@gentoo.org>
Ramon Garcia Fernandez <ramon.garcia.f@gmail.com>
Noah Goldstein <goldstein.w.n@gmail.com>
Mike Haboustak <haboustak@gmail.com>
Frank Heckenbach <f.heckenbach@fh-soft.de>
Klaus Heinz <kamar@ease.rhein-main.de>
Ben Hutchings <ben@decadent.org.uk>
Cao jin <caoj.fnst@cn.fujitsu.com>
Michael Joosten
Christian Jullien <eligis@orange.fr>
Jim Kelton <jim_kelton@tivoli.com>
Kaz Kylheku <kaz@kylheku.com>
David Lubbren <uhay@rz.uni-karlsruhe.de>
Tim Magill <tim.magill@telops.gte.com>
Markus Mauhart <qwe123@chello.at>
Greg McGary <greg@mcgary.org>
Thien-Thi Nguyen <ttn@gnuvola.org>
Han-Wen Nienhuys <hanwen@cs.uu.nl>
Enrique Olaizola <enrique_olaizola16@hotmail.com>
Ola Olsson <ola1olsson@gmail.com>
Jens Rehsack <sno@netbsd.org>
Thomas Riedl <thomas.riedl@siemens.com>
Jaak Ristioja <jaak@ristioja.ee>
Christoph Schulz <develop@kristov.de>
Andreas Schwab <schwab@suse.de>
spagoveanu <spagoveanu@gmail.com>
Han-Wen Nienhuys <hanwen@cs.uu.nl>
Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Carl Staelin (Princeton University)
Ian Stewartson (Data Logic Limited)
Tobias Stoeckmann <tobias@stoeckmann.org>
Torbjörn Svensson <torbjorn.svensson@foss.st.com>
Sergei Trofimovich <siarheit@google.com>
Justine Tunney <jtunney@gmail.com>
Marc Ullman <marc@mathworks.com>
Christof Warlich <cwarlich@gmx.de>
Florian Weimer <fweimer@redhat.com>
David A. Wheeler <dwheeler@dwheeler.com>
Bernhard M. Wiedemann <bwiedemann@suse.de>
Ben Wijen <ben@wijen.net>
Jouke Witteveen <j.witteveen@gmail.com>
David Boyce <dsb@boyski.com>
Frank Heckenbach <f.heckenbach@fh-soft.de>
With suggestions/comments/bug reports from a cast of ... well ...
hundreds, anyway :)
-------------------------------------------------------------------------------
Copyright (C) 1997-2024 Free Software Foundation, Inc.
Copyright (C) 1997-2013 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
@ -125,4 +85,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,134 +0,0 @@
# Basic GNU -*-Makefile-*- to build GNU Make
#
# NOTE:
# If you have no 'make' program at all to process this makefile:
# * On Windows, run ".\build_w32.bat" to bootstrap one.
# * On MS-DOS, run ".\builddos.bat" to bootstrap one.
#
# Once you have a GNU Make program created, you can use it with this makefile
# to keep it up to date if you make changes, as:
#
# make.exe -f Basic.mk
#
# Copyright (C) 2017-2024 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 3 of the License, 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
# this program. If not, see <https://www.gnu.org/licenses/>.
all:
src = src/
lib = lib/
make_SOURCES = %make_SOURCES%
glob_SOURCES = %glob_SOURCES%
loadavg_SOURCES = %loadavg_SOURCES%
alloca_SOURCES = %alloca_SOURCES%
w32_SOURCES = %w32_SOURCES%
vms_SOURCES = %vms_SOURCES%
remote_SOURCES = $(src)remote-stub.c
OUTDIR =
SRCDIR = .
OBJEXT = o
EXEEXT =
PREFIX = /usr/local
INCLUDEDIR = $(PREFIX)/include
LIBDIR = $(PREFIX)/lib
LOCALEDIR = $(PREFIX)/share
PROG = $(OUTDIR)make$(EXEEXT)
prog_SOURCES = $(make_SOURCES) $(remote_SOURCES)
BUILT_SOURCES =
OBJECTS = $(patsubst %.c,$(OUTDIR)%.$(OBJEXT),$(prog_SOURCES))
RESOURCE_OBJECTS =
OBJDIRS = $(addsuffix .,$(sort $(dir $(OBJECTS))))
# Use the default value of CC
LD = $(CC)
# Reserved for command-line override
CPPFLAGS =
CFLAGS = -g -O2
LDFLAGS =
extra_CPPFLAGS = -DHAVE_CONFIG_H -I$(OUTDIR)src -I$(SRCDIR)/src -I$(OUTDIR)lib -I$(SRCDIR)/lib \
-DLIBDIR=\"$(LIBDIR)\" -DINCLUDEDIR=\"$(INCLUDEDIR)\" -DLOCALEDIR=\"$(LOCALDIR)\"
extra_CFLAGS =
extra_LDFLAGS = $(extra_CFLAGS) $(CFLAGS)
C_SOURCE = -c
OUTPUT_OPTION = -o $@
LINK_OUTPUT = -o $@
# Command lines
# $(call COMPILE.cmd,<src>,<tgt>)
COMPILE.cmd = $(CC) $(extra_CFLAGS) $(CFLAGS) $(extra_CPPFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OUTPUT_OPTION) $(C_SOURCE) $1
# $(call LINK.cmd,<objectlist>)
LINK.cmd = $(LD) $(extra_LDFLAGS) $(LDFLAGS) $(TARGET_ARCH) $1 $(LDLIBS) $(LINK_OUTPUT)
# $(CHECK.cmd) $(CHECK.args)
CHECK.cmd = cd $(SRCDIR)/tests && ./run_make_tests -make $(shell cd $(<D) && pwd)/$(<F)
CHECK.args ?=
# $(call MKDIR.cmd,<dirlist>)
MKDIR.cmd = mkdir -p $1
# $(call RM.cmd,<filelist>)
RM.cmd = rm -f $1
# $(call CP.cmd,<from>,<to>)
CP.cmd = cp $1 $2
CLEANSPACE = $(call RM.cmd,$(OBJECTS) $(RESOURCE_OBJECTS) $(PROG) $(BUILT_SOURCES))
# Load overrides for the above variables.
include $(firstword $(wildcard $(SRCDIR)/mk/$(lastword $(subst -, ,$(MAKE_HOST)).mk)))
VPATH = $(SRCDIR)
all: $(PROG)
$(PROG): $(OBJECTS) $(RESOURCE_OBJECTS)
$(call LINK.cmd,$^)
$(OBJECTS): $(OUTDIR)%.$(OBJEXT): %.c
$(call COMPILE.cmd,$<)
$(OBJECTS): | $(OBJDIRS) $(BUILT_SOURCES)
$(OBJDIRS):
$(call MKDIR.cmd,$@)
check:
$(CHECK.cmd) $(CHECK.args)
clean:
$(CLEANSPACE)
$(filter %.h,$(BUILT_SOURCES)): %.h : %.in.h
$(call RM.cmd,$@)
$(call CP.cmd,$<,$@)
.PHONY: all check clean

View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -1,213 +1,3 @@
2013-10-09 Paul Smith <psmith@gnu.org>
Version 4.0 released.
* configure.ac: Updated for the release.
* NEWS: Updated for the release.
* maintMakefile (tag-release): New target to add a Git tag.
* read.c (eval): Typo fix.
* ChangeLog.1: Typo fixes.
* w32/subproc/sub_proc.c (process_cleanup): Typo fix.
2013-10-07 Eli Zaretskii <eliz@gnu.org>
* w32/compat/posixfcn.c (tmpfile): Move declaration of h before
the first executable statement. Reported by Gisle Vanem
<gvanem@yahoo.no>.
2013-10-05 Paul Smith <psmith@gnu.org>
* makeint.h (MAP_USERFUNC): A new map type for function names.
* main.c (initialize_stopchar_map): Set up the function name map.
* gnumake.h (gmk_func_ptr): Define a type for function pointers.
(gmk_add_function): Convert the last argument to FLAGS.
(GMK_FUNC_*): Define flags for the function. Change the default
behavior to "expand" since that's the most common one.
* function.c (function_table_entry): Use new function pointer type.
(lookup_function): Accept any valid function name character based
on the MAP_USERFUNC values.
(define_new_function): Use the new calling signature. Verify that
registered functions have valid names.
* guile.c (guile_gmake_setup): Use new calling signatures.
* loadapi.c (gmk_add_function): Ditto.
* variable.h (define_new_function): Ditto.
* doc/make.texi (Loaded Object API): Make the registered function
API documentation more clear.
2013-10-03 Eli Zaretskii <eliz@gnu.org>
* function.c (abspath): Reset root_len to one for Cygwin only when
HAVE_DOS_PATHS is defined. Suggested by Christopher Faylor.
2013-10-02 Eli Zaretskii <eliz@gnu.org>
* w32/compat/posixfcn.c (tmpfile): New function, a replacement for
the Windows libc version.
Fix $abspath on Cygwin when HAVE_DOS_PATHS is in effect.
* function.c (IS_ABSOLUTE) [__CYGWIN__]: Special definition for
Cygwin.
(abspath) [__CYGWIN__]: Reset root_len to 1 if the absolute file
name has the Posix /foo/bar form.
[HAVE_DOS_PATHS]: Use root_len instead of hard-coded 2.
2013-10-01 Paul Smith <psmith@gnu.org>
* configure.ac: Update version to 3.99.93.
* NEWS: Ditto.
2013-09-30 Paul Smith <psmith@gnu.org>
* guile.c: Portability fixes for Guile 1.8.
2013-09-29 Paul Smith <psmith@gnu.org>
* output.c (output_dump): Always write Enter/Leave messages to stdio.
(log_working_directory): This now always writes to stdio, so we
don't need the struct output parameter anymore.
(output_start): Show the working directory when output_sync is not
set or is recursive.
* main.c (main): Ensure the special "already shown Enter message"
token is removed from MAKE_RESTARTS before the user can see it.
* function.c (func_shell_base): If the output_context stderr
exists but is invalid, write to the real stderr.
Fixes suggested by Frank Heckenbach <f.heckenbach@fh-soft.de>.
* output.c: Guard unistd.h inclusion, add io.h.
* gnumake.h: Move GMK_EXPORT before the declarations.
* make_msvc_net2003.vcproj: Add missing files.
Changes for MSVC suggested by Gerte Hoogewerf <g.hoogewerf@gmail.com>
* function.c (func_shell_base) [EMX]: Fix EMX support for output-sync.
* job.c (child_execute_job) [EMX]: Ditto.
* job.h (child_execute_job) [EMX]: Ditto.
* w32/compat/posixfcn.c: Invert the test for NO_OUTPUT_SYNC.
* guile.c (GSUBR_TYPE): Pre-2.0 Guile doesn't provide a typedef
for gsubr pointers. Create one.
(guile_define_module): Use it.
(internal_guile_eval): Force UTF-8 encoding for Guile strings.
* main.c (main): Clear GNUMAKEFLAGS after parsing, to avoid
proliferation of options.
* NEWS: Document it.
* doc/make.texi (Options/Recursion): Ditto.
2013-09-23 Eli Zaretskii <eliz@gnu.org>
* w32/compat/posixfcn.c: Fix the forgotten OUTPUT_SYNC conditional.
* job.h: Ditto, but in a comment.
2013-09-22 Paul Smith <psmith@gnu.org>
* configure.ac: Update version to 3.99.92.
* NEWS: Ditto.
* implicit.c (pattern_search): After second expansion be sure to
handle order-only markers inside the expansion properly.
Fixes Savannah bug #31155.
* guile.c (guile_define_module): Technically a void* cannot
contain a pointer-to-function and some compilers warn about this.
Cast the function pointers.
* load.c (load_object): Ditto.
* read.c (eval): If load_file() returns -1, don't add this to the
"to be rebuilt" list.
* doc/make.texi (load Directive): Document it.
* guile.c (guile_gmake_setup): Don't initialize Guile so early.
(func_guile): Lazily initialize Guile the first time the $(guile ..)
function is invoked. Guile can steal file descriptors which
confuses our jobserver FD checking, so we don't want to initialize
it before we have to.
VMS port updates by Hartmut Becker <becker.ismaning@freenet.de>
* makefile.com: Add output to the filelist.
* output.c (va_copy): Add an implementation of this macro for VMS.
* commands.c: Ensure filedef.h is #included before dep.h.
* dir.c: Ditto.
* file.c: Ditto.
* guile.c: Ditto.
* main.c: Ditto.
* misc.c: Ditto.
* read.c: Ditto.
* rule.c: Ditto.
* variable.c: Ditto.
* readme.vms: Renamed to README.VMS and updates for this release.
* Makefile.am: Ditto.
* NEWS: Ditto.
* README.template: Ditto.
* Makefile.DOS.template: Ditto.
2013-09-21 Paul Smith <psmith@gnu.org>
* maintMakefile (check-alt-config): Create a target to test
alternative configurations. Each one will build make with a
different configuration then run the test suite.
Invert the output-sync #define to NO_OUTPUT_SYNC
* configure.ac: Don't set OUTPUT_SYNC.
* makeint.h: Ditto.
* main.c: Use NO_OUTPUT_SYNC instead of OUTPUT_SYNC.
* output.c: Ditto.
* output.h: Ditto.
* job.h: Ditto.
* job.c: Ditto.
* config.ami.template: Set NO_OUTPUT_SYNC.
* config.h-vms.template: Ditto.
* config.h.W32.template: Ditto.
* configh.dos.template: Ditto.
Output generated while reading makefiles should be synced.
* main.c (make_sync): Define a context for syncing while reading
makefiles and other top-level operations.
(main): If we request syncing, enable it while we are parsing
options, reading makefiles, etc. to capture that output. Just
before we start to run rules, dump the output if any.
(die): Dump any output we've been syncing before we die
* output.h (OUTPUT_SET): Disable output_context if not syncout.
Stderr generated from shell functions in recipes should be synced.
* job.h (FD_STDIN, FD_STDOUT, FD_STDERR): Create new macros to
avoid magic numbers.
(child_execute_job): Take a FD for stderr.
* job.c (child_execute_job): Handle STDERR FD's in addition to
stdin and stdout.
(start_job_command): Call child_execute_job() with the new STDERR
parameter. Instead of performing the dup() here, send it to
child_execute_job() where it's already being done.
* function.c (func_shell_base): Pass the OUTPUT_CONTEXT stderr to
child_execute_job() if it's set, otherwise FD_STDERR.
* main.c (main): Pass FD_STDERR to child_execute_job().
2013-09-19 Paul Smith <psmith@gnu.org>
* main.c (main): Set MAKE_RESTARTS to negative before re-exec if
we've already generated an "Entering" message. If we are started
and notice that MAKE_RESTARTS is negative, assume we already wrote
"Entering" and don't write it again.
2013-09-18 Paul Smith <psmith@gnu.org>
* main.c (main): Set starting_directory before we write any
errors. Fixes Savannah bug #40043.
2013-09-16 Eli Zaretskii <eliz@gnu.org>
* output.c [WINDOWS32]: Include windows.h and sub_proc.h, to avoid
compiler warnings for CLOSE_ON_EXEC.
2013-09-16 Paul Smith <psmith@gnu.org>
* configure.ac: Update version to 3.99.91.
@ -664,7 +454,7 @@
characters in its name, pass NULL as the first argument to
CreateProcess. This avoids weird failures due to buggy quoting by
CreateProcess. For the details, see the discussion starting at
https://lists.gnu.org/archive/html/make-w32/2013-04/msg00008.html.
http://lists.gnu.org/archive/html/make-w32/2013-04/msg00008.html.
* load.c (load_object, load_file): Accept an additional argument
DLP and return in it a pointer that can be used to unload the
@ -706,7 +496,7 @@
(construct_command_argv_internal): Don't treat a backslash as an
escape character before whitespace, if the shell is not a Posix
shell. For the description of the problem, see
https://lists.gnu.org/archive/html/make-w32/2013-04/msg00014.html.
http://lists.gnu.org/archive/html/make-w32/2013-04/msg00014.html.
2013-05-01 Paul Smith <psmith@gnu.org>
@ -1392,7 +1182,7 @@
2011-09-16 Paul Smith <psmith@gnu.org>
* maintMakefile (do-po-update): Apparently we have to avoid
certificate checks on the https://translationproject.org site now.
certificate checks on the http://translationproject.org site now.
2011-09-12 Paul Smith <psmith@gnu.org>
@ -5612,7 +5402,7 @@
See ChangeLog.2, available in the Git repository at:
https://git.savannah.gnu.org/cgit/make.git/tree/
http://git.savannah.gnu.org/cgit/make.git/tree/
for earlier changes.
@ -5630,4 +5420,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1703,7 +1703,7 @@ Thu Sep 14 18:29:38 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU)
existing variable's origin, is `o_env', make it `o_env_override'.
* load.c: Use the symbol KERNEL_FILE_NAME instead of KERNEL_FILE.
* compatMakefile: Changed the comment for `LOAD_AVG' accordingly.
* compatMakefile: Changed the comment for `LOAD_AVG' accordinly.
Thu Sep 7 16:46:26 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU)
@ -3218,7 +3218,7 @@ Sun Feb 5 19:52:38 1989 Roland McGrath (mcgrath at paris.Berkeley.EDU)
* variable.c (expand_function: `shell'): Use
`shell_function_completed'. Block children before forking and
unblock after `shell_function_pid' is set properly and
`shell_function_completed' is reset to 0.
`shell_functon_completed' is reset to 0.
* commands.c (child_handler): When the child of the `shell' function
completes, set `shell_function_completed' to 1 if it actually ran,
@ -4465,7 +4465,7 @@ Fri Sep 16 13:59:59 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU)
`maxsuffix', and must be called before count_implicit_rule_limits.
* rule.c (pattern_search): If an existent (non-intermediate)
dependency was found via a terminal rule, set its
dependendency was found via a terminal rule, set its
`tried_implicit' flag, so it will never have implicit rule search done.
* glob.c: Bug fix to avoid alloca(0).
@ -4826,7 +4826,7 @@ Sat Jul 30 15:47:23 1988 Roland McGrath (mcgrath at tully.Berkeley.EDU)
new entry as the old entry's prev pointer.
* dir.c: Re-indented the `struct dir' definition to be right.
(dir_load): Cleaned up slightly.
(dir_load): Cleaned up slighty.
(file_exists_p): Removed comment saying we could use `access', since
that is a bad idea (except for setuid programs). Cleaned up slightly.
@ -4994,4 +4994,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1322,7 +1322,7 @@
non-standard versions of free() don't like it.
* configure.in (--enable-dmalloc): Install some support for using
dmalloc (https://www.dmalloc.com/) with make. Use --enable-dmalloc
dmalloc (http://www.dmalloc.com/) with make. Use --enable-dmalloc
with configure to enable it.
* function.c (function_table_entry): Whoops! The function.c
@ -6632,7 +6632,7 @@ Fri Nov 1 19:34:28 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
See ChangeLog.1, available in the Git repository at:
https://git.savannah.gnu.org/cgit/make.git/tree/
http://git.savannah.gnu.org/cgit/make.git/tree/
for earlier changes.
@ -6650,4 +6650,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

231
INSTALL Normal file
View File

@ -0,0 +1,231 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PREFIX', the package will
use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

587
Makefile.DOS.template Normal file
View File

@ -0,0 +1,587 @@
# -*-Makefile-*- template for DJGPP
# Makefile.in generated automatically by automake 1.2 from Makefile.am
#
# Copyright (C) 1994-2013 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
SHELL = /bin/sh
srcdir = .
VPATH = $(srcdir)
# $DJDIR is defined automatically by DJGPP to point
# to the root of the DJGPP installation tree.
prefix = /dev/env/DJDIR
exec_prefix = ${prefix}
bindir = /bin
datadir = /share
libdir = /lib
infodir = /info
mandir = /man
includedir = /include
oldincludedir = c:/djgpp/include
DESTDIR = /dev/env/DJDIR
pkgdatadir = $(datadir)/make
pkglibdir = $(libdir)/make
pkgincludedir = $(includedir)/make
localedir = $(datadir)/locale
INSTALL = ${exec_prefix}/bin/ginstall -c
INSTALL_PROGRAM = ${exec_prefix}/bin/ginstall -c
INSTALL_DATA = ${exec_prefix}/bin/ginstall -c -m 644
INSTALL_SCRIPT = ${exec_prefix}/bin/ginstall -c
transform = s,x,x,
# This will fail even if they don't have a Unix-like shell (stock DOS
# shell doesn't know about `false'). The only difference is that they
# get "Error -1" instead of "Error 1".
EXIT_FAIL = false
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = .exe
OBJEXT = o
AR = ar
AWK = gawk
CC = gcc
CPP = gcc -E
LIBOBJS =
MAKEINFO = ${exec_prefix}/bin/makeinfo
PACKAGE = make
PERL = perl
RANLIB = ranlib
REMOTE = stub
VERSION = %VERSION%
AUTOMAKE_OPTIONS = 1.2
bin_PROGRAMS = %PROGRAMS%$(EXEEXT)
make_SOURCES = %SOURCES%
# This should include the glob/ prefix
libglob_a_SOURCES = %GLOB_SOURCES%
make_LDADD = glob/libglob.a
man_MANS = make.1
INCLUDES = -I$(srcdir)/glob -DLIBDIR=\"$(prefix)$(libdir)\" -DINCLUDEDIR=\"$(prefix)$(includedir)\" -DLOCALEDIR=\"$(prefix)$(localedir)\"
BUILT_SOURCES = README build.sh-in
EXTRA_DIST = $(BUILT_SOURCES) $(man_MANS) README.customs remote-cstms.c make-stds.texi texinfo.tex SCOPTIONS SMakefile Makefile.ami README.Amiga config.ami amiga.c amiga.h NMakefile README.DOS configh.dos configure.bat makefile.com README.W32 build_w32.bat config.h-W32 subproc.bat make.lnk config.h-vms makefile.vms readme.vms vmsdir.h vmsfunctions.c vmsify.c gmk-default.scm gmk-default.h
SUBDIRS = glob doc
mkinstalldirs = ${exec_prefix}/bin/gmkdir -p
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = build.sh
PROGRAMS = $(bin_PROGRAMS)
MAKE_HOST = i386-pc-msdosdjgpp
DEFS = -I. -I$(srcdir) -I.
CPPFLAGS = -DHAVE_CONFIG_H
LDFLAGS =
LIBS =
make_OBJECTS = %OBJECTS%
make_DEPENDENCIES = glob/libglob.a
make_LDFLAGS =
libglob_a_LIBADD =
libglob_a_OBJECTS = %GLOB_OBJECTS%
noinst_LIBRARIES = glob/libglob.a
CFLAGS = -O2 -g
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
TEXI2DVI = texi2dvi
TEXINFO_TEX = $(srcdir)/config/texinfo.tex
INFO_DEPS = doc/make.info
DVIS = doc/make.dvi
TEXINFOS = doc/make.texi
noinst_TEXINFOS = doc/fdl.texi doc/make-stds.texi
man1dir = $(mandir)/man1
MANS = $(man_MANS)
NROFF = nroff
DIST_COMMON = README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL Makefile.am Makefile.in NEWS acconfig.h aclocal.m4 alloca.c build.sh-in config.h-in configure configure.ac getloadavg.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP = --best
SOURCES = $(make_SOURCES)
OBJECTS = $(make_OBJECTS)
HEADERS = $(wildcard $(srcdir)/*.h)
default: all
.SUFFIXES:
.SUFFIXES: .c .dvi .info .o .obj .ps .texi .tex .html
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f config.h
maintainer-clean-hdr:
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do if test -f $$p; then echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p | sed '$(transform)'`"; $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p | sed '$(transform)'`; else :; fi; done
uninstall-binPROGRAMS:
$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`.exe; done
.c.o:
$(COMPILE) -c $<
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
mostlyclean-compile:
-rm -f *.$(OBJEXT) *$(EXEEXT) make.new core
clean-compile:
distclean-compile:
-rm -f *.tab.c *_tab.c
maintainer-clean-compile:
make$(EXEEXT): $(make_OBJECTS) $(make_DEPENDENCIES)
@command.com /c if exist make del make
@command.com /c if exist make.exe del make.exe
$(LINK) $(make_LDFLAGS) $(make_OBJECTS) $(make_LDADD) $(LIBS)
# Documentation
make.info: make.texi
make.dvi: make.texi
make.ps: make.dvi make.texi
make.html: make.texi
DVIPS = dvips
.texi.info:
@command.com /c if exist make.info* del make.info*
@command.com /c if exist make.i* del make.i*
$(MAKEINFO) -I$(srcdir) --no-split $< -o ./$@
.texi:
@command.com /c if exist make.info* del make.info*
@command.com /c if exist make.i* del make.i*
$(MAKEINFO) -I$(srcdir) --no-split $< -o ./$@
.texi.dvi:
TEXINPUTS="$(srcdir);$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.dvi.ps:
$(DVIPS) $< -o $@
# Other documentation formats
html: html-recursive
.texi.html:
@command.com /c if exist make.html* del make.html*
$(MAKEINFO) --html -I$(srcdir) --no-split $< -o ./$@
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(infodir)
@for file in $(INFO_DEPS); do iifile=`echo $$file | sed "s|doc/||"`; d=$(srcdir); for ifile in `cd $$d && echo $$file`; do if test -f $$d/$$ifile; then echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$iifile"; $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$iifile; else : ; fi; done; done
@$(POST_INSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then for file in $(INFO_DEPS); do iifile=`echo $$file | sed "s|doc/||"`; echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$iifile"; install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$iifile || :; done; else : ; fi
uninstall-info:
$(PRE_UNINSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then ii=yes; else ii=; fi; for file in $(INFO_DEPS); do test -z $ii || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; done
$(NORMAL_UNINSTALL)
for file in $(INFO_DEPS); do (cd $(DESTDIR)$(infodir) && rm -f $$file); done
dist-info: $(INFO_DEPS)
for base in $(INFO_DEPS); do d=$(srcdir); for file in `cd $$d && eval echo $$base*`; do test -f $(distdir)/$$file || ln $$d/$$file $(distdir)/$$file 2> /dev/null || cp -p $$d/$$file $(distdir)/$$file; done; done
mostlyclean-aminfo:
-rm -f $(srcdir)/doc/make.aux $(srcdir)/doc/make.cp $(srcdir)/doc/make.cps $(srcdir)/doc/make.dvi \
$(srcdir)/doc/make.fn $(srcdir)/doc/make.fns $(srcdir)/doc/make.ky $(srcdir)/doc/make.kys \
$(srcdir)/doc/make.ps $(srcdir)/doc/make.log $(srcdir)/doc/make.pg $(srcdir)/doc/make.toc \
$(srcdir)/doc/make.tp $(srcdir)/doc/make.tps $(srcdir)/doc/make.vr $(srcdir)/doc/make.vrs \
$(srcdir)/doc/make.op $(srcdir)/doc/make.tr $(srcdir)/doc/make.cv $(srcdir)/doc/make.cn \
$(srcdir)/doc/make.html
clean-aminfo:
distclean-aminfo:
maintainer-clean-aminfo:
for i in $(INFO_DEPS); do rm -f $$i*; done
install-man1:
$(mkinstalldirs) $(DESTDIR)$(man1dir)
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
done
uninstall-man1:
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
rm -f $(DESTDIR)$(man1dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) install-man1
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) uninstall-man1
# Assume that the only thing to do in glob is to build libglob.a,
# but do a sanity check: if $SUBDIRS will ever have more than
# a single directory, yell bloody murder.
all-recursive:
ifeq ($(findstring glob, $(SUBDIRS)), glob)
@command.com /c if not exist glob\\nul md glob
@echo Making all in glob
$(MAKE) -C glob -f ../Makefile INCLUDES='-I$(srcdir) -I$(srcdir)/glob' DEFS='-I.. -I$(srcdir)' VPATH=$(srcdir)/glob libglob.a
endif
$(SUBDIRS):
command.com /c md $@
libglob.a: $(libglob_a_OBJECTS)
command.com /c if exist libglob.a del libglob.a
$(AR) cru libglob.a $(libglob_a_OBJECTS) $(libglob_a_LIBADD)
$(RANLIB) libglob.a
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive check-recursive:
ifeq ($(words $(SUBDIRS)), 2)
@echo Making $(shell echo $@ | sed s/-recursive//) in glob
$(MAKE) -C glob -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am
@echo Making $(shell echo $@ | sed s/-recursive//) in doc
$(MAKE) -C doc -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am
else
@echo FATAL: There is more than two directory in "($(SUBDIRS))"
@$(EXIT_FAIL)
endif
tags-in-glob: $(libglob_a_SOURCES)
etags $(addprefix $(srcdir)/,$^) -o ./glob/TAGS
tags-recursive:
ifeq ($(words $(SUBDIRS)), 2)
$(MAKE) tags-in-glob
else
@echo FATAL: There is more than two directory in "($(SUBDIRS))"
@$(EXIT_FAIL)
endif
tags: TAGS
ID: $(HEADERS) $(SOURCES)
mkid $(srcdir)/$(SOURCES) $(srcdir)/$(libglob_a_SOURCES) ./config.h $(HEADERS)
TAGS: tags-recursive $(HEADERS) $(srcdir)/$(SOURCES) config.h $(TAGS_DEPENDENCIES)
etags -i ./glob/TAGS $(ETAGS_ARGS) $(srcdir)/$(SOURCES) ./config.h $(HEADERS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
rm -rf $(distdir)
GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; cd $(distdir)/=build && ../configure --srcdir=.. --prefix=$$dc_install_base && $(MAKE) && $(MAKE) dvi && $(MAKE) check && $(MAKE) install && $(MAKE) installcheck && $(MAKE) dist
rm -rf $(distdir)
@echo "========================"; echo "$(distdir).tar.gz is ready for distribution"; echo "========================"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
rm -rf $(distdir)
distdir: $(DISTFILES)
rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do d=$(srcdir); test -f $(distdir)/$$file || ln $$d/$$file $(distdir)/$$file 2> /dev/null || cp -p $$d/$$file $(distdir)/$$file; done; for subdir in $(SUBDIRS); do test -d $(distdir)/$$subdir || mkdir $(distdir)/$$subdir || exit 1; chmod 777 $(distdir)/$$subdir; (cd $$subdir && $(MAKE) top_distdir=../$(top_distdir)/$$subdir distdir=../$(distdir)/$$subdir distdir) || exit 1; done
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
info: info-recursive
info-recursive:
ifeq ($(findstring doc, $(SUBDIRS)), doc)
@command.com /c if not exist doc\\nul md doc
@echo Making all in doc
$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.info
endif
dvi: dvi-recursive
dvi-recursive:
ifeq ($(findstring doc, $(SUBDIRS)), doc)
@command.com /c if not exist doc\\nul md doc
@echo Making all in doc
$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.dvi
endif
ps: ps-recursive
ps-recursive:
ifeq ($(findstring doc, $(SUBDIRS)), doc)
@command.com /c if not exist doc\\nul md doc
@echo Making all in doc
$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.ps
endif
html-recursive:
ifeq ($(findstring doc, $(SUBDIRS)), doc)
@command.com /c if not exist doc\\nul md doc
@echo Making all in doc
$(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.html
endif
check: all-am check-recursive check-local
@:
installcheck: installcheck-recursive
all-recursive-am: config.h
$(MAKE) all-recursive
all-am: Makefile $(PROGRAMS) config.h info
install-exec-am: install-binPROGRAMS
install-data-am: install-info-am
uninstall-am: uninstall-binPROGRAMS uninstall-info
install-exec: install-exec-recursive install-exec-am
@$(NORMAL_INSTALL)
install-data: install-data-recursive install-data-am
@$(NORMAL_INSTALL)
install-recursive uninstall-recursive:
@:
install: install-recursive install-exec-am install-data-am
@:
uninstall: uninstall-recursive uninstall-am
all: all-recursive-am all-am
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs: installdirs-recursive
$(mkinstalldirs) $(bindir) $(infodir)
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS mostlyclean-compile mostlyclean-aminfo mostlyclean-tags mostlyclean-generic
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-aminfo clean-tags clean-generic mostlyclean-am
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile distclean-aminfo distclean-tags distclean-generic clean-am
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS maintainer-clean-compile maintainer-clean-aminfo maintainer-clean-tags maintainer-clean-generic distclean-am
mostlyclean: mostlyclean-recursive mostlyclean-am
clean: clean-noinstLIBRARIES clean-recursive clean-am
distclean: distclean-recursive distclean-am
rm -f config.status
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f config.status
.PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \
maintainer-clean-hdr mostlyclean-binPROGRAMS distclean-binPROGRAMS \
clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
install-binPROGRAMS mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile install-info-am uninstall-info \
mostlyclean-aminfo distclean-aminfo clean-aminfo \
maintainer-clean-aminfo install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive check-am \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir \
mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend info dvi check-local installcheck \
all-recursive-am all-am install-exec-am install-data-am uninstall-am \
install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean \
html
# --------------- Local DIST Section
# Install the w32 subdirectory
#
dist-hook:
(cd $(srcdir); \
w32=`find w32 -follow \( -name .git -prune \) -o -type f -print`; \
tar chf - $$w32) \
| (cd $(distdir); tar xfBp -)
# --------------- Local CHECK Section
# Note: check-loadavg is NOT a prerequisite of check-local, since
# there's no uptime utility, and the test it does doesn't make sense
# on MSDOS anyway.
check-local: check-shell check-regression
@banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
echo
.PHONY: check-loadavg check-shell check-regression
# > check-shell
#
# check-shell is designed to fail if they don't have a Unixy shell
# installed. The test suite requires such a shell.
check-shell:
@echo If Make says Error -1, you do not have Unix-style shell installed
@foo=bar.exe :
# > check-loadavg
#
loadavg: loadavg.c config.h
@rm -f loadavg
$(LINK) -DTEST $(make_LDFLAGS) loadavg.c $(LIBS)
# We copy getloadavg.c into a different file rather than compiling it
# directly because some compilers clobber getloadavg.o in the process.
loadavg.c: getloadavg.c
ln $(srcdir)/getloadavg.c loadavg.c || \
cp $(srcdir)/getloadavg.c loadavg.c
check-loadavg: loadavg
@echo The system uptime program believes the load average to be:
-uptime
@echo The GNU load average checking code believes:
-./loadavg
# > check-regression
#
# Look for the make test suite, and run it if found. Look in MAKE_TEST if
# specified, or else in the srcdir or the distdir, their parents, and _their_
# parents.
#
check-regression:
@if test -f "$(srcdir)/tests/run_make_tests"; then \
if $(PERL) -v >/dev/null 2>&1; then \
case `cd $(srcdir); pwd` in `pwd`) : ;; \
*) test -d tests || mkdir tests; \
for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
rm -rf tests/$$f; cp -pr $(srcdir)/tests/$$f tests; \
done ;; \
esac; \
echo "cd tests && $(PERL) ./run_make_tests.pl -make ../make.exe $(MAKETESTFLAGS)"; \
cd tests && $(PERL) ./run_make_tests.pl -make ../make.exe $(MAKETESTFLAGS); \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \
else \
echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
fi
# --------------- Maintainer's Section
# Note this requires GNU make. Not to worry, since it will only be included
# in the Makefile if we're in the maintainer's environment.
#include $(srcdir)/maintMakefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# --------------- DEPENDENCIES

View File

@ -1,6 +1,6 @@
# This is a -*-Makefile-*-, or close enough
#
# Copyright (C) 1997-2024 Free Software Foundation, Inc.
# Copyright (C) 1997-2013 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
@ -14,145 +14,146 @@
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.
# this program. If not, see <http://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = dist-lzip silent-rules std-options subdir-objects nostdinc
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = 1.8 dist-bzip2 check-news
ACLOCAL_AMFLAGS = -I config
MAKE_HOST = @MAKE_HOST@
SUBDIRS = lib po doc
# Only process if target is MS-Windows
if WINDOWSENV
MAYBE_W32 = w32
W32INC = -I $(top_srcdir)/w32/include
W32LIB = -Lw32 -lw32
endif
SUBDIRS = glob config po doc $(MAYBE_W32)
bin_PROGRAMS = make
include_HEADERS = src/gnumake.h
man_MANS = doc/make.1
make_SRCS = src/ar.c src/arscan.c src/commands.c src/commands.h \
src/debug.h src/default.c src/dep.h src/dir.c src/expand.c \
src/file.c src/filedef.h src/function.c src/getopt.c \
src/getopt.h src/getopt1.c src/gettext.h src/guile.c \
src/hash.c src/hash.h src/implicit.c src/job.c src/job.h \
src/load.c src/loadapi.c src/main.c src/makeint.h src/misc.c \
src/mkcustom.h src/os.h src/output.c src/output.h src/read.c \
src/remake.c src/rule.c src/rule.h src/shuffle.h src/shuffle.c \
src/signame.c src/strcache.c src/variable.c src/variable.h \
src/version.c src/vpath.c src/warning.c src/warning.h
w32_SRCS = src/w32/pathstuff.c src/w32/w32os.c src/w32/compat/dirent.c \
src/w32/compat/posixfcn.c src/w32/include/dirent.h \
src/w32/include/dlfcn.h src/w32/include/pathstuff.h \
src/w32/include/sub_proc.h src/w32/include/w32err.h \
src/w32/subproc/misc.c src/w32/subproc/proc.h \
src/w32/subproc/sub_proc.c src/w32/subproc/w32err.c
w32_utf8_SRCS = src/w32/utf8.rc src/w32/utf8.manifest
vms_SRCS = src/vms_exit.c src/vms_export_symbol.c src/vms_progname.c \
src/vmsdir.h src/vmsfunctions.c src/vmsify.c
glob_SRCS = lib/fnmatch.c lib/fnmatch.h lib/glob.c lib/glob.h
alloca_SRCS = lib/alloca.c
loadavg_SRCS = lib/getloadavg.c
make_SOURCES = $(make_SRCS)
EXTRA_make_SOURCES = $(vms_SRCS)
if HAVE_GUILE
_GUILE_CFLAGS = $(GUILE_CFLAGS)
_GUILE_LIBS = $(GUILE_LIBS)
else
_GUILE_CFLAGS =
_GUILE_LIBS =
endif
make_LDADD = $(LIBOBJS) $(_GUILE_LIBS) lib/libgnu.a $(GETLOADAVG_LIBS) \
@LIBINTL@
localedir = $(datadir)/locale
AM_CPPFLAGS = -Isrc -I$(top_srcdir)/src -Ilib -I$(top_srcdir)/lib \
-DLIBDIR=\"$(libdir)\" -DLOCALEDIR=\"$(localedir)\"
# If prefix is not a standard location, look in prefix as well
if !KNOWN_PREFIX
AM_CPPFLAGS += -DINCLUDEDIR=\"$(includedir)\"
endif
AM_CFLAGS = $(_GUILE_CFLAGS)
if WINDOWSENV
make_SOURCES += $(w32_SRCS)
AM_CPPFLAGS += -I $(top_srcdir)/src/w32/include
else
make_SOURCES += src/posixos.c
endif
UTF8OBJ = src/w32/utf8.$(OBJEXT)
if HAVE_WINDRES
make_LDADD += $(UTF8OBJ)
endif
$(UTF8OBJ) : $(w32_utf8_SRCS)
$(WINDRES) -o $@ -i $<
include_HEADERS = gnumake.h
if USE_CUSTOMS
make_SOURCES += src/remote-cstms.c
remote = remote-cstms.c
else
make_SOURCES += src/remote-stub.c
remote = remote-stub.c
endif
make_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \
function.c getopt.c getopt1.c implicit.c job.c load.c \
loadapi.c main.c misc.c output.c read.c remake.c rule.c \
signame.c strcache.c variable.c version.c vpath.c hash.c \
$(remote)
if HAVE_GUILE
make_SOURCES += guile.c
endif
EXTRA_make_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c
noinst_HEADERS = commands.h dep.h filedef.h job.h makeint.h rule.h variable.h \
debug.h getopt.h gettext.h hash.h output.h
make_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ @LIBINTL@ \
$(GUILE_LIBS)
# Only process if target is MS-Windows
if WINDOWSENV
make_LDADD += $(W32LIB)
endif
man_MANS = make.1
DEFS = -DLOCALEDIR=\"$(localedir)\" -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" @DEFS@
AM_CPPFLAGS = $(GLOBINC)
AM_CFLAGS = $(GUILE_CFLAGS)
# Only process if target is MS-Windows
if WINDOWSENV
AM_CPPFLAGS += $(W32INC)
endif
# Extra stuff to include in the distribution.
mk_FILES = Basic.mk mk/msdosdjgpp.mk mk/VMS.mk mk/Windows32.mk
# We don't need this, since the standard automake output will do.
#mk/Posix.mk.in
EXTRA_DIST = README build.sh.in $(man_MANS) \
README.customs README.OS2 \
SCOPTIONS SMakefile \
README.Amiga Makefile.ami config.ami make.lnk amiga.c amiga.h \
README.DOS Makefile.DOS configure.bat dosbuild.bat configh.dos\
README.W32 NMakefile config.h.W32 build_w32.bat subproc.bat \
make_msvc_net2003.sln make_msvc_net2003.vcproj \
readme.vms makefile.vms makefile.com config.h-vms \
vmsdir.h vmsfunctions.c vmsify.c \
gmk-default.scm gmk-default.h
m4_FILES = m4/gnulib-cache.m4
# This is built during configure, but behind configure's back
test_FILES = tests/run_make_tests tests/run_make_tests.bat \
tests/run_make_tests.pl tests/test_driver.pl \
tests/config-flags.pm.in tests/config_flags_pm.com \
tests/config-flags.pm.W32 \
tests/mkshadow tests/thelp.pl tests/guile.supp tests/README
# test/scripts are added via dist-hook below.
DISTCLEANFILES = build.sh
EXTRA_DIST = ChangeLog INSTALL README build.sh build.cfg.in $(man_MANS) \
src/mkconfig.h README.customs README.OS2 README.zOS \
README.DOS builddos.bat src/configh.dos \
README.W32 build_w32.bat src/config.h.W32 \
README.VMS makefile.com src/config.h-vms src/vmsjobs.c \
vms_export_symbol_test.com \
src/gmk-default.scm src/gmk-default.h \
$(mk_FILES) $(m4_FILES) $(test_FILES) $(w32_utf8_SRCS)
# Forward targets
html:
cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
.PHONY: html
# --------------- Internationalization Section
localedir = $(datadir)/locale
# --------------- Local INSTALL Section
# If necessary, change the gid of the app and turn on the setgid flag.
#
# Whether or not make needs to be installed setgid.
# The value should be either 'true' or 'false'.
# On many systems, the getloadavg function (used to implement the '-l'
# switch) will not work unless make is installed setgid kmem.
#
inst_setgid = @NEED_SETGID@
# Install make setgid to this group so it can get the load average.
#
inst_group = @KMEM_GROUP@
install-exec-local:
@if $(inst_setgid); then \
app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
if chgrp $(inst_group) $$app && chmod g+s $$app; then \
echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
else \
echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
echo "otherwise the '-l' option will probably not work."; \
echo "You may need special privileges to complete the installation"; \
echo "of $$app."; \
fi; \
else true; fi
# --------------- Generate the Guile default module content
src/guile.$(OBJEXT): src/gmk-default.h
src/gmk-default.h: $(top_srcdir)/src/gmk-default.scm
guile.$(OBJEXT): gmk-default.h
gmk-default.h: $(srcdir)/gmk-default.scm
(echo 'static const char *const GUILE_module_defn = " '\\ \
&& sed -e 's/;.*//' -e '/^[ \t]*$$/d' -e 's/"/\\"/g' -e 's/$$/ \\/' \
$(top_srcdir)/src/gmk-default.scm \
&& echo '";') > src/gmk-default.h
$(srcdir)/gmk-default.scm \
&& echo '";') > $@
# --------------- Local DIST Section
# Install the mk and tests subdirectories
# Install the w32 and tests subdirectories
#
dist-hook:
(cd $(top_srcdir); \
sub=`find tests/scripts -follow \( -name .git -o -name .deps -o -name work -o -name .gitignore -o -name \*.orig -o -name \*.rej -o -name \*~ -o -name \*.out -o -name Makefile \) -prune -o -type f -print`; \
$(AMTAR) chf - $$sub) \
| (cd $(distdir); $(AMTAR) xfBp -)
(cd $(srcdir); \
sub=`find w32 tests -follow \( -name .git -o -name .deps -o -name work -o -name .gitignore -o -name \*.orig -o -name \*.rej -o -name \*~ -o -name Makefile \) -prune -o -type f -print`; \
tar chf - $$sub) \
| (cd $(distdir); tar xfBp -)
# --------------- Local CHECK Section
check-local: check-regression
@banner=" Regression PASSED: $(PACKAGE_STRING) ($(MAKE_HOST)) built with $(CC) "; \
check-local: check-regression check-loadavg
@banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo; \
echo "$$dashes"; \
@ -160,54 +161,47 @@ check-local: check-regression
echo "$$dashes"; \
echo
.PHONY: check-loadavg check-regression
check-loadavg: loadavg$(EXEEXT)
@echo The system uptime program believes the load average to be:
-uptime
@echo The GNU load average checking code thinks:
-./loadavg$(EXEEXT)
# The loadavg function is invoked during "make check" to test getloadavg.
check_PROGRAMS = loadavg
nodist_loadavg_SOURCES = getloadavg.c
loadavg_CPPFLAGS = -DTEST
loadavg_LDADD = @GETLOADAVG_LIBS@
# > check-regression
#
# Look for the make test suite, and run it if found and we can find perl.
# If we're building outside the tree, we use symlinks to make a local copy of
# the test suite. Unfortunately the test suite itself isn't localizable yet.
#
MAKETESTFLAGS =
.PHONY: check-regression
GMK_OUTDIR = ..
testlog = test-suite.log
testresult = tests/.test-result
errorpre = makeerror-$(PACKAGE_VERSION)-$(host_triplet)
testfiles = $(testlog) $(testresult) $(errorfile)
MOSTLYCLEANFILES = $(testfiles)
errordetails = config.status config.log src/config.h src/mkconfig.h \
$(testlog) tests/work
# Create a 4-letter random sequence
rand_value = c = "abcdefghijklmnopqrstuvwxyz0123456789"
rand_char = substr(c,int(rand()*36),1)
rand_string = $(AWK) 'BEGIN{srand(); $(rand_value); print $(rand_char) "" $(rand_char) "" $(rand_char) "" $(rand_char);}'
check-regression: tests/config-flags.pm
$(AM_V_at) rm -f $(testfiles)
$(AM_V_at) if test -f '$(top_srcdir)/tests/run_make_tests.pl'; then \
ulimit -n 128; \
check-regression:
@if test -f '$(srcdir)/tests/run_make_tests'; then \
if $(PERL) -v >/dev/null 2>&1; then \
echo "cd tests && $(PERL) $(PERLFLAGS) $(abs_top_srcdir)/tests/run_make_tests.pl -make $(GMK_OUTDIR)/make$(EXEEXT) $(MAKETESTFLAGS)"; \
(cd tests && $(PERL) $(PERLFLAGS) '$(abs_top_srcdir)/tests/run_make_tests.pl' -make '$(GMK_OUTDIR)/make$(EXEEXT)' $(MAKETESTFLAGS); echo $$? >.test-result) 2>&1 | tee $(testlog); \
export TAR_OPTIONS='$(filter-out --sort%,$(TAR_OPTIONS))'; \
er=$$(cat $(testresult)); if test "$$er" -ne 0; then \
dirnm="$(errorpre)-$$($(rand_string))"; fnm="$$dirnm.tar.gz"; \
rm -rf "$$dirnm"; mkdir "$$dirnm"; \
$(AMTAR) chf - $(errordetails) | (cd "$$dirnm"; $(AMTAR) xf -); \
$(AMTAR) chf - "$$dirnm" | eval GZIP= gzip $(GZIP_ENV) -c >"$$fnm"; \
echo "*** Testing FAILED! Details: $$fnm"; \
echo '*** Please report to <$(PACKAGE_BUGREPORT)>'; echo; \
exit $$er; \
fi; \
case `cd '$(srcdir)'; pwd` in `pwd`) : ;; \
*) test -d tests || mkdir tests; \
rm -f srctests; \
if ln -s '$(srcdir)/tests' srctests; then \
for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
rm -f tests/$$f; ln -s ../srctests/$$f tests; \
done; fi ;; \
esac; \
echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \
else \
echo "Can't find the $(PACKAGE_NAME) test suite ($(top_srcdir)/tests)."; \
fi
else \
echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
fi
# --------------- Maintainer's Section

308
Makefile.ami Normal file
View File

@ -0,0 +1,308 @@
# -*-Makefile-*- for GNU make on Amiga
#
# NOTE: If you have no 'make' program at all to process this makefile, run
# 'build.sh' instead.
#
# Copyright (C) 1995-2013 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# Makefile for GNU Make
#
CC = sc
RM = delete
CFLAGS =
CPPFLAGS =
LDFLAGS =
# Define these for your system as follows:
# -DNO_ARCHIVES To disable 'ar' archive support.
# -DNO_FLOAT To avoid using floating-point numbers.
# -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
# Some compilers apparently accept this
# without complaint but produce losing code,
# so beware.
# NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
# See also 'config.h'.
defines =
# Which flavor of remote job execution support to use.
# The code is found in 'remote-$(REMOTE).c'.
REMOTE = stub
# If you are using the GNU C library, or have the GNU getopt functions in
# your C library, you can comment these out.
GETOPT = getopt.o getopt1.o
GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h
# If you are using the GNU C library, or have the GNU glob functions in
# your C library, you can comment this out. GNU make uses special hooks
# into the glob functions to be more efficient (by using make's directory
# cache for globbing), so you must use the GNU functions even if your
# system's C library has the 1003.2 glob functions already. Also, the glob
# functions in the AIX and HPUX C libraries are said to be buggy.
GLOB = glob/glob.lib
# If your system doesn't have alloca, or the one provided is bad, define this.
ALLOCA = alloca.o
ALLOCA_SRC = $(srcdir)alloca.c
# If your system needs extra libraries loaded in, define them here.
# System V probably need -lPW for alloca. HP-UX 7.0's alloca in
# libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
# alloca.c instead on those machines.
LOADLIBES =
# Any extra object files your system needs.
extras = amiga.o
# Common prefix for machine-independent installed files.
prefix =
# Common prefix for machine-dependent installed files.
exec_prefix =
# Directory to install 'make' in.
bindir = sc:c
# Directory to find libraries in for '-lXXX'.
libdir = lib:
# Directory to search by default for included makefiles.
includedir = include:
# Directory to install the Info files in.
infodir = doc:
# Directory to install the man page in.
mandir = t:
# Number to put on the man page filename.
manext = 1
# Prefix to put on installed 'make' binary file name.
binprefix =
# Prefix to put on installed 'make' man page file name.
manprefix = $(binprefix)
# Whether or not make needs to be installed setgid.
# The value should be either 'true' or 'false'.
# On many systems, the getloadavg function (used to implement the '-l'
# switch) will not work unless make is installed setgid kmem.
install_setgid = false
# Install make setgid to this group so it can read /dev/kmem.
group = sys
# Program to install 'make'.
INSTALL_PROGRAM = copy
# Program to install the man page.
INSTALL_DATA = copy
# Generic install program.
INSTALL = copy
# Program to format Texinfo source into Info files.
MAKEINFO = makeinfo
# Program to format Texinfo source into DVI files.
TEXI2DVI = texi2dvi
# Programs to make tags files.
ETAGS = etags -w
CTAGS = ctags -w
#guile = guile.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 \
vpath.o version.o ar.o arscan.o signame.o strcache.o hash.o \
remote-$(REMOTE).o $(GETOPT) $(ALLOCA) $(extras) $(guile)
srcs = $(srcdir)commands.c $(srcdir)job.c $(srcdir)dir.c \
$(srcdir)file.c $(srcdir)getloadavg.c $(srcdir)misc.c \
$(srcdir)main.c $(srcdir)read.c $(srcdir)remake.c \
$(srcdir)rule.c $(srcdir)implicit.c $(srcdir)default.c \
$(srcdir)variable.c $(srcdir)expand.c $(srcdir)function.c \
$(srcdir)vpath.c $(srcdir)version.c $(srcdir)hash.c \
$(srcdir)guile.c $(srcdir)remote-$(REMOTE).c \
$(srcdir)ar.c $(srcdir)arscan.c $(srcdir)strcache.c \
$(srcdir)signame.c $(srcdir)signame.h $(GETOPT_SRC) \
$(srcdir)commands.h $(srcdir)dep.h $(srcdir)filedep.h \
$(srcdir)job.h $(srcdir)makeint.h $(srcdir)rule.h \
$(srcdir)variable.h $(ALLOCA_SRC) $(srcdir)config.h.in
.SUFFIXES:
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
all: make
info: make.info
dvi: make.dvi
# Some makes apparently use .PHONY as the default goal if it is before 'all'.
.PHONY: all check info dvi
make.info: make.texinfo
$(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info
make.dvi: make.texinfo
$(TEXI2DVI) $(srcdir)make.texinfo
make.ps: make.dvi
dvi2ps make.dvi > make.ps
make: $(objs) $(GLOB)
$(CC) Link $(LDFLAGS) $(objs) Lib $(GLOB) $(LOADLIBES) To make.new
-delete make
rename make.new make
TMPFILE = t:Make$$
$(GLOB):
cd glob @@\
$(MAKE) -$(MAKEFLAGS) -f Makefile
# -I. is needed to find config.h in the build directory.
OUTPUT_OPTION =
.c.o:
$(CC) $(defines) IDir "" IDir glob \
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
# For some losing Unix makes.
SHELL = /bin/sh
#@SET_MAKE@
glob/libglob.a: FORCE config.h
cd glob; $(MAKE) libglob.a
FORCE:
.PHONY: install installdirs
install: installdirs \
$(bindir)$(binprefix)make $(infodir)make.info \
$(mandir)$(manprefix)make.$(manext)
installdirs:
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir)
$(bindir)$(binprefix)make: make
$(INSTALL_PROGRAM) make $@.new
@if $(install_setgid); then \
if chgrp $(group) $@.new && chmod g+s $@.new; then \
echo "chgrp $(group) $@.new && chmod g+s $@.new"; \
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 privileges to install $@."; \
fi; \
else true; fi
# Some systems can't deal with renaming onto a running binary.
-$(RM) $@.old
-mv $@ $@.old
mv $@.new $@
$(infodir)make.info: make.info
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
for file in $${dir}/make.info*; do \
name="`basename $$file`"; \
$(INSTALL_DATA) $$file \
`echo $@ | sed "s,make.info\$$,$$name,"`; \
done
# Run install-info only if it exists.
# Use 'if' instead of just prepending '-' to the
# line so we notice real errors from install-info.
# We use '$(SHELL) -c' because some shells do not
# fail gracefully when there is an unknown command.
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
install-info --infodir=$(infodir) $$dir/make.info; \
else true; fi
$(mandir)$(manprefix)make.$(manext): make.man
$(INSTALL_DATA) $(srcdir)make.man $@
loadavg: loadavg.c config.h
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
loadavg.c $(LOADLIBES) -o $@
# We copy getloadavg.c into a different file rather than compiling it
# directly because some compilers clobber getloadavg.o in the process.
loadavg.c: getloadavg.c
ln $(srcdir)getloadavg.c loadavg.c || \
cp $(srcdir)getloadavg.c loadavg.c
check-loadavg: loadavg
@echo The system uptime program believes the load average to be:
-uptime
@echo The GNU load average checking code believes:
./loadavg
check: check-loadavg
.PHONY: clean realclean distclean mostlyclean
clean: glob-clean
-$(RM) make loadavg "#?.o" core make.dvi
distclean: clean glob-realclean
-$(RM) Makefile config.h config.status build.sh
-$(RM) config.log config.cache
-$(RM) TAGS tags
-$(RM) make.?? make.??s make.log make.toc make.*aux
-$(RM) loadavg.c
realclean: distclean
-$(RM) make.info*
mostlyclean: clean
.PHONY: glob-clean glob-realclean
glob-clean glob-realclean:
cd glob @@\
$(MAKE) $@
# This tells versions [3.59,3.63) of GNU make not to export all variables.
.NOEXPORT:
# The automatically generated dependencies below may omit config.h
# because it is included with '#include <config.h>' rather than
# '#include "config.h"'. So we add the explicit dependency to make sure.
$(objs): config.h
# Automatically generated dependencies will be put at the end of the file.
# Automatically generated dependencies.
commands.o: commands.c makeint.h dep.h filedef.h variable.h job.h \
commands.h
job.o: job.c makeint.h job.h filedef.h commands.h variable.h
dir.o: dir.c makeint.h
file.o: file.c makeint.h dep.h filedef.h job.h commands.h variable.h
misc.o: misc.c makeint.h dep.h
main.o: main.c makeint.h dep.h filedef.h variable.h job.h commands.h \
getopt.h
guile.o: guile.c makeint.h dep.h debug.h variable.h gmk-default.h
read.o: read.c makeint.h dep.h filedef.h job.h commands.h variable.h \
glob/glob.h
remake.o: remake.c makeint.h filedef.h job.h commands.h dep.h
rule.o: rule.c makeint.h dep.h filedef.h job.h commands.h variable.h \
rule.h
implicit.o: implicit.c makeint.h rule.h dep.h filedef.h
default.o: default.c makeint.h rule.h dep.h filedef.h job.h commands.h \
variable.h
variable.o: variable.c makeint.h dep.h filedef.h job.h commands.h \
variable.h
expand.o: expand.c makeint.h filedef.h job.h commands.h variable.h
function.o: function.c makeint.h filedef.h variable.h dep.h job.h \
commands.h amiga.h
vpath.o: vpath.c makeint.h filedef.h variable.h
strcache.o: strcache.c makeint.h hash.h
version.o: version.c
ar.o: ar.c makeint.h filedef.h dep.h
arscan.o: arscan.c makeint.h
signame.o: signame.c signame.h
remote-stub.o: remote-stub.c makeint.h filedef.h job.h commands.h
getopt.o: getopt.c
getopt1.o : getopt1.c getopt.h
getloadavg.o: getloadavg.c
amiga.o: amiga.c makeint.h variable.h amiga.h

919
NEWS

File diff suppressed because it is too large Load Diff

125
NMakefile.template Normal file
View File

@ -0,0 +1,125 @@
# -*-Makefile-*- to build GNU make with nmake
#
# NOTE: If you have no 'make' program at all to process this makefile,
# run 'build_w32.bat' instead.
#
# Copyright (C) 1996-2013 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
LINK = link
CC = cl
MAKE = nmake
OUTDIR=.
MAKEFILE=NMakefile
SUBPROC_MAKEFILE=NMakefile
CFLAGS_any = /nologo /MT /W4 /GX /Zi /YX /I . /I glob /I w32/include /D WIN32 /D WINDOWS32 /D _CONSOLE /D HAVE_CONFIG_H
CFLAGS_debug = $(CFLAGS_any) /Od /D DEBUG /D _DEBUG /FR.\WinDebug/ /Fp.\WinDebug/make.pch /Fo.\WinDebug/ /Fd.\WinDebug/make.pdb
CFLAGS_release = $(CFLAGS_any) /O2 /D NDEBUG /FR.\WinRel/ /Fp.\WinRel/make.pch /Fo.\WinRel/
LDFLAGS_debug = w32\subproc\WinDebug\subproc.lib /NOLOGO /SUBSYSTEM:console\
/INCREMENTAL:no /PDB:WinDebug/make.pdb /OUT:WinDebug/make.exe /DEBUG
LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\
/INCREMENTAL:no /OUT:WinRel/make.exe
all: config.h subproc Release Debug
#
# Make sure we build the subproc library first. It has it's own
# makefile. To be portable to Windows 95, we put the instructions
# on how to build the library into a batch file. On NT, we could
# simply have done foo && bar && dog, but this doesn't port.
#
subproc: w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib
w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib: w32/subproc/misc.c w32/subproc/sub_proc.c w32/subproc/w32err.c
subproc.bat $(SUBPROC_MAKEFILE) $(MAKE)
if exist WinDebug\make.exe erase WinDebug\make.exe
if exist WinRel\make.exe erase WinRel\make.exe
config.h: config.h.W32
copy $? $@
Release:
$(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_release)" CFLAGS="$(CFLAGS_release)" OUTDIR=WinRel WinRel/make.exe
Debug:
$(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_debug)" CFLAGS="$(CFLAGS_debug)" OUTDIR=WinDebug WinDebug/make.exe
clean:
if exist WinDebug\nul rmdir /s /q WinDebug
if exist WinRel\nul rmdir /s /q WinRel
if exist w32\subproc\WinDebug\nul rmdir /s /q w32\subproc\WinDebug
if exist w32\subproc\WinRel\nul rmdir /s /q w32\subproc\WinRel
if exist config.h erase config.h
erase *.pdb
$(OUTDIR):
if not exist .\$@\nul mkdir .\$@
LIBS = kernel32.lib user32.lib advapi32.lib
#guile = $(OUTDIR)/guile.obj
OBJS = \
$(OUTDIR)/ar.obj \
$(OUTDIR)/arscan.obj \
$(OUTDIR)/commands.obj \
$(OUTDIR)/default.obj \
$(OUTDIR)/dir.obj \
$(OUTDIR)/expand.obj \
$(OUTDIR)/file.obj \
$(OUTDIR)/function.obj \
$(OUTDIR)/getloadavg.obj \
$(OUTDIR)/getopt.obj \
$(OUTDIR)/getopt1.obj \
$(OUTDIR)/hash.obj \
$(OUTDIR)/implicit.obj \
$(OUTDIR)/job.obj \
$(OUTDIR)/main.obj \
$(OUTDIR)/misc.obj \
$(OUTDIR)/output.obj \
$(OUTDIR)/read.obj \
$(OUTDIR)/remake.obj \
$(OUTDIR)/remote-stub.obj \
$(OUTDIR)/rule.obj \
$(OUTDIR)/signame.obj \
$(OUTDIR)/strcache.obj \
$(OUTDIR)/variable.obj \
$(OUTDIR)/version.obj \
$(OUTDIR)/vpath.obj \
$(OUTDIR)/glob.obj \
$(OUTDIR)/fnmatch.obj \
$(OUTDIR)/dirent.obj \
$(OUTDIR)/pathstuff.obj \
$(guile)
$(OUTDIR)/make.exe: $(OUTDIR) $(OBJS)
$(LINK) @<<
$(LDFLAGS) $(LIBS) $(OBJS)
<<
.c{$(OUTDIR)}.obj:
$(CC) $(CFLAGS) /c $<
$(OUTDIR)/glob.obj : glob/glob.c
$(CC) $(CFLAGS) /c $?
$(OUTDIR)/fnmatch.obj : glob/fnmatch.c
$(CC) $(CFLAGS) /c $?
$(OUTDIR)/dirent.obj : w32/compat/dirent.c
$(CC) $(CFLAGS) /c $?
$(OUTDIR)/pathstuff.obj : w32/pathstuff.c
$(CC) $(CFLAGS) /c $?

77
README.Amiga Normal file
View File

@ -0,0 +1,77 @@
Short: Port of GNU make with SAS/C (no ixemul.library required)
Author: GNU, Amiga port by Aaron "Optimizer" Digulla
Uploader: Aaron "Optimizer" Digulla (digulla@fh-konstanz.de)
Type: dev/c
This is a pure Amiga port of GNU make. It needs no extra libraries or
anything. It has the following features (in addition to any features of
GNU make):
- Runs Amiga-Commands with SystemTags() (Execute)
- Can run multi-line statements
- Allows to use Device-Names in targets:
c:make : make.o
is ok. To distinguish between device-names and target : or ::, MAKE
looks for spaces. If there are any around :, it's taken as a target
delimiter, if there are none, it's taken as the name of a device. Note
that "make:make.o" tries to create "make.o" on the device "make:".
- Replaces @@ by a newline in any command line:
if exists make @@\
delete make.bak quiet @@\
rename make make.bak @@\
endif @@\
$(CC) Link Make.o To make
works. Note that the @@ must stand alone (i.e., "make@@\" is illegal).
Also be careful that there is a space after the "\" (i.e., at the
beginning of the next line).
- Can be made resident to save space and time
- Amiga specific wildcards can be used in $(wildcard ...)
BUGS:
- The line
dummy.h : src/*.c
tries to make dummy.h from "src/*.c" (i.e., no wildcard-expansion takes
place). You have to use "$(wildcard src/*.c)" instead.
COMPILING FROM SCRATCH
----------------------
To recompile, you need SAS/C 6.51. make itself is not necessary, there
is an smakefile.
1. Copy config.ami to config.h
2. If you use make to compile, copy Makefile.ami to Makefile and
glob/Makefile.ami to glob/Makefile. Copy make into the current
directory.
3. Run smake/make
INSTALLATION
Copy make somewhere in your search path (e.g., sc:c or sc:bin).
If you plan to use recursive makes, install make resident:
Resident make Add
-------------------------------------------------------------------------------
Copyright (C) 1995-2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -27,8 +27,8 @@ New (since 3.74) DOS-specific features:
8. Can be built without (a previous version of) Make.
9. The build process requires only standard tools. (Optional
targets like "check:" still need additional programs, though,
see below.)
targets like "install:" and "clean:" still need additional
programs, though, see below.)
10. Beginning with v3.78, the test suite works in the DJGPP
environment (requires Perl and auxiliary tools; see below).
@ -55,34 +55,78 @@ To build from sources:
either DJTAR (which is part of the DJGPP development
environment), or the DJGPP port of GNU Tar.
2. If you have a working Make already, you can run:
2. Invoke the 'configure.bat' batch file.
make -f Basic.mk
If you are building Make in-place, i.e. in the same directory
where its sources are kept, just type "configure.bat" and press
[Enter]. Otherwise, you need to supply the path to the source
directory as an argument to the batch file, like this:
3. If you don't have a working Make already you can bootstrap one
by running:
c:\djgpp\gnu\make-%VERSION%\configure.bat c:/djgpp/gnu/make-%VERSION%
.\builddos.bat
Note the forward slashes in the source path argument: you MUST
use them here.
4. If you are building from outside of the source directory, you
3. If configure.bat doesn't find a working Make, it will suggest to
use the 'dosbuild.bat' batch file to build Make. Either do as it
suggests or install another Make program (a pre-compiled binary
should be available from the usual DJGPP sites) and rerun
configure.bat.
4. If you will need to run Make on machines without an FPU, you
might consider building a version of Make which doesn't issue
floating-point instructions (they don't help much on MSDOS
anyway). To this end, edit the Makefile created by
configure.bat and add -DNO_FLOAT to the value of CPPFLAGS.
5. Invoke Make.
If you are building from outside of the source directory, you
need to tell Make where the sources are, like this:
make -f c:/djgpp/gnu/make/Basic.mk SRCDIR=c:/djgpp/gnu/make
make srcdir=c:/djgpp/gnu/make-%VERSION%
or:
(configure.bat will tell you this when it finishes). You MUST
use a full, not relative, name of the source directory here, or
else Make might fail.
c:/djgpp/gnu/make/builddos.bat c:/djgpp/gnu/make
6. After Make finishes, if you have a Unix-style shell installed,
you can use the 'install' target to install the package. You
will also need GNU Fileutils and GNU Sed for this (they should
be available from the DJGPP sites).
5. To run the test suite, type "make check". This requires a Unix
By default, GNU make will install into your DJGPP installation
area. If you wish to use a different directory, override the
DESTDIR variable when invoking "make install", like this:
make install DESTDIR=c:/other/dir
This causes the make executable to be placed in c:/other/dir/bin,
the man pages in c:/other/dir/man, etc.
Without a Unix-style shell, you will have to install programs
and the docs manually. Copy make.exe to a directory on your
PATH, make.i* info files to your Info directory, and update the
file 'dir' in your Info directory by adding the following item
to the main menu:
* Make: (make.info). The GNU make utility.
If you have the 'install-info' program (from the GNU Texinfo
package), it will do that for you if you invoke it like this:
install-info --info-dir=c:/djgpp/info c:/djgpp/info/make.info
(If your Info directory is other than C:\DJGPP\INFO, change this
command accordingly.)
7. The 'clean' targets also require Unix-style shell, and GNU Sed
and 'rm' programs (the latter from Fileutils).
8. To run the test suite, type "make check". This requires a Unix
shell (I used the DJGPP port of Bash 2.03), Perl, Sed, Fileutils
and Sh-utils.
6. To install copy make.exe to the preferred location.
Since GNU Make 4.3, support for customized platform installations
has been removed. If you'd like to collaborate on reinstating
these capabilities, contact bug-make@gnu.org.
Notes:
-----
@ -280,7 +324,7 @@ Bug reports:
-------------------------------------------------------------------------------
Copyright (C) 1996-2024 Free Software Foundation, Inc.
Copyright (C) 1996-2013 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
@ -293,4 +337,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,6 +1,6 @@
Port of GNU Make to OS/2.
Port of GNU make to OS/2.
Features of GNU Make that do not work under OS/2:
Features of GNU make that do not work under OS/2:
- remote job execution
- dynamic load balancing
@ -9,7 +9,7 @@ Special features of the OS/2 version:
Due to the fact that some people might want to use sh syntax in
Makefiles while others might want to use OS/2's native shell cmd.exe,
GNU Make supports both shell types. The following list defines the order
GNU make supports both shell types. The following list defines the order
that is used to determine the shell:
1. The shell specified by the environment variable MAKESHELL.
@ -37,7 +37,7 @@ I. ***** SPECIAL OPTIONS *****
cmd or by specifying SHELL=cmd in your Makefile.
- At compile time you can set CPPFLAGS="-DNO_CHDIR2" to turn off that
GNU Make prints drive letters. This is necessary if you want to run
GNU make prints drive letters. This is necessary if you want to run
the testsuite.
@ -49,7 +49,7 @@ A standard Unix like build environment:
release 2)
If you use pdksh it is recommended to update to 5.2.14 release 2. Older
versions may not work! You can get this version at
https://www.math.ohio-state.edu/~ilya/software/os2/pdksh-5.2.14-bin-2.zip
http://www.math.ohio-state.edu/~ilya/software/os2/pdksh-5.2.14-bin-2.zip
- GNU file utilities (make sure that install.exe from the file utilities
is in front of your PATH before X:\OS2\INSTALL\INSTALL.EXE. I recommend
also to change the filename to ginstall.exe instead of install.exe
@ -59,7 +59,7 @@ A standard Unix like build environment:
- gawk
- grep
- sed
- GNU Make 3.79.1 (special OS/2 patched version) or higher
- GNU make 3.79.1 (special OS/2 patched version) or higher
- perl 5.005 or higher
- GNU texinfo (you can use 3.1 (gnuinfo.zip), but I recommend 4.0)
@ -73,7 +73,7 @@ III. ***** COMPILATION AND INSTALLATION *****
To recreate the configuration files use:
export EMXSHELL=ksh
aclocal -I m4
aclocal -I config
automake
autoconf
autoheader
@ -93,7 +93,7 @@ Recommended environment variables and installation options:
export CFLAGS="-O2 -Zomf -Zmt"
export LDFLAGS="-Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000"
export RANLIB="echo"
./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man
./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man --without-included-gettext
make AR=emxomfar
make install
@ -102,21 +102,18 @@ Note: If you use gcc 2.9.x I recommend to set also LIBS="-lgcc"
Note: You can add -DNO_CMD_DEFAULT and -DNO_CHDIR2 to CPPFLAGS.
See section I. for details.
Note: If you use Open Watcom Linker instead of IBM Linker, remove
'-Zlinker /exepack:2' from LDFLAGS.
IV. ***** NLS support *****
GNU Make has NLS (National Language Support), with the following
GNU make has NLS (National Language Support), with the following
caveats:
a) It will only work with GNU gettext, and
b) GNU gettext support is not included in the GNU Make package.
b) GNU gettext support is not included in the GNU make package.
Therefore, if you wish to enable the internationalization features of
GNU Make you must install GNU gettext on your system before configuring
GNU Make.
GNU make you must install GNU gettext on your system before configuring
GNU make.
You can choose the languages to be installed. To install support for
English, German and French only enter:
@ -141,7 +138,7 @@ testsuite itself. -DNO_CMD_DEFAULT causes make to use /bin/sh as default
shell in every case. Normally you could simply set MAKESHELL="/bin/sh"
to do this but the testsuite ignores the environment. -DNO_CHDIR2 causes
make not to use drive letters for directory names (i.e. _chdir2() and
_getcwd2() are NOT used). The testsuite interprets the whole output of
_getcwd2() are NOT used). The testsuite interpretes the whole output of
make, especially statements like make[1]: Entering directory
'C:/somewhere/make-3.79.1/tests' where the testsuite does not expect the
drive letter. This would be interpreted as an error even if there is
@ -163,7 +160,7 @@ from the make source tree.
-------------------------------------------------------------------------------
Copyright (C) 2003-2024 Free Software Foundation, Inc.
Copyright (C) 2003-2013 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
@ -176,4 +173,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,515 +0,0 @@
Overview: -*-text-mode-*-
---------
This version of GNU Make has been tested on:
OpenVMS V8.3/V8.4 (Alpha) and V8.4 (Integrity) AND V7.3 (VAX)
This version of GNU Make is intended to be run from DCL to run
make scripts with a special syntax that is described below. It
likely will not be able to run unmodified Unix makefiles.
There is an older implementation of GNU Make that was ported to GNV.
Work is now in progress to merge that port to get a single version
of GNU Make available. When that merge is done, GNU Make will auto
detect that it is running under a POSIX shell and then operate as close to
GNU Make on Unix as possible.
The descriptions below are for running GNU Make from DCL or equivalent.
Recipe differences:
-------------------
GNU Make for OpenVMS can not currently run native Unix make files because of
differences in the implementation.
I am trying to document the current behavior in this section. This is based
on the information in the file NEWS. and running the test suite.
TODO: More tests are needed to validate and demonstrate the OpenVMS
expected behavior.
In some cases the older behavior of GNU Make when run from DCL is not
compatible with standard makefile behavior.
This behavior can be changed when running GNU Make from DCL by setting
either DCL symbols or logical names of the format GNV$. The settings
are enabled with a string starting with one of '1', 'T', or 'E' for "1",
"TRUE", or "ENABLE". They are disabled with a '0', 'F', or 'D' for "1",
"FALSE", or "DISABLE". If they are not explicitly set to one of these
values, then they will be set to their default values.
The value of the setting DECC$FILENAME_UNIX_REPORT or
DECC$FILENAME_UNIX_ONLY will now cause the $(dir x) function to return
'./' or '[]' as appropriate.
The name GNV$MAKE_OLD_VMS when enabled will cause GNU Make to behave as
much as the older method as can be done with out disabling VMS features.
When it is disabled GNU Make have the new behavior which more closely
matches Unix Make behavior.
The default is currently the old behavior when running GNU Make from DCL.
In the future this may change. When running make from GNV Bash the new
behavior is the default.
This is a global setting that sets the default behavior for several other
options that can be individually changed. Many of the individual settings
are to make it so that the self tests for GNU Make need less VMS specific
modifications.
The name GNV$MAKE_COMMA when enabled will cause GNU Make to expect a comma
for a path separator and use a comma for the separator for a list of files.
When disabled, it will cause GNU Make to use a colon for a path separator
and a space for the separator for a list of files. The default is to be
enabled if the GNU Make is set to the older behavior.
The name GNV$MAKE_SHELL_SIM when enabled will cause GNU Make to try to
simulate a POSIX shell more closely. The following behaviors occur:
* Single quotes are converted to double quotes and any double
quotes inside of them are doubled. No environment variable expansion
is simulated.
* A exit command status will be converted to a POSIX Exit
where 0 is success and non-zero is failure.
* The $ character will cause environment variable expansion.
* Environment variables can be set on the command line before a command.
VMS generally uses logical name search lists instead of path variables
where the resolution is handled by VMS independent of the program. Which
means that it is likely that nothing will notice if the default path
specifier is changed in the future.
Currently the built in VMS specific macros and recipes depend on the comma
being used as a file list separator.
TODO: Remove this dependency as other functions in GNU Make depend on a
space being used as a separator.
The format for recipes are a combination of Unix macros, a subset of
simulated UNIX commands, some shell emulation, and OpenVMS commands.
This makes the resulting makefiles unique to the OpenVMS port of GNU Make.
If you are creating a OpenVMS specific makefile from scratch, you should also
look at MMK (Madgoat Make) available at https://github.com/endlesssoftware/mmk
MMK uses full OpenVMS syntax and a persistent sub-process is used for the
recipe lines, allowing multiple line rules.
The default makefile search order is "makefile.vms", "gnumakefile",
"makefile". TODO: See if that lookup is case sensitive.
When Make is invoked from DCL, it will create a foreign command
using the name of executable image, with any facility prefix removed,
for the duration of the make program, so it can be used internally
to recursively run make(). The macro MAKE_COMMAND will be set to
this foreign command.
When make is launched from an exec*() command from a C program,
the foreign command is not created. The macro MAKE_COMMAND will be
set to the actual command passed as argv[0] to the exec*() function.
If the DCL symbol or logical name GNV$MAKE_USE_MCR exists, then
the macro MAKE_COMMAND will be set to be an "MCR" command with the
absolute path used by DCL to launch make. The foreign command
will not be created.
The macro MAKE is set to be the same value as the macro MAKE_COMMAND
on all platforms.
Each recipe command is normally run as a separate spawned processes,
except for the cases documented below where a temporary DCL command
file may be used.
BUG: Testing has shown that the commands in the temporary command files
are not always created properly. This issue is still under investigation.
Any macros marked as exported are temporarily created as DCL symbols
for child images to use. DCL symbol substitution is not done with these
commands.
Untested: Symbol substitution.
When a temporary DCL command file is used, DCL symbol substitution
will work.
For VMS 7.3-1 and earlier, command lines are limited to 255 characters
or 1024 characters in a command file.
For VMS 7.3-2 and later, command lines are limited to 4059 characters
or 8192 characters in a command file.
VMS limits each token of a command line to 256 characters, and limits
a command line to 127 tokens.
Command lines above the limit length are written to a command file
in sys$scratch:.
In order to handle Unix style extensions to VMS DCL, GNU Make has
parsed the recipe commands and them modified them as needed. The
parser has been re-written to resolve numerous bugs in handling
valid VMS syntax and potential buffer overruns.
The new parser may need whitespace characters where DCL does not require
it, and also may require that quotes are matched were DCL forgives if
they are not. There is a small chance that existing VMS specific makefiles
will be affected.
The '<', '>' was previously implemented using command files. Now
GNU Make will check to see if the is already a VMS "PIPE" command and
if it is not, will convert the command to a VMS "PIPE" command.
The '>>' redirection has been implemented by using a temporary command file.
This will be described later.
The DCL symbol or logical name GNV$MAKE_USE_CMD_FILE when set to a
string starting with one of '1','T', or 'E' for "1", "TRUE", or "ENABLE",
then temporary DCL command files are always used for running commands.
Some recipe strings with embedded new lines will not be handled correctly
when a command file is used.
GNU Make generally does text comparisons for the targets and sources. The
make program itself can handle either Unix or OpenVMS format filenames, but
normally does not do any conversions from one format to another.
TODO: The OpenVMS format syntax handling is incomplete.
TODO: ODS-5 EFS support is missing.
BUG: The internal routines to convert filenames to and from OpenVMS format
do not work correctly.
Note: In the examples below, line continuations such as a backslash may have
been added to make the examples easier to read in this format.
BUG: That feature does not completely work at this time.
Since the OpenVMS utilities generally expect OpenVMS format paths, you will
usually have to use OpenVMS format paths for rules and targets.
BUG: Relative OpenVMS paths may not work in targets, especially combined
with vpaths. This is because GNU Make will just concatenate the directories
as it does on Unix.
The variables $^ and $@ separate files with commas instead of spaces.
This is controlled by the name GNV$MAKE_COMMA as documented in the
previous section.
While this may seem the natural thing to do with OpenVMS, it actually
causes problems when trying to use other make functions that expect the
files to be separated by spaces. If you run into this, you need the
following workaround to convert the output.
TODO: Look at have the $^ and $@ use spaces like on Unix and have
and easy to use function to do the conversions and have the built
in OpenVMS specific recipes and macros use it.
Example:
comma := ,
empty :=
space := $(empty) $(empty)
foo: $(addsuffix .3,$(subs $(comma),$(space),$^)
Makefile variables are looked up in the current environment. You can set
symbols or logicals in DCL and evaluate them in the Makefile via
$(<name-of-symbol-or-logical>). Variables defined in the Makefile
override OpenVMS symbols/logicals.
OpenVMS logical and symbols names show up as "environment" using the
origin function. when the "-e" option is specified, the origin function
shows them as "environment override". On POSIX the test scripts indicate
that they should show up just as "environment".
When GNU Make reads in a symbol or logical name into the environment, it
converts any dollar signs found to double dollar signs for convenience in
using DCL symbols and logical names in recipes. When GNU Make exports a
DCL symbol for a child process, if the first dollar sign found is followed
by second dollar sign, then all double dollar signs will be converted to
single dollar signs.
The variable $(ARCH) is predefined as IA64, ALPHA or VAX respectively.
Makefiles for different OpenVMS systems can now be written by checking
$(ARCH). Since IA64 and ALPHA are similar, usually just a check for
VAX or not VAX is sufficient.
You may have to update makefiles that assume VAX if not ALPHA.
ifeq ($(ARCH),VAX)
$(ECHO) "On the VAX"
else
$(ECHO) "On the ALPHA or IA64"
endif
Empty commands are handled correctly and don't end in a new DCL process.
The exit command needs to have OpenVMS exit codes. To pass a POSIX code
back to the make script, you need to encode it by multiplying it by 8
and then adding %x1035a002 for a failure code and %x1035a001 for a
success. Make will interpret any POSIX code other than 0 as a failure.
TODO: Add an option have simulate POSIX exit commands in recipes.
Lexical functions can be used in pipes to simulate shell file test rules.
Example:
POSIX:
b : c ; [ -f $@ ] || echo >> $@
OpenVMS:
b : c ; if f$$search("$@") then pipe open/append xx $@ ; write xx "" ; close xx
You can also use pipes and turning messages off to silently test for a
failure.
x = %x1035a00a
%.b : %.c
<tab>pipe set mess/nofac/noiden/nosev/notext ; type $^/output=$@ || exit $(x)
Runtime issues:
The OpenVMS C Runtime has a convention for encoding a POSIX exit status into
to OpenVMS exit codes. These status codes will have the hex value of
0x35a000. OpenVMS exit code may also have a hex value of %x10000000 set on
them. This is a flag to tell DCL not to write out the exit code.
To convert an OpenVMS encoded POSIX exit status code to the original code
You subtract %x35a000 and any flags from the OpenVMS code and divide it by 8.
WARNING: Backward-incompatibility!
The make program exit now returns the same encoded POSIX exit code as on
Unix. Previous versions returned the OpenVMS exit status code if that is what
caused the recipe to fail.
TODO: Provide a way for scripts calling make to obtain that OpenVMS status
code.
Make internally has two error codes, MAKE_FAILURE and MAKE_TROUBLE. These
will have the error "-E-" severity set on exit.
MAKE_TROUBLE is returned only if the option "-q" or "--question" is used and
has a POSIX value of 1 and an OpenVMS status of %x1035a00a.
MAKE_FAILURE has a POSIX value of 2 and an OpenVMS status of %x1035a012.
Output from GNU Make may have single quotes around some values where on
other platforms it does not. Also output that would be in double quotes
on some platforms may show up as single quotes on VMS.
There may be extra blank lines in the output on VMS.
https://savannah.gnu.org/bugs/?func=detailitem&item_id=41760
There may be a "Waiting for unfinished jobs..." show up in the output.
Error messages generated by Make or Unix utilities may slightly vary from
POSIX platforms. Typically the case may be different.
When make deletes files, on POSIX platforms it writes out 'rm' and the list
of files. On VMS, only the files are written out, one per line.
TODO: VMS
There may be extra leading white space or additional or missing whitespace
in the output of recipes.
GNU Make uses sys$scratch: for the tempfiles that it creates.
The OpenVMS CRTL library maps /tmp to sys$scratch if the TMP: logical name
does not exist. As the CRTL may use both sys$scratch: and /tmp internally,
if you define the TMP logical name to be different than SYS$SCRATCH:,
you may end up with only some temporary files in TMP: and some in SYS$SCRATCH:
The default include directory for including other makefiles is
SYS$SYSROOT:[SYSLIB] (I don't remember why I didn't just use
SYS$LIBRARY: instead; maybe it wouldn't work that way).
TODO: A better default may be desired.
If the device for a file in a recipe does not exist, on OpenVMS an error
message of "stat: <file>: no such device or address" will be output.
Make ignores success, informational, or warning errors (-S-, -I-, or
-W-). But it will stop on -E- and -F- errors. (unless you do something
to override this in your makefile, or whatever).
Unix compatibility features:
----------------------------
If the command 'echo' is seen, any single quotes on the line will be
converted to double quotes.
The variable $(CD) is implemented as a built in Change Directory
command. This invokes the 'builtin_cd' Executing a 'set default'
recipe doesn't do the trick, since it only affects the sub-process
spawned for that command.
The 'builtin_cd' is generally expected to be on its own line.
The 'builtin_cd' either from the expansion of $(CD) or directly
put in a recipe line will be executed before any other commands in
that recipe line. DCL parameter substitution will not work for the
'builtin_cd' command.
Putting a 'builtin_cd' in a pipeline or an IF-THEN line should not be
done because the 'builtin_cd' is always executed
and executed first. The directory change is persistent.
Unix shell style I/O redirection is supported. You can now write lines like:
"<tab>mcr sys$disk:[]program.exe < input.txt > output.txt &> error.txt"
POSIX shells have ":" as a null command. These are now handled.
https://savannah.gnu.org/bugs/index.php?41761
A note on appending the redirected output. A simple mechanism is
implemented to make ">>" work in action lines. In OpenVMS there is no simple
feature like ">>" to have DCL command or program output redirected and
appended to a file. GNU Make for OpenVMS implements the redirection
of ">>" by using a command procedure.
The current algorithm creates the output file if it does not exist and
then uses the DCL open/append to extend it. SYS$OUTPUT is then directed
to that file.
The implementation supports only one redirected append output to a file
and that redirection is done before any other commands in that line
are executed, so it redirects all output for that command.
The older implementation wrote the output to a temporary file in
in sys$scratch: and then attempted to append the file to the existing file.
The temporary file names looked like "CMDxxxxx.". Any time the created
command procedure can not complete, this happens. Pressing CTRL+Y to
abort make is one case.
In case of CTRL+Y the associated command procedure is left in SYS$SCRATCH:.
The command procedures will be named gnv$make_cmd*.com.
The CtrlY handler now uses $delprc to delete all children. This way also
actions with DCL commands will be stopped. As before the CtrlY handler
then sends SIGQUIT to itself, which is handled in common code.
Temporary command files are now deleted in the OpenVMS child termination
handler. That deletes them even if a CTRL+C was pressed.
TODO: Does the previous section about >> leaving files still apply?
The behavior of pressing CTRL+C is not changed. It still has only an effect,
after the current action is terminated. If that doesn't happen or takes too
long, CTRL+Y should be used instead.
Build Options:
Added support to have case sensitive targets and dependencies but to
still use case blind file names. This is especially useful for Java
makefiles on VMS:
<TAB>.SUFFIXES :
<TAB>.SUFFIXES : .class .java
<TAB>.java.class :
<TAB><TAB>javac "$<"
<TAB>HelloWorld.class : HelloWorld.java
A new macro WANT_CASE_SENSITIVE_TARGETS in config.h-vms was introduced.
It needs to be enabled to get this feature; default is disabled.
TODO: This should be a run-time setting based on if the process
has been set to case sensitive.
Unimplemented functionality:
The new feature "Loadable objects" is not yet supported. If you need it,
please send a change request or submit a bug report.
The new option --output-sync (-O) is accepted but has no effect: GNU Make
for OpenVMS does not support running multiple commands simultaneously.
Self test failures and todos:
-----------------------------
The test harness can not handle testing some of the VMS specific modes
because of the features needed for to be set for the Perl to run.
Need to find a way to set the VMS features before running make as a
child.
GNU Make was not currently translating the OpenVMS encoded POSIX values
returned to it back to the POSIX values. I have temporarily modified the
Perl test script to compensate for it. This should be being handled
internally to Make.
TODO: Verify and update the Perl test script.
The features/parallelism test was failing. OpenVMS is executing the rules
in sequence not in parallel as this feature was not implemented.
GNU Make on VMS no longer claims it is implemented.
TODO: Implement it.
Symlink support is not present. Symlinks are supported by OpenVMS 8.3 and
later.
Error messages should be suppressed with the "-" at the beginning of a line.
On openVMS they were showing up. TODO: Is this still an issue?
The internal vmsify and unixify OpenVMS to/from UNIX are not handling logical
names correctly.
Build instructions:
-------------------
Don't use the HP C V7.2-001 compiler, which has an incompatible change
how __STDC__ is defined. This results at least in compile time warnings.
Make a 1st version
$ @makefile.com ! ignore any compiler and/or linker warning
$ copy make.exe 1st-make.exe
Use the 1st version to generate a 2nd version as a test.
$ mc sys$disk:[]1st-make clean ! ignore any file not found messages
$ mc sys$disk:[]1st-make
Verify your 2nd version by building Make again.
$ copy make.exe 2nd-make.exe
$ mc sys$disk:[]2nd-make clean
$ mc sys$disk:[]2nd-make
Running the tests:
------------------
Running the tests on OpenVMS requires the following software to be installed
as most of the tests are Unix oriented.
* Perl 5.18 or later.
https://sourceforge.net/projects/vmsperlkit/files/
* GNV 2.1.3 + Updates including a minimum of:
* Bash 4.3.30
* ld_tools 3.0.2
* coreutils 8.21
https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/
https://sourceforge.net/projects/gnv/files/
As the test scripts need to create some foreign commands that persist
after the test is run, it is recommend that either you use a sub-process or
a dedicated login to run the tests.
To get detailed information for running the tests:
$ set default [.tests]
$ @run_make_tests help
Running the script with no parameters will run all the tests.
After the the test script has been run once in a session, assuming
that you built make in sys$disk:[make], you can redefined the
"bin" logical name as follows:
$ define bin sys$disk:[make],gnv$gnu:[bin]
Then you can use Perl to run the scripts.
$ perl run_make_tests.pl
Acknowledgments:
----------------
See NEWS. for details of past changes.
These are the currently known contributors to this port.
Hartmut Becker
John Malmberg
Michael Gehre
John Eisenbraun
Klaus Kaempf
Mike Moretti
John W. Eaton

View File

@ -1,46 +1,52 @@
This version of GNU Make has been tested on:
Microsoft Windows 2000/XP/2003/Vista/7/8/10/11
This version of GNU make has been tested on
Microsoft Windows 2000/XP/2003/Vista/7/2008.
It has also been used on Windows 95/98/NT, and on OS/2.
It builds with the MinGW port of GCC (tested with GCC 3.4.2, 4.8.1,
and 4.9.3).
It builds with the MinGW port of GCC (tested with GCC 3.4.2).
It also builds with MSVC 2.x, 4.x, 5.x, 6.x, 2005, 2008, 2010, 2012,
2013, and 2015 as well as with .NET 7.x and .NET 2003.
It also builds with MSVC 2.x, 4.x, 5.x, 6.x, and 2003 as well as
with .NET 7.x and .NET 2003.
Building with Guile is supported (tested with Guile 2.0.x). To build
with Guile, you will need, in addition to Guile itself, its dependency
libraries and the pkg-config program. The latter is used to figure out
which compilation and link switches and libraries need to be mentioned
on the compiler command lines to correctly link with Guile. A Windows
port of pkg-config can be found on ezwinports site:
As of version 3.83, a build with Guile is supported (tested with Guile
2.0.3). To build with Guile, you will need, in addition to Guile
itself, its dependency libraries and the pkg-config program. The
latter is used to figure out which compilation and link switches and
libraries need to be mentioned on the compiler command lines to
correctly link with Guile. A Windows port of pkg-config can be found
on the Windows download page of the GTK+ project:
https://sourceforge.net/projects/ezwinports/
http://www.gtk.org/download/win32.php
The libraries on which Guile depends can vary depending on your
version and build of Guile. At the very least, the Boehm's GC library
will be needed, and typically also GNU MP, libffi, libunistring, and
libtool's libltdl. Whoever built the port of Guile you have should
also provide you with these dependencies or a URL where to download
them. A precompiled 32-bit Windows build of Guile is available from
the ezwinports site mentioned above.
them.
The Windows port of GNU Make is maintained jointly by various people.
It was originally made by Rob Tulloh.
It is currently maintained by Eli Zaretskii.
The Windows 32-bit port of GNU make is maintained jointly by various
people. It was originally made by Rob Tulloh.
Do this first, regardless of the build method you choose:
---------------------------------------------------------
1. If you have special requirements, edit config.h.W32 to your liking
(especially the shell-related defines, or HAVE_CASE_INSENSITIVE_FS which
corresponds to './configure --enable-case-insensitive-file-system'). We
don't recommend to define HAVE_CASE_INSENSITIVE_FS, but you may wish to
consider that if you have a lot of files whose names are in upper case,
while Makefile rules are written for lower-case versions.
1. At the Windows command prompt run:
If you don't have special requirements no changes are needed.
if not exist NMakefile copy NMakefile.template NMakefile
if not exist config.h copy config.h.W32 config.h
Then edit config.h to your liking (especially the few shell-related
defines near the end, or HAVE_CASE_INSENSITIVE_FS which corresponds
to './configure --enable-case-insensitive-file-system').
Using make_msvc_net2003.vcproj
------------------------------
2. Open make_msvc_net2003.vcproj in MSVS71 or MSVC71 or any compatible IDE,
then build this project as usual. There's also a solution file for
Studio 2003.
Building with (MinGW-)GCC using build_w32.bat
@ -49,116 +55,47 @@ Building with (MinGW-)GCC using build_w32.bat
2. Open a W32 command prompt for your installed (MinGW-)GCC, setup a
correct PATH and other environment variables for it, then execute ...
.\build_w32.bat gcc
build_w32.bat gcc
This produces gnumake.exe in the GccRel directory.
If you want a version of GNU Make built with debugging enabled,
add the --debug option. Output goes into the GccDebug directory.
This produces gnumake.exe in the current directory.
The batch file will probe for Guile installation, and will build
gnumake.exe with Guile if it finds it. If you have Guile
installed, but want to build Make without Guile support, type
.\build_w32.bat --without-guile gcc
build_w32.bat --without-guile gcc
Building with (MSVC++-)cl using build_w32.bat
---------------------------------------------
Building with (MSVC++-)cl using build_w32.bat or NMakefile
----------------------------------------------------------
2. Open a command shell, then execute ...
2. Open a W32 command prompt for your installed (MSVC++-)cl, setup a
correct PATH and other environment variables for it (usually via
executing vcvars32.bat or vsvars32.bat from the cl-installation,
e.g. "%VS71COMNTOOLS%vsvars32.bat"; or using a corresponding start
menue entry from the cl-installation), then execute EITHER ...
.\build_w32.bat
build_w32.bat
This produces a 64bit Release build of gnumake.exe in .\WinRel, using
the compiler found on the %Path%. If no compiler is found, the batch
file will probe your system and choose the newest MSVC version it can
find.
(this produces WinDebug/gnumake.exe and WinRel/gnumake.exe)
If you want a 32bit version of GNU Make, add the --x86 option.
... OR ...
If you want a Debug build of GNU Make, add the --debug option. Output
will go into the .\WinDebug directory.
nmake /f NMakefile
(this produces WinDebug/make.exe and WinRel/make.exe).
The batch file will probe for Guile installation, and will build
gnumake.exe with Guile if it finds it. If Guile is installed,
but you prefer to build GNU Make without Guile support, add the
--without-guile option.
Building with (MinGW-)GCC using GNU Make
----------------------------------------
2. If you already have a version of GNU Make available you can use it
to build this version. Open a W32 command prompt for your installed
(MinGW-)GCC, setup a correct PATH and other environment variables
for it, then execute ...
make -f Basic.mk TOOLCHAIN=gcc
This produces GccRel\gnumake.exe.
If you want a version of GNU Make built with debugging enabled,
add the TARGET_TYPE=debug option:
make -f Basic.mk TOOLCHAIN=gcc TARGET_TYPE=debug
The makefile doesn't support Guile integration. Use build_w32.bat
if you want to build with Guile support.
Building with (MSVC++-)cl using GNU Make
----------------------------------------
2. If you already have a version of GNU Make available you can use it
to build this version. Open a W32 command prompt for your installed
(MSVC++-)cl, setup a correct PATH and other environment variables
for it (usually via executing vcvars32.bat or vsvars32.bat from the
cl-installation, or using a corresponding start menu entry from the
cl-installation), then execute ...
make -f Basic.mk
This produces an optimized WinRel/gnumake.exe.
If you want a version of GNU Make built with debugging enabled,
add the TARGET_TYPE=debug option:
make -f Basic.mk TARGET_TYPE=debug
The makefile doesn't support Guile integration. Use build_w32.bat
if you want to build with Guile support.
Running the test suite
----------------------
3. You will need an installation of Perl. Be sure to use a relatively
modern version: older versions will sometimes throw spurious errors.
To run the suite after building using GNU Make, use:
make -f Basic.mk check
Alternatively if you'd like to run tests by hand, use:
cd tests
.\run_make_tests.bat -make <path-to-make>
I've found <path-to-make> seems to want forward-slashes in the path.
For example if building with .\build_w32.bat non-debug, use:
cd tests
.\run_make_tests.bat -make ../WinRel/gnumake.exe
I've tested this with the MSYS2 shell and POSIX tools installation
that you get by installing Git for Windows.
gnumake.exe with Guile if it finds it. If you have Guile
installed, but want to build Make without Guile support, type
build_w32.bat --without-guile
-------------------
-- Notes/Caveats --
-------------------
GNU Make on Windows 32-bit platforms:
GNU make on Windows 32-bit platforms:
This version of make is ported natively to Windows32 platforms
(Windows NT 3.51, Windows NT 4.0, Windows 2000, Windows XP,
@ -168,11 +105,11 @@ GNU Make on Windows 32-bit platforms:
officially are the MinGW port of GNU GCC, and the various
versions of the Microsoft C compiler.
Do not confuse this port of GNU Make with other Windows32 projects
which provide a GNU Make binary. These are separate projects
Do not confuse this port of GNU make with other Windows32 projects
which provide a GNU make binary. These are separate projects
and are not connected to this port effort.
GNU Make and sh.exe:
GNU make and sh.exe:
This port prefers if you have a working sh.exe somewhere on
your system. If you don't have sh.exe, the port falls back to
@ -182,12 +119,12 @@ GNU Make and sh.exe:
There are very few true ports of Bourne shell for NT right now.
There is a version of GNU bash available from Cygnus "Cygwin"
porting effort (https://www.cygwin.com/).
porting effort (http://www.cygwin.com/).
Other possibilities are the MKS version of sh.exe, or building
your own with a package like NutCracker (DataFocus) or Portage
(Consensys). Also MinGW includes sh.
(Consensys). Also MinGW includes sh (http://mingw.org/).
GNU Make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
GNU make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
Some versions of Bourne shell do not behave well when invoked
as 'sh -c' from CreateProcess(). The main problem is they seem
@ -210,24 +147,26 @@ GNU Make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
Support for parallel builds
Parallel builds (-jN) are supported in this port. The number of
concurrent processes has a hard limit of 4095.
Parallel builds (-jN) are supported in this port, with 1
limitation: The number of concurrent processes has a hard
limit of 64, due to the way this port implements waiting for
its subprocesses.
GNU Make and Cygnus GNU Windows32 tools:
GNU make and Cygnus GNU Windows32 tools:
Good news! Make now has native support for Cygwin sh. To enable,
define the HAVE_CYGWIN_SHELL in config.h and rebuild make
from scratch. This version of make tested with B20.1 of Cygwin.
Do not define BATCH_MODE_ONLY_SHELL if you use HAVE_CYGWIN_SHELL.
GNU Make and the MKS shell:
GNU make and the MKS shell:
There is now semi-official support for the MKS shell. To turn this
support on, define HAVE_MKS_SHELL in the config.h.W32 before you
build make. Do not define BATCH_MODE_ONLY_SHELL if you turn
on HAVE_MKS_SHELL.
GNU Make handling of drive letters in pathnames (PATH, vpath, VPATH):
GNU make handling of drive letters in pathnames (PATH, vpath, VPATH):
There is a caveat that should be noted with respect to handling
single character pathnames on Windows systems. When colon is
@ -265,6 +204,13 @@ GNU Make handling of drive letters in pathnames (PATH, vpath, VPATH):
both Unix and Windows systems, then no ifdef'ing will be
necessary in the makefile source.
GNU make test suite:
I verified all functionality with a slightly modified version
of make-test-%VERSION% (modifications to get test suite to run
on Windows NT). All tests pass in an environment that includes
sh.exe. Tests were performed on both Windows NT and Windows 95.
Pathnames and white space:
Unlike Unix, Windows 95/NT systems encourage pathnames which
@ -293,7 +239,7 @@ Pathnames and Case insensitivity:
the file with other case permutations will succeed (i.e. opening a
file named "target" or "TARGET" will open the file "Target").
By default, GNU Make retains its case sensitivity when comparing
By default, GNU make retains its case sensitivity when comparing
target names and existing files or directories. It can be
configured, however, into a case preserving and case insensitive
mode by adding a define for HAVE_CASE_INSENSITIVE_FS to
@ -311,10 +257,10 @@ Pathnames and Case insensitivity:
SUBDIR/DepTarget: SubDir/TARGET
cp $^ $@
Reliance on this behavior also eliminates the ability of GNU Make
Reliance on this behavior also eliminates the ability of GNU make
to use case in comparison of matching rules. For example, it is
not possible to set up a C++ rule using %.C that is different
than a C rule using %.c. GNU Make will consider these to be the
than a C rule using %.c. GNU make will consider these to be the
same rule and will issue a warning.
SAMBA/NTFS/VFAT:
@ -344,10 +290,10 @@ FAT:
Bug reports:
Please submit bugs via the normal bug reporting mechanism which
is described in the GNU Make manual and the base README.
is described in the GNU make manual and the base README.
-------------------------------------------------------------------------------
Copyright (C) 1996-2024 Free Software Foundation, Inc.
Copyright (C) 1996-2013 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
@ -360,4 +306,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,6 +1,6 @@
-*-indented-text-*-
GNU Make can utilize the Customs library, distributed with Pmake, to
GNU make can utilize the Customs library, distributed with Pmake, to
provide builds distributed across multiple hosts.
In order to utilize this capability, you must first download and build
@ -21,11 +21,11 @@ please see the pmake and Customs documentation for details. The best
place to look for instructions is in the pmake-2.1.33/INSTALL file.
Note that the 2.1.33 Pmake distribution comes with a set of patches to
GNU Make, distributed in the pmake-2.1.33/etc/gnumake/ directory. These
patches are based on GNU Make 3.75 (there are patches for earlier
versions of GNU Make, also). The parts of this patchfile which relate
GNU make, distributed in the pmake-2.1.33/etc/gnumake/ directory. These
patches are based on GNU make 3.75 (there are patches for earlier
versions of GNU make, also). The parts of this patchfile which relate
directly to Customs support have already been incorporated into this
version of GNU Make, so you should _NOT_ apply the patch file.
version of GNU make, so you should _NOT_ apply the patch file.
However, there are a few non-Customs specific (as far as I could tell)
changes here which are not incorporated (for example, the modification
@ -42,14 +42,14 @@ install' there directly).
BUILDING GNU MAKE
-----------------
Once you've installed Customs, you can build GNU Make to use it. When
configuring GNU Make, merely use the '--with-customs=DIR' option.
Once you've installed Customs, you can build GNU make to use it. When
configuring GNU make, merely use the '--with-customs=DIR' option.
Provide the directory containing the 'lib' and 'include/customs'
subdirectories as DIR. For example, if you installed the customs
library in /usr/local/lib and the headers in /usr/local/include/customs,
then you'd pass '--with-customs=/usr/local' as an option to configure.
Run make (or use build.sh) normally to build GNU Make as described in
Run make (or use build.sh) normally to build GNU make as described in
the INSTALL file.
See the documentation for Customs for information on starting and
@ -83,7 +83,7 @@ PROBLEMS
SunOS 4.1.x:
The customs/sprite.h header file #includes the <malloc.h> header
files; this conflicts with GNU Make's configuration so you'll get a
files; this conflicts with GNU make's configuration so you'll get a
compile error if you use GCC (or any other ANSI-capable C compiler).
I commented out the #include in sprite.h:107:
@ -96,7 +96,7 @@ SunOS 4.1.x:
-------------------------------------------------------------------------------
Copyright (C) 1998-2024 Free Software Foundation, Inc.
Copyright (C) 1998-2013 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
@ -109,4 +109,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,7 +1,7 @@
-*-text-*-
-------------------------------------------------------------------------------
Copyright (C) 2002-2024 Free Software Foundation, Inc.
Copyright (C) 2002-2013 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
@ -14,7 +14,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------------
Obtaining Git Code
@ -23,7 +23,7 @@ Obtaining Git Code
This seems redundant, since if you're reading this you most likely have
already performed this step; however, for completeness, you can obtain the GNU
make source code via Git from the FSF's Savannah project
<https://savannah.gnu.org/projects/make/>:
<http://savannah.gnu.org/projects/make/>:
$ git clone git://git.savannah.gnu.org/make.git
@ -31,379 +31,231 @@ make source code via Git from the FSF's Savannah project
Changes using Git
-----------------
If you do not have push privileges to the GNU Make Git repository, see the
README file section "Submitting Patches" for information.
For non-developers, please continue to provide patches as before, or if you
make a public repository I can pull from that if you prefer.
If you have push privileges to the GNU Make Git repository keep this
information in mind:
For developers, I'm still new to Git myself, so I don't have a ton of advice.
In this release we will continue to create ChangeLog files by hand so please
don't forget to update the ChangeLog.
Starting with GNU Make 4.0 we no longer keep a separate ChangeLog file in
source control. We use the Gnulib git-to-changelog conversion script to
convert the Git comments into ChangeLog-style entries for release. As a
result, please format your Git comments carefully so they will look clean
after conversion. In particular, each line of your comment will have a TAB
added before it so be sure your comment lines are not longer than 72
characters; prefer 70 or less. Please use standard ChangeLog formats for
your commit messages (sans the leading TAB of course).
Rule #1: Don't rewrite pushed history on master (no "git push --force").
Rule #2: Feel free to rewrite pushed history on personal branches.
Rule #3: Squash-merge or rebase + merge --ff-only, rather than merging from
personal branches into master.
Rule #1: Don't rewrite pushed history (don't use "git push --force").
Typical simple workflow might be:
* Edit files / make / make check
* Edit files
* Use "git status" and "git diff" to verify your changes
* Use "git add" to stage the changes you want to make
* Use "git commit" to commit the staged changes to your local repository
* Use "git pull -r" to accept new changes from the upstream repository
* Use "git push" to push your commits back to the upstream repository
* Use "git pull" to accept & merge new changes from the Savannah repository
* Use "git push" to push your commits back to the Savannah repository
For Emacs users, there are many options for Git integration but I strongly
recommend Magit: https://magit.vc/ It makes the workflow much clearer, and
has advanced features such as constructing multiple commits from various files
and even from different diff chunks in the same file. There is a video
available which helps a lot.
recommend the Magit package: http://www.emacswiki.org/emacs/Magit
It makes the workflow much clearer, and has advanced features such as
constructing multiple commits from various files and even from different
diff chunks in the same file. There is a video available which helps a lot.
Coding Standards
----------------
GNU Make code adheres to the GNU Coding Standards. Please use only spaces and
no TAB characters in source code.
GNU make code adheres to the GNU Coding Standards. Additionally, GNU make is
a foundational bootstrap package for the GNU project; as such it is very
conservative about language features it expects. It should build with any C
compiler conforming to the ANSI C89 / ISO C90 standard.
Additionally, GNU Make is a foundational bootstrap package for the GNU
project; as such it is conservative about language features it expects.
However, GNU Make does rely on the Gnulib portability library, and Gnulib
currently requires a ISO C99 compiler. So features in ISO C99 can be
assumed.
Please use only spaces and no TAB characters in source code.
Building From Git for POSIX
---------------------------
Building From Git
-----------------
To build GNU Make from Git on POSIX systems such as GNU/Linux, you will
need to install the following extra software:
* autoconf >= 2.69
* automake >= 1.16.1
* autopoint
* texinfo (for makeinfo)
* gettext
* pkg-config
* GCC
* GNU Make (POSIX make is not sufficient)
And any tools that those utilities require (GNU m4, etc.)
To run the tests you must install Perl.
To create dist files you will additionally need:
* lzip (to create tar.lz dist files)
* texlive (or some other TeX package)
GNU Make requires Gnulib to provide some facilities. If you want to maintain
a local installation of gnulib you can set GNULIB_SRCDIR to point to it.
Otherwise, ./bootstrap will obtain a clone for you.
Due to issues with gnulib's getloadavg, you must have automake 1.16.1 or
above. This version may not yet be available through GNU/Linux package
managers. If you need to install from source be sure to set ACLOCAL_PATH to
point to the pkg-config location (e.g., /usr/share/aclocal).
If you want to build from Git with a non-GCC compiler, add "MAKE_CFLAGS=" to
your make command line (or at least remove any flags your compiler does not
support).
To build GNU make from Git, you will need Autoconf, Automake, and
Gettext, and any tools that those utilities require (GNU m4, Perl,
etc.). See the configure.ac file to find the minimum versions of each
of these tools. You will also need a copy of wget.
When building from Git you must build in the source directory: "VPATH
builds" from remote directories are not supported. Once you've created
a distribution, of course, you can unpack it and do a VPATH build from
there.
After checking out the code, you will need to run the bootstrap script:
After checking out the code, you will need to perform these steps to get
to the point where you can run "make".
$ ./bootstrap
Alternatively you can just pull content from remote locations with:
1) $ autoreconf -i
$ ./bootstrap --pull
This rebuilds all the things that need rebuilding, installing
missing files as symbolic links.
And/or just re-generate auto-generatable files with:
You may get warnings here about missing files like README, etc.
Ignore them, they are harmless.
$ ./bootstrap --gen
(Running ./bootstrap does both in one step.)
2) $ ./configure
Generate a Makefile
3) $ make update
Use wget to retrieve various other files that GNU make relies on,
but does not keep in its own source tree.
NB: You may need GNU make to correctly perform this step; if you use
a platform-local make you may get problems with missing files in doc/.
At this point you have successfully brought your Git copy of the GNU
make source directory up to the point where it can be treated
more-or-less like the official package you would get from ftp.gnu.org.
That is, you can just run:
$ ./configure
$ make check
$ make && make check && make install
to build and test GNU Make.
NOTE! This method builds GNU Make in "maintainer mode". Make programs built
in this mode will be slower, possibly MUCH slower: there are various
sanity checks enabled. Further this mode assumes a modern GCC, GNU
libc, and well-formed system headers and enables a high level of
warnings AND enables -Werror to turn warnings into failures.
If you want to build from Git with "maintainer mode" disabled, add
"MAKE_MAINTAINER_MODE=" to the make command line. If you want to turn
off the extra warning flags, add "MAKE_CFLAGS=" to the make command
line. If you want to keep the warnings but not fail, add
"EXTRA_CFLAGS=-Wno-error" to the make command line.
For example:
$ ./configure
$ make check MAKE_MAINTAINER_MODE= MAKE_CFLAGS=
$ make install
to build and install GNU make.
Building From Git for Windows
-----------------------------
Windows builds from Git
-----------------------
If you have a UNIX emulation like CYGWIN you can opt to run the general build
procedure above; it will work. Consult README.W32 for information on options
you might want to use when running ./configure.
If you have a UNIX emulation like CYGWIN you can opt to run the general
build procedure above; it will work. Be sure to read
README.W32.template for information on options you might want to use
when running ./configure.
If you can't or don't want to do that, then first run the .\bootstrap.bat
script to "prime" your Git workspace:
> .\bootstrap.bat
Next, follow the instructions in the README.W32 file.
Note, neither of these methods are tested regularly by the GNU Make
maintainers. Building for Windows from a distribution tarball IS tested
regularly.
NOTE! "Maintainer mode" (see above) IS ENABLED when building from Git using
the build_w32.bat file.
Debugging and Testing
---------------------
These instructions have been tested on GNU systems. I have no idea if they
work on non-GNU systems (Windows, MacOS, etc.)
* Alternate Configurations:
The maintMakefile has a rule for running configure with various different
options, with and without packages. Run:
make check-alt-config
* Valgrind:
You can run all tests under valgrind by passing the -memcheck option:
(cd tests && ./run_make_tests -make ../make -memcheck)
Note, this is slow! Also some tests will fail because of invoking valgrind.
* ASAN:
You can build with ASAN and run tests, like this:
make clean
make -j8 CFLAGS='-ggdb3 -fsanitize=address' LDFLAGS='-ggdb3 -fsanitize=address'
Then to check for corruption only but not memory leaks run:
ASAN_OPTIONS='detect_stack_after_use_return=true:detect_leaks=false' make check
To check for leaks too run:
make check
Note that ASAN is reporting many more errors than valgrind. I don't know
which one is wrong: I haven't looked at them closely.
If you can't or don't want to do that, then rename the file
README.W32.template to README.W32 and follow those instructions.
Creating a Package
------------------
Once you have performed the above steps (including the configuration and
build) you can create a GNU Make package. This is very simple, just
build) you can create a GNU make package. This is very simple, just
run:
$ make dist-gzip
and, if you like:
$ make dist-lzip
$ make dist-bzip2
Even better, you should run this:
$ make distcheck
Which will build both .gz and .lz package files, then unpack one into a
temporary location, try to build it and repack it, then verifying that
everything works, you get the same results, _and_ no extraneous files are
left over after the "distclean" rule.
This package can be unpacked and built to give a "normal" (non-maintainer
mode) result.
Which will build both .gz and .bz2 package files, then unpack them into
a temporary location, try to build them, and repack them, verifying that
everything works, you get the same results, _and_ no extraneous files
are left over after the "distclean" rule--whew!! Now, _that_ is why
converting to Automake is worth the trouble! A big "huzzah!" to Tom
T. and the AutoToolers!
Steps to Release
----------------
Here are the things that need to be done (in more or less this order)
before making an official release. If something breaks such that you need to
change code, be sure to start over again sufficiently that everything is
consistent (that's why we don't finalize the Git tag, etc. until the end).
before making an official release:
* Update the configure.ac file with the new release number.
* Update the EDITION value in the doc/make.texi file.
* Update the doc/make.1 file with the release date.
* Update the NEWS file with the release number and date.
* Ensure the Savannah bug list URL in the NEWS file uses the correct
* In Savannah modify the "Value", "Rank", and "Description" values for the
current "SCM" entry in both "Component Version" and "Fix Release" fields
to refer to the new release, for "Bugs" and "Patches".
* Update the Savannah bug list URL in the NEWS file to use the correct
"Fixed Release" ID number.
* In Savannah create a new entry for the "Component Version" and "Fix
Release" fields:
- Value: SCM
- Rank: 20
- Descr: Fixed in Git; will be available in the next version of Make.
* Run "make distcheck" to be sure it all works.
* Run "make check-alt-config" to be sure alternative configurations work
* run "make tag-release" to create a Git tag for the release
* git tag -u <GPGID> <VER> where GPGID is my GPG key fingerprint,
and VER is the release version.
* Push everything:
git push --tags origin master
* Create the new release in the Savannah "Bugs" Administration for
both the "Component Version" and "Fixed Release" fields.
* Create the new release in the Savannah "Patches" Administration for
the "Fixed Release" field.
The safest thing is to create an entirely new repository and build the final
package from there:
Publishing a Package
--------------------
In order to publish a package on the FSF FTP site, either the release
site ftp://ftp.gnu.org, or the prerelease site ftp://alpha.gnu.org, you
first need to have my GPG private key and my passphrase to unlock it.
And, you can't have them! So there! But, just so I remember here's
what to do:
Make sure the "Steps to Release" are complete and committed and tagged.
git clone git://git.savannah.gnu.org/make.git make-release
cd make-release
If you don't want to create a new repository then run "git clean -fdx".
Then:
<run the commands above to build the release>
./bootstrap
./configure
make distcheck
make upload-alpha # for alpha.gnu.org (pre-releases)
-OR-
make upload-ftp # for ftp.gnu.org (official releases)
Perform test builds on whichever systems you have access to.
Depending on your distribution (whether GnuPG is integrated with your keyring
etc.) it will either pop up a window asking for your GPG key passphrase one
time, or else it will use the CLI to ask for the GPG passphrase _THREE_ times.
Sigh.
Use a previous announcement as a template to create an announcement in a text
file then sign it with GPG:
For both final releases and pre-releases, send an email with the URL of
the package to the GNU translation robot to allow the translators to
work on it:
<coordinator@translationproject.org>
Where to Announce
-----------------
Create the announcement in a text file, then sign it with GPG.
gpg --clearsign <announcement.txt>
Or, use your mail client's PGP/GPG signing capabilities.
Upload to gnu.org, then login and send from my account there.
NOTE! In order to publish a package on the FSF FTP site you need to have my
GPG private key, and my passphrase to unlock it.
To: bug-make@gnu.org, help-make@gnu.org, make-w32@gnu.org
CC: info-gnu@gnu.org
BCC: make-alpha@gnu.org
Depending on your distribution (whether GnuPG is integrated with your
keyring etc.) the upload operation will either pop up a window asking
for the GPG key passphrase one time, or else it will use the CLI to ask
for the GPG passphrase _THREE_ times. Sigh.
Add a news item to the Savannah project site.
Publishing a Release Candidate
------------------------------
Usually I publish one or two release candidates for people to test before
making an official release. Release candidates use a GNU numbering scheme,
which add a ".9x" release number to the PREVIOUS major release. So the first
release candidate for GNU Make 4.4 would be GNU Make 4.3.90, the second
release candidate would be 4.3.91, etc.
Upload a release candidate using:
make upload-alpha
Announce a release candidate to these mailing lists:
To: bug-make@gnu.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
You will have to approve the BCC's on the mailing list admin sites. Send
separate copies to (don't use CC as replies will go to these lists):
* coordinator@translationproject.org
* platform-testers@gnu.org
Publishing a Release
--------------------
When publishing a final release there are extra steps that need to be taken:
* Run "make update-makeweb" to get a copy of the GNU Make web pages
* Run "make update-gnuweb" to get a copy of the GNU website boilerplate pages
* Update the web page boilerplate if necessary:
( cd ~/src/make/make-web \
&& ~/src/gnu-www/www/server/standards/patch-from-parent \
make.html \
~/src/gnu-www/www/server/standards/boilerplate.html )
* Run "make gendocs" (requires gnulib) to generate the manual files for
the GNU Make web pages.
* Follow the directions from gendocs for the web page repository
Manage the Savannah project for GNU Make:
* In Savannah edit the "Component Version" field and choose the "SCM" entry.
Modify the "Value", "Rank", and "Description" values for the to refer to
the new release. The "Rank" field should be 10 less than the previous
release so it orders properly.
* In Savannah edit the "Fixed Release" field and choose the "SCM" entry.
Modify the "Value", "Rank", and "Description" values for the to refer to
the new release. The "Rank" field should be 10 less than the previous
release so it orders properly.
* In Savannah create a new entry for the "Component Version" field:
- Value: SCM
- Rank: 20
- Descr: Issues found in code retrieved from Source Code Management (Git), rather than a distributed version. Please include the SHA you are working with.
* In Savannah create a new entry for the "Fix Release" field:
- Value: SCM
- Rank: 20
- Descr: Fixed in Source Code Management (Git). The fix will be included in the next release of GNU Make.
Upload a release using:
make upload-ftp
Announce a release to these mailing lists:
To: info-gnu@gnu.org, bug-make@gnu.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
You will have to approve the BCC's on the mailing list admin sites. Send
separate copies to (don't use CC as replies will go to these lists):
* coordinator@translationproject.org
* platform-testers@gnu.org
Announce on Savannah:
* Add a news item to the Savannah project site.
Start the next release:
* Update configure.ac and add a ".90" to the release number.
* Update the NEWS file with a new section for the release / date.
* Update the Savannah URL for the bugs fixed in the NEWS section.
Add an update to freshmeat.net.
Appendix A - For The Brave
--------------------------
For those of you who trust me implicitly, or are just brave (or
foolhardy), here is a canned sequence of commands to build a GNU Make
foolhardy), here is a canned sequence of commands to build a GNU make
distribution package from a virgin Git source checkout (assuming all the
prerequisites are available of course).
This list is eminently suitable for a quick swipe o' the mouse and a
swift click o' mouse-2 into an xterm. Go for it!
For a debugging version:
autoreconf -i
./configure
make update
make
make check
./bootstrap && ./configure CFLAGS=-g && make check
Or, for a debugging version:
For an optimized version
autoreconf -i && ./configure CFLAGS=-g && make update && make && make check
./bootstrap && ./configure && make check
Or, all-in-one:
autoreconf -i && ./configure && make update && make && make check

216
README.in
View File

@ -1,216 +0,0 @@
This directory contains the @PACKAGE_VERSION@ release of @PACKAGE_NAME@.
See the file NEWS for the user-visible changes from previous releases.
In addition, there have been bugs fixed.
>> If you are trying to build GNU Make from a Git clone rather than a
>> downloaded source distribution, see the README.git file for instructions.
Please check the system-specific notes below for any caveats related to your
operating system.
This README assumes you are building on a POSIX-based operating system.
For ports to other operating systems please see the system-specific README
files, as described in the "Ports" section below.
For source distribution building and installation instructions, see the file
INSTALL.
If you need to build GNU Make and have no other 'make' program to use, you can
use the shell script 'build.sh' instead. To do this, first run 'configure' as
described in INSTALL. Then, instead of typing 'make' to build the program,
type 'sh build.sh'. This will compile the program in the current directory.
Then you will have a 'make' program that you can use for './make install', or
whatever else.
Some systems' 'make' programs cannot process the Makefile for GNU Make.
If you get errors from your system's 'make' when building GNU Make, try using
'build.sh' instead.
GNU Make is free software. See the file COPYING for copying conditions.
GNU Make is copyright by the Free Software Foundation. Copyright notices
condense sequential years into a range; e.g. "1987-1994" means all years
from 1987 to 1994 inclusive.
Downloading
-----------
GNU Make can be obtained in many different ways. See a description here:
https://www.gnu.org/software/software.html
Documentation
-------------
GNU Make is fully documented in the GNU Make manual, which is contained in
this distribution as the file make.texi. You can also find on-line and
preformatted (PostScript and DVI) versions at the FSF's web site. There is
information there about ordering hardcopy documentation.
https://www.gnu.org/
https://www.gnu.org/doc/doc.html
https://www.gnu.org/manual/manual.html
Development
-----------
GNU Make development is hosted by Savannah, the FSF's online development
management tool. Savannah is here:
https://savannah.gnu.org
And the GNU Make development page is here:
https://savannah.gnu.org/projects/make/
You can find most information concerning the development of GNU Make at
this site.
Regression Tests
----------------
GNU Make contains a suite of regression tests. To run them use "make check"
after building GNU Make. If they fail a tar package will be created
containing useful information, which can be emailed (as an attachment) to
the <bug-make@gnu.org> mailing list.
Please note that since these tests rely on known-good-output comparisons,
they can show spurious failures on some systems (particularly non-POSIX systems
such as Windows).
Bug Reporting
-------------
If you need help using GNU Make, try asking on <help-make@gnu.org>.
If you found a bug, you can send a bug reports to <bug-make@gnu.org>.
Please see the section of the GNU Make manual entitled 'Problems and Bugs'
for information on submitting useful and complete bug reports.
You do not need to subscribe to these lists first.
You can also use the online bug tracking system in the Savannah GNU Make
project to submit new problem reports or search for existing ones:
https://savannah.gnu.org/bugs/?group=make
We prefer to use the bug tracking system ONLY for bugs or enhancements,
not for help requests: please use the mailing lists to get help.
Submitting Patches
------------------
If you'd like to propose a change to GNU Make, you can provide a patch with
your changes. If you are making your changes in a Git workspace you can run
"git format-patch" to create a patch file. If not, you can use the diff(1)
utility to create a patch file; please use "diff -u".
Once you have a patch you can submit it in any of these ways:
* Create a bug on Savannah and add the patch as an attachment:
https://savannah.gnu.org/bugs/?group=make&func=additem
* Send the patch via email to <bug-make@gnu.org>: be sure to add it as an
attachment to avoid interference by email processors.
All non-trivial changes require FSF copyright paperwork to be completed
before they can be accepted. Contact <bug-make@gnu.org> for help.
Git Access
----------
The GNU Make source repository is available via Git from the GNU Savannah Git
server; look here for details:
https://savannah.gnu.org/git/?group=make
Please note: you won't be able to build GNU Make from Git without installing
appropriate maintainer's tools, such as GNU m4, automake, autoconf, Perl, GNU
make, and GCC.
See the README.git file for instructions on how to build GNU Make once these
tools are available. We make no guarantees about the contents or quality of
the latest code in the Git repository: it is not unheard of for code that is
known to be broken to be checked in. Use at your own risk.
System-specific Notes
---------------------
One area that is often a problem in configuration and porting is the code
to check the system's current load average. To make it easier to test and
debug this code, you can do 'make check-loadavg' to see if it works
properly on your system. (You must run 'configure' beforehand, but you
need not build 'make' itself to run this test.)
Another potential source of porting problems is the support for large
files (LFS) in configure for those operating systems that provide it.
Please report any bugs that you find in this area. If you run into
difficulties, then as a workaround you should be able to disable LFS by
adding the '--disable-largefile' option to the 'configure' script.
On systems that support micro- and nano-second timestamp values and
where stat(2) provides this information, GNU Make will use it when
comparing timestamps to get the most accurate possible result. However,
note that many current implementations of tools that *set* timestamps do
not preserve micro- or nano-second granularity. This means that "cp -p"
and other similar tools (tar, etc.) may not exactly duplicate timestamps
with micro- and nano-second granularity on some systems. If your build
system contains rules that depend on proper behavior of tools like "cp
-p", you should consider using the .LOW_RESOLUTION_TIME pseudo-target to
force make to treat them properly. See the manual for details.
Ports
-----
- See README.customs for details on integrating GNU Make with the
Customs distributed build environment from the Pmake distribution.
- See README.VMS for details about GNU Make on OpenVMS.
- See README.zOS for details about GNU Make on z/OS.
- See README.W32 for details about GNU Make on Windows NT, 95, or 98.
- See README.DOS for compilation instructions on MS-DOS and MS-Windows
using DJGPP tools.
A precompiled binary of the MSDOS port of GNU Make is available as part
of DJGPP; see the WWW page https://www.delorie.com/djgpp/ for more
information.
The Cygwin project maintains its own port of GNU Make. That port may have
patches which are not present in this version. If you are using Cygwin
you should use their version of GNU Make, and if you have questions about
it you should start by asking on those mailing lists and forums.
Please note there are two _separate_ ports of GNU Make for Microsoft
systems: a native Windows port built with (for example) MSVC or MinGW,
and a DOS-based port built with DJGPP. Please be sure you are looking
at the right README!
-------------------------------------------------------------------------------
Copyright (C) 1988-2024 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 3 of the License, 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
this program. If not, see <https://www.gnu.org/licenses/>.

178
README.template Normal file
View File

@ -0,0 +1,178 @@
This directory contains the %VERSION% release of GNU Make.
See the file NEWS for the user-visible changes from previous releases.
In addition, there have been bugs fixed.
Please check the system-specific notes below for any caveats related to
your operating system.
For general building and installation instructions, see the file INSTALL.
If you need to build GNU Make and have no other 'make' program to use,
you can use the shell script 'build.sh' instead. To do this, first run
'configure' as described in INSTALL. Then, instead of typing 'make' to
build the program, type 'sh build.sh'. This should compile the program
in the current directory. Then you will have a Make program that you can
use for './make install', or whatever else.
Some systems' Make programs are broken and cannot process the Makefile for
GNU Make. If you get errors from your system's Make when building GNU
Make, try using 'build.sh' instead.
GNU Make is free software. See the file COPYING for copying conditions.
GNU Make is copyright by the Free Software Foundation. Copyright notices
condense sequential years into a range; e.g. "1987-1994" means all years
from 1987 to 1994 inclusive.
Downloading
-----------
GNU Make can be obtained in many different ways. See a description here:
http://www.gnu.org/software/software.html
Documentation
-------------
GNU make is fully documented in the GNU Make manual, which is contained
in this distribution as the file make.texinfo. You can also find
on-line and preformatted (PostScript and DVI) versions at the FSF's web
site. There is information there about ordering hardcopy documentation.
http://www.gnu.org/
http://www.gnu.org/doc/doc.html
http://www.gnu.org/manual/manual.html
Development
-----------
GNU Make development is hosted by Savannah, the FSF's online development
management tool. Savannah is here:
http://savannah.gnu.org
And the GNU Make development page is here:
http://savannah.gnu.org/projects/make/
You can find most information concerning the development of GNU Make at
this site.
Bug Reporting
-------------
You can send GNU make bug reports to <bug-make@gnu.org>. Please see the
section of the GNU make manual entitled 'Problems and Bugs' for
information on submitting useful and complete bug reports.
You can also use the online bug tracking system in the Savannah GNU Make
project to submit new problem reports or search for existing ones:
http://savannah.gnu.org/bugs/?group=make
If you need help using GNU make, try these forums:
help-make@gnu.org
help-utils@gnu.org
news:gnu.utils.help
news:gnu.utils.bug
Git Access
----------
The GNU make source repository is available via Git from the
GNU Savannah Git server; look here for details:
http://savannah.gnu.org/git/?group=make
Please note: you won't be able to build GNU make from Git without
installing appropriate maintainer's tools, such as GNU m4, automake,
autoconf, Perl, GNU make, and GCC. See the README.git file for hints on
how to build GNU make once these tools are available. We make no
guarantees about the contents or quality of the latest code in the Git
repository: it is not unheard of for code that is known to be broken to
be checked in. Use at your own risk.
System-specific Notes
---------------------
It has been reported that the XLC 1.2 compiler on AIX 3.2 is buggy such
that if you compile make with 'cc -O' on AIX 3.2, it will not work
correctly. It is said that using 'cc' without '-O' does work.
The standard /bin/sh on SunOS 4.1.3_U1 and 4.1.4 is broken and cannot be
used to configure GNU make. Please install a different shell such as
bash or pdksh in order to run "configure". See this message for more
information:
http://mail.gnu.org/archive/html/bug-autoconf/2003-10/msg00190.html
One area that is often a problem in configuration and porting is the code
to check the system's current load average. To make it easier to test and
debug this code, you can do 'make check-loadavg' to see if it works
properly on your system. (You must run 'configure' beforehand, but you
need not build Make itself to run this test.)
Another potential source of porting problems is the support for large
files (LFS) in configure for those operating systems that provide it.
Please report any bugs that you find in this area. If you run into
difficulties, then as a workaround you should be able to disable LFS by
adding the '--disable-largefile' option to the 'configure' script.
On systems that support micro- and nano-second timestamp values and
where stat(2) provides this information, GNU make will use it when
comparing timestamps to get the most accurate possible result. However,
note that many current implementations of tools that *set* timestamps do
not preserve micro- or nano-second granularity. This means that "cp -p"
and other similar tools (tar, etc.) may not exactly duplicate timestamps
with micro- and nano-second granularity on some systems. If your build
system contains rules that depend on proper behavior of tools like "cp
-p", you should consider using the .LOW_RESOLUTION_TIME pseudo-target to
force make to treat them properly. See the manual for details.
Ports
-----
- See README.customs for details on integrating GNU make with the
Customs distributed build environment from the Pmake distribution.
- See readme.vms for details about GNU Make on OpenVMS.
- See README.Amiga for details about GNU Make on AmigaDOS.
- See README.W32 for details about GNU Make on Windows NT, 95, or 98.
- See README.DOS for compilation instructions on MS-DOS and MS-Windows
using DJGPP tools.
A precompiled binary of the MSDOS port of GNU Make is available as part
of DJGPP; see the WWW page http://www.delorie.com/djgpp/ for more
information.
Please note there are two _separate_ ports of GNU make for Microsoft
systems: a native Windows tool built with (for example) MSVC or Cygwin,
and a DOS-based tool built with DJGPP. Please be sure you are looking
at the right README!
-------------------------------------------------------------------------------
Copyright (C) 1988-2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,83 +0,0 @@
-*-text-*-
GNU Make has been ported to z/OS, tested on z/OS V2R4.
PREREQUISITES
-------------
Building GNU Make requires certain tools be installed on your z/OS system.
These tools can be downloaded from: https://github.com/ZOSOpenTools
For detailed instructions on how to set up these tools, visit
https://zosopentools.github.io/meta/#/Guides/Pre-req
You will need curl, tar, and gzip to download and unpack the GNU Make release
package, but presumably you've already worked this out if you're reading this
document!
You will need the IBM C/C++ compiler. You can download a web deliverable
add-on feature to your XL C/C++ compiler here:
https://www-40.ibm.com/servers/resourcelink/svc00100.nsf/pages/xlCC++V241ForZOsV24
Alternatively, you can install and manage C/C++ for Open Enterprise Languages
on z/OS using RedHat OpenShift Container Platform and IBM Z and Cloud
Modernization Stack.
GNU Make has a dependency on the ZOSLIB library, which is documented here:
https://zosopentools.github.io/meta/#/Guides/Zoslib.
To obtain the latest release of zoslib, you can download it from here:
https://github.com/ZOSOpenTools/zoslibport/releases.
BUILDING
--------
If you are trying to build from a checked-out Git workspace, see README.git.
Before building GNU Make, you will need to ensure that the following
environment variables are set, to turn on z/OS enhanced ASCII support:
export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS="$_CEE_RUNOPTS FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
To ensure proper functioning of xlclang, set the following environment
variables before building:
export _CC_CCMODE=1
export _C89_CCMODE=1
export _CXX_CCMODE=1
Set PATH_TO_ZOSLIB to the location of your zoslib installation; e.g.:
PATH_TO_ZOSLIB=$HOME/zopen/prod/zoslib
Invoke ./configure as follows:
./configure \
CC=xlclang \
CPPFLAGS="-DNSIG=42 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE -D_OPEN_SYS_FILE_EXT=1 -D_AE_BIMODAL=1 -D_ENHANCED_ASCII_EXT=0xFFFFFFF -DZOSLIB_OVERRIDE_CLIB=1" \
CFLAGS="-qascii -std=gnu11 -qnocsect -qenum=int -I$PATH_TO_ZOSLIB/include" \
LDFLAGS="-L$PATH_TO_ZOSLIB/lib" \
LIBS="-lzoslib $PATH_TO_ZOSLIB/lib/CXXRT64.x"
If you have an instance of make already available you can build with:
make
If not, you can build with:
./build.sh
TESTING
-------
To run the regression tests you'll need to install Perl and enable it.
Then you can run:
./make check
INSTALLING
----------
Copy the "make" program to wherever you want it to be installed, on your PATH.

13
SCOPTIONS Normal file
View File

@ -0,0 +1,13 @@
ERRORREXX
OPTIMIZE
NOVERSION
OPTIMIZERTIME
OPTIMIZERALIAS
DEFINE INCLUDEDIR="include:"
DEFINE LIBDIR="lib:"
DEFINE NO_ALLOCA
DEFINE NO_FLOAT
DEFINE NO_ARCHIVES
IGNORE=161
IGNORE=100
STARTUP=cres

218
SMakefile.template Normal file
View File

@ -0,0 +1,218 @@
# -*-Makefile-*- for building GNU make with smake
#
# NOTE: If you have no 'make' program at all to process this makefile,
# run 'build.sh' instead.
#
# Copyright (C) 1995-2013 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# Makefile for GNU Make
#
# Ultrix 2.2 make doesn't expand the value of VPATH.
VPATH = /make-%VERSION%/
# This must repeat the value, because configure will remove 'VPATH = .'.
srcdir = /make-%VERSION%/
CC = sc
RM = delete
MAKE = smake
CFLAGS =
CPPFLAGS =
LDFLAGS =
# Define these for your system as follows:
# -DNO_ARCHIVES To disable 'ar' archive support.
# -DNO_FLOAT To avoid using floating-point numbers.
# -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
# Some compilers apparently accept this
# without complaint but produce losing code,
# so beware.
# NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
# See also 'config.h'.
defines =
# Which flavor of remote job execution support to use.
# The code is found in 'remote-$(REMOTE).c'.
REMOTE = stub
# If you are using the GNU C library, or have the GNU getopt functions in
# your C library, you can comment these out.
GETOPT = getopt.o getopt1.o
GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h
# If you are using the GNU C library, or have the GNU glob functions in
# your C library, you can comment this out. GNU make uses special hooks
# into the glob functions to be more efficient (by using make's directory
# cache for globbing), so you must use the GNU functions even if your
# system's C library has the 1003.2 glob functions already. Also, the glob
# functions in the AIX and HPUX C libraries are said to be buggy.
GLOB = Lib glob/glob.lib
# If your system doesn't have alloca, or the one provided is bad, define this.
ALLOCA = alloca.o
ALLOCA_SRC = $(srcdir)alloca.c
# If your system needs extra libraries loaded in, define them here.
# System V probably need -lPW for alloca. HP-UX 7.0's alloca in
# libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
# alloca.c instead on those machines.
LOADLIBES =
# Any extra object files your system needs.
extras = amiga.o
# Common prefix for machine-independent installed files.
prefix =
# Common prefix for machine-dependent installed files.
exec_prefix =
# Directory to install 'make' in.
bindir = sc:c
# Directory to find libraries in for '-lXXX'.
libdir = lib:
# Directory to search by default for included makefiles.
includedir = include:
# Directory to install the Info files in.
infodir = doc:
# Directory to install the man page in.
mandir = t:
# Number to put on the man page filename.
manext = 1
# Prefix to put on installed 'make' binary file name.
binprefix =
# Prefix to put on installed 'make' man page file name.
manprefix = $(binprefix)
# Whether or not make needs to be installed setgid.
# The value should be either 'true' or 'false'.
# On many systems, the getloadavg function (used to implement the '-l'
# switch) will not work unless make is installed setgid kmem.
install_setgid = false
# Install make setgid to this group so it can read /dev/kmem.
group = sys
# Program to install 'make'.
INSTALL_PROGRAM = copy
# Program to install the man page.
INSTALL_DATA = copy
# Generic install program.
INSTALL = copy
# Program to format Texinfo source into Info files.
MAKEINFO = makeinfo
# Program to format Texinfo source into DVI files.
TEXI2DVI = texi2dvi
# Programs to make tags files.
ETAGS = etags -w
CTAGS = ctags -w
#guile = guile.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 \
vpath.o version.o ar.o arscan.o signame.o strcache.o hash.o \
output.o remote-$(REMOTE).o $(GLOB) $(GETOPT) $(ALLOCA) \
$(extras) $(guile)
srcs = $(srcdir)commands.c $(srcdir)job.c $(srcdir)dir.c \
$(srcdir)file.c $(srcdir)getloadavg.c $(srcdir)misc.c \
$(srcdir)main.c $(srcdir)read.c $(srcdir)remake.c \
$(srcdir)rule.c $(srcdir)implicit.c $(srcdir)default.c \
$(srcdir)variable.c $(srcdir)expand.c $(srcdir)function.c \
$(srcdir)vpath.c $(srcdir)version.c $(srcdir)hash.c \
$(srcdir)guile.c $(srcdir)remote-$(REMOTE).c \
$(srcdir)ar.c $(srcdir)arscan.c $(srcdir)strcache.c \
$(srcdir)signame.c $(srcdir)signame.h $(GETOPT_SRC) \
$(srcdir)commands.h $(srcdir)dep.h $(srcdir)file.h \
$(srcdir)job.h $(srcdir)makeint.h $(srcdir)rule.h \
$(srcdir)output.c $(srcdir)output.h \
$(srcdir)variable.h $(ALLOCA_SRC) $(srcdir)config.h.in
.SUFFIXES:
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
all: make
info: make.info
dvi: make.dvi
# Some makes apparently use .PHONY as the default goal if it is before 'all'.
.PHONY: all check info dvi
make.info: make.texinfo
$(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info
make.dvi: make.texinfo
$(TEXI2DVI) $(srcdir)make.texinfo
make.ps: make.dvi
dvi2ps make.dvi > make.ps
make: $(objs) glob/glob.lib
$(CC) Link $(LDFLAGS) $(objs) $(LOADLIBES) To make.new
-delete quiet make
rename make.new make
# -I. is needed to find config.h in the build directory.
.c.o:
$(CC) $(defines) IDir "" IDir $(srcdir)glob \
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
glob/glob.lib:
execute <<
cd glob
smake
<
tagsrcs = $(srcs) $(srcdir)remote-*.c
TAGS: $(tagsrcs)
$(ETAGS) $(tagsrcs)
tags: $(tagsrcs)
$(CTAGS) $(tagsrcs)
.PHONY: install installdirs
install:
copy make sc:c
loadavg: loadavg.c config.h
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
loadavg.c $(LOADLIBES) -o $@
clean: glob-clean
-$(RM) -f make loadavg *.o core make.dvi
distclean: clean glob-realclean
-$(RM) -f Makefile config.h config.status build.sh
-$(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
glob-clean glob-realclean:
execute <<
cd glob
smake $@
<

View File

@ -99,9 +99,33 @@ The Rest of the List
you just can't figure it out. The way variables are expanded now
means this isn't 100% trivial, but it probably won't be hard.
8) Integration of Guile as an embedded scripting language. This means:
allowing Guile functions to be declared in makefiles somehow, then
providing a syntax for invoking them. At least one formulation of
that would have the function resolve to a string which would be
substituted in the makefile, kind of like $(shell ...) does now, but
using the embedded interpreter so there's no process forked of
course. Obviously this is an optional add-on feature.
It could be more advanced than that, even, who knows? Maybe make
could provide Guile functions that allow Guile scripts more direct
access to internal make structures, somehow. This kind of thing
needs a lot of thought.
Also there's always the flip side: in some very fundamental ways
make isn't the best choice right now for a complex build tool. It's
great for simple-to-medium tasks, but there are already other tools
available for the really tough situations. Ask yourself,
realistically, how much work is worthwhile to add to make, given the
fundamentals you can't really overcome without significantly
affecting backward compatibility--and then why not use another tool
in the first place?
Something to think about.
-------------------------------------------------------------------------------
Copyright (C) 1997-2024 Free Software Foundation, Inc.
Copyright (C) 1997-2013 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
@ -114,4 +138,4 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,7 +1,7 @@
dnl acinclude.m4 -- Extra macros needed for GNU Make.
dnl acinclude.m4 -- Extra macros needed for GNU make.
dnl
dnl Automake will incorporate this into its generated aclocal.m4.
dnl Copyright (C) 1998-2024 Free Software Foundation, Inc.
dnl Copyright (C) 1998-2013 Free Software Foundation, Inc.
dnl This file is part of GNU Make.
dnl
dnl GNU Make is free software; you can redistribute it and/or modify it under
@ -15,7 +15,7 @@ dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
dnl more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program. If not, see <https://www.gnu.org/licenses/>.
dnl with this program. If not, see <http://www.gnu.org/licenses/>.
dnl ---------------------------------------------------------------------------
dnl Got this from the lynx 2.8 distribution.
@ -43,8 +43,8 @@ AC_MSG_RESULT(working...)
cf_cv_netlibs=""
cf_test_netlibs=yes
AC_CHECK_FUNCS(gethostname,,[
CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
#
# FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but
# I don't know the entrypoints - 97/7/22 TD
@ -52,12 +52,12 @@ AC_CHECK_LIB(inet,main,cf_cv_netlibs="-linet $cf_cv_netlibs")
#
if test "$ac_cv_func_lsocket" != no ; then
AC_CHECK_FUNCS(socket,,[
CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
fi
#
AC_CHECK_FUNCS(gethostbyname,,[
CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
])
LIBS="$LIBS $cf_cv_netlibs"
test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
@ -77,14 +77,14 @@ dnl used (autoconf does not distinguish between a null token and one that is
dnl set to 'no').
AC_DEFUN([CF_RECHECK_FUNC],[
AC_CHECK_LIB($2,$1,[
CF_UPPER(cf_tr_func,$1)
AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func,1,[Define if you have function $1])
ac_cv_func_$1=yes
$3="-l$2 [$]$3"],[
ac_cv_func_$1=unknown
unset ac_cv_func_$1 2>/dev/null
$4],
[[$]$3])
CF_UPPER(cf_tr_func,$1)
AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func,1,[Define if you have function $1])
ac_cv_func_$1=yes
$3="-l$2 [$]$3"],[
ac_cv_func_$1=unknown
unset ac_cv_func_$1 2>/dev/null
$4],
[[$]$3])
])dnl
dnl ---------------------------------------------------------------------------
dnl Make an uppercase version of a variable
@ -118,7 +118,7 @@ AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/stat.h>
], [struct stat s; s.ST_MTIM_NSEC;],
], [struct stat s; s.ST_MTIM_NSEC;],
[ac_cv_struct_st_mtim_nsec=$ac_val; break])
done
CPPFLAGS="$ac_save_CPPFLAGS"
@ -126,7 +126,7 @@ AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
if test $ac_cv_struct_st_mtim_nsec != no; then
AC_DEFINE_UNQUOTED([ST_MTIM_NSEC], [$ac_cv_struct_st_mtim_nsec],
[Define if struct stat contains a nanoseconds field])
[Define if struct stat contains a nanoseconds field])
fi
]
)

503
alloca.c Normal file
View File

@ -0,0 +1,503 @@
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <jot@cray.com> contributed the Cray support.
There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef emacs
#include "blockinput.h"
#endif
/* If compiling with GCC 2, this file's not needed. */
#if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
#ifndef alloca
#ifdef emacs
#ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
#ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
#endif /* STACK_DIRECTION undefined */
#endif /* static */
#endif /* emacs */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
long i00afunc ();
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
#else
#define ADDRESS_FUNCTION(arg) &(arg)
#endif
#if __STDC__
typedef void *pointer;
#else
typedef char *pointer;
#endif
#ifndef NULL
#define NULL 0
#endif
/* Different portions of Emacs need to call different versions of
malloc. The Emacs executable needs alloca to call xmalloc, because
ordinary malloc isn't protected from input signals. On the other
hand, the utilities in lib-src need alloca to call malloc; some of
them are very simple, and don't have an xmalloc routine.
Non-Emacs programs expect this to call use xmalloc.
Callers below should use malloc. */
#ifndef emacs
#define malloc xmalloc
#endif
extern pointer malloc ();
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#ifndef STACK_DIRECTION
#define STACK_DIRECTION 0 /* Direction unknown. */
#endif
#if STACK_DIRECTION != 0
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
#else /* STACK_DIRECTION == 0; need run-time code. */
static int stack_dir; /* 1 or -1 once known. */
#define STACK_DIR stack_dir
static void
find_stack_direction (void)
{
static char *addr = NULL; /* Address of first 'dummy', once known. */
auto char dummy; /* To get stack address. */
if (addr == NULL)
{ /* Initial entry. */
addr = ADDRESS_FUNCTION (dummy);
find_stack_direction (); /* Recurse once. */
}
else
{
/* Second entry. */
if (ADDRESS_FUNCTION (dummy) > addr)
stack_dir = 1; /* Stack grew upward. */
else
stack_dir = -1; /* Stack grew downward. */
}
}
#endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
(a) chain together all alloca'ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
#ifndef ALIGN_SIZE
#define ALIGN_SIZE sizeof(double)
#endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct
{
union hdr *next; /* For chaining headers. */
char *deep; /* For stack depth measure. */
} h;
} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
/* Return a pointer to at least SIZE bytes of storage,
which will be automatically reclaimed upon exit from
the procedure that called alloca. Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (unsigned size)
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
#if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
find_stack_direction ();
#endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
#ifdef emacs
BLOCK_INPUT;
#endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
free ((pointer) hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
else
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
#ifdef emacs
UNBLOCK_INPUT;
#endif
}
if (size == 0)
return NULL; /* No allocation required. */
/* Allocate combined header + user data storage. */
{
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
if (new == 0)
abort();
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
last_alloca_header = (header *) new;
/* User storage begins just after header. */
return (pointer) ((char *) new + sizeof (header));
}
}
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
#ifdef DEBUG_I00AFUNC
#include <stdio.h>
#endif
#ifndef CRAY_STACK
#define CRAY_STACK
#ifndef CRAY2
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
struct stack_control_header
{
long shgrow:32; /* Number of times stack has grown. */
long shaseg:32; /* Size of increments to stack. */
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
part of the stack segment linkage control information is
0200 (octal) words. This provides for register storage
for the routine which overflows the stack. */
struct stack_segment_linkage
{
long ss[0200]; /* 0200 overflow words. */
long sssize:32; /* Number of words in this segment. */
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
long ssgvup; /* Pointer to multitasking thread giveup. */
long sscray[7]; /* Reserved for Cray Research. */
long ssa0;
long ssa1;
long ssa2;
long ssa3;
long ssa4;
long ssa5;
long ssa6;
long ssa7;
long sss0;
long sss1;
long sss2;
long sss3;
long sss4;
long sss5;
long sss6;
long sss7;
};
#else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat
{
long now; /* Current total stack size. */
long maxc; /* Amount of contiguous space which would
be required to satisfy the maximum
stack demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
long extends; /* Number of block extensions. */
long stko_mallocs; /* Block allocations by $STKOFEN. */
long underflows; /* Number of stack underflow calls ($STKRETN). */
long stko_free; /* Number of deallocations by $STKRETN. */
long stkm_free; /* Number of deallocations by $STKMRET. */
long segments; /* Current number of stack segments. */
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
long current_size; /* Current stack segment size. This
number is actually corrupted by STKSTAT to
include the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
struct stk_trailer
{
long this_address; /* Address of this block. */
long this_size; /* Size of this block (does not include
this trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
segment. */
long unknown5;
long unknown6;
long unknown7;
long unknown8;
long unknown9;
long unknown10;
long unknown11;
long unknown12;
long unknown13;
long unknown14;
};
#endif /* CRAY2 */
#endif /* not CRAY_STACK */
#ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
long *block, size;
long result = 0;
/* We want to iterate through all of the segments. The first
step is to get the stack status structure. We could do this
more quickly and more directly, perhaps, by referencing the
$LM00 common block, but I know that this works. */
STKSTAT (&status);
/* Set up the iteration. */
trailer = (struct stk_trailer *) (status.current_address
+ status.current_size
- 15);
/* There must be at least one stack segment. Therefore it is
a fatal error if "trailer" is null. */
if (trailer == 0)
abort ();
/* Discard segments that do not contain our argument address. */
while (trailer != 0)
{
block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort ();
trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
/* Set the result to the offset in this segment and add the sizes
of all predecessor segments. */
result = address - block;
if (trailer == 0)
{
return result;
}
do
{
if (trailer->this_size <= 0)
abort ();
result += trailer->this_size;
trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
/* We are done. Note that if you present a bogus address (one
not in any segment), you will get a different number back, formed
from subtracting the address of the first block. This is probably
not what you want. */
return (result);
}
#else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
given the address of the cell. The purpose of this
routine is to linearize, in some sense, stack addresses
for alloca. */
static long
i00afunc (long address)
{
long stkl = 0;
long size, pseg, this_segment, stack;
long result = 0;
struct stack_segment_linkage *ssptr;
/* Register B67 contains the address of the end of the
current stack segment. If you (as a subprogram) store
your registers on the stack and find that you are past
the contents of B67, you have overflowed the segment.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
stkl = CRAY_STACKSEG_END ();
ssptr = (struct stack_segment_linkage *) stkl;
/* If one subtracts 'size' from the end of the segment,
one has the address of the first word of the segment.
If this is not the first segment, 'pseg' will be
nonzero. */
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
/* It is possible that calling this routine itself caused
a stack overflow. Discard stack segments which do not
contain the target address. */
while (!(this_segment <= address && address <= stkl))
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
#endif
if (pseg == 0)
break;
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
}
result = address - this_segment;
/* If you subtract pseg from the current end of the stack,
you get the address of the previous stack segment's end.
This seems a little convoluted to me, but I'll bet you save
a cycle somewhere. */
while (pseg != 0)
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o\n", pseg, size);
#endif
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
}
return (result);
}
#endif /* not CRAY2 */
#endif /* CRAY */
#endif /* no alloca */
#endif /* not GCC version 2 */

117
amiga.c Normal file
View File

@ -0,0 +1,117 @@
/* Running commands on Amiga
Copyright (C) 1995-2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "variable.h"
#include "amiga.h"
#include <assert.h>
#include <exec/memory.h>
#include <dos/dostags.h>
#include <proto/exec.h>
#include <proto/dos.h>
static const char Amiga_version[] = "$VER: Make 3.74.3 (12.05.96) \n"
"Amiga Port by A. Digulla (digulla@home.lake.de)";
int
MyExecute (char **argv)
{
char * buffer, * ptr;
char ** aptr;
int len = 0;
int status;
for (aptr=argv; *aptr; aptr++)
{
len += strlen (*aptr) + 4;
}
buffer = AllocMem (len, MEMF_ANY);
if (!buffer)
fatal (NILF, "MyExecute: Cannot allocate space for calling a command");
ptr = buffer;
for (aptr=argv; *aptr; aptr++)
{
if (((*aptr)[0] == ';' && !(*aptr)[1]))
{
*ptr ++ = '"';
strcpy (ptr, *aptr);
ptr += strlen (ptr);
*ptr ++ = '"';
}
else if ((*aptr)[0] == '@' && (*aptr)[1] == '@' && !(*aptr)[2])
{
*ptr ++ = '\n';
continue;
}
else
{
strcpy (ptr, *aptr);
ptr += strlen (ptr);
}
*ptr ++ = ' ';
*ptr = 0;
}
ptr[-1] = '\n';
status = SystemTags (buffer,
SYS_UserShell, TRUE,
TAG_END);
FreeMem (buffer, len);
if (SetSignal (0L,0L) & SIGBREAKF_CTRL_C)
status = 20;
/* Warnings don't count */
if (status == 5)
status = 0;
return status;
}
char *
wildcard_expansion (char *wc, char *o)
{
# define PATH_SIZE 1024
struct AnchorPath * apath;
if ( (apath = AllocMem (sizeof (struct AnchorPath) + PATH_SIZE,
MEMF_CLEAR))
)
{
apath->ap_Strlen = PATH_SIZE;
if (MatchFirst (wc, apath) == 0)
{
do
{
o = variable_buffer_output (o, apath->ap_Buf,
strlen (apath->ap_Buf));
o = variable_buffer_output (o, " ",1);
} while (MatchNext (apath) == 0);
}
MatchEnd (apath);
FreeMem (apath, sizeof (struct AnchorPath) + PATH_SIZE);
}
return o;
}

18
amiga.h Normal file
View File

@ -0,0 +1,18 @@
/* Definitions for amiga specific things
Copyright (C) 1995-2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>. */
int MyExecute (char ** argv);
char * wildcard_expansion (char * wc, char * o);

View File

@ -1,5 +1,5 @@
/* Interface to 'ar' archives for GNU Make.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
This file is part of GNU Make.
@ -13,7 +13,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
@ -22,7 +22,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "filedef.h"
#include "dep.h"
#include <fnmatch.h>
#include <intprops.h>
/* Return nonzero if NAME is an archive-member reference, zero if not. An
archive-member reference is a name like 'lib(member)' where member is a
@ -36,7 +35,7 @@ ar_name (const char *name)
const char *p = strchr (name, '(');
const char *end;
if (p == NULL || p == name)
if (p == 0 || p == name)
return 0;
end = p + strlen (p) - 1;
@ -44,7 +43,7 @@ ar_name (const char *name)
return 0;
if (p[1] == '(' && end[-1] == ')')
OS (fatal, NILF, _("attempt to use unsupported feature: '%s'"), name);
fatal (NILF, _("attempt to use unsupported feature: '%s'"), name);
return 1;
}
@ -61,9 +60,6 @@ ar_parse_name (const char *name, char **arname_p, char **memname_p)
*arname_p = xstrdup (name);
p = strchr (*arname_p, '(');
/* This is never called unless ar_name() is true so p cannot be NULL. */
if (!p)
OS (fatal, NILF, "INTERNAL: ar_parse_name: bad name '%s'", *arname_p);
*(p++) = '\0';
p[strlen (p) - 1] = '\0';
*memname_p = p;
@ -73,11 +69,11 @@ ar_parse_name (const char *name, char **arname_p, char **memname_p)
/* This function is called by 'ar_scan' to find which member to look at. */
/* ARGSUSED */
static intmax_t
static long int
ar_member_date_1 (int desc UNUSED, const char *mem, int truncated,
long int hdrpos UNUSED, long int datapos UNUSED,
long int size UNUSED, intmax_t date,
int uid UNUSED, int gid UNUSED, unsigned int mode UNUSED,
long int size UNUSED, long int date,
int uid UNUSED, int gid UNUSED, int mode UNUSED,
const void *name)
{
return ar_name_equal (name, mem, truncated) ? date : 0;
@ -90,7 +86,7 @@ ar_member_date (const char *name)
{
char *arname;
char *memname;
intmax_t val;
long int val;
ar_parse_name (name, &arname, &memname);
@ -115,16 +111,16 @@ ar_member_date (const char *name)
free (arname);
return 0 < val && val <= TYPE_MAXIMUM (time_t) ? val : -1;
return (val <= 0 ? (time_t) -1 : (time_t) val);
}
/* Set the archive-member NAME's modtime to now. */
#if MK_OS_VMS
#ifdef VMS
int
ar_touch (const char *name)
{
O (error, NILF, _("touch archive member is not available on VMS"));
error (NILF, _("touch archive member is not available on VMS"));
return -1;
}
#else
@ -148,49 +144,39 @@ ar_touch (const char *name)
switch (ar_member_touch (arname, memname))
{
case -1:
OS (error, NILF, _("touch: archive '%s' does not exist"), arname);
error (NILF, _("touch: Archive '%s' does not exist"), arname);
break;
case -2:
OS (error, NILF, _("touch: '%s' is not a valid archive"), arname);
error (NILF, _("touch: '%s' is not a valid archive"), arname);
break;
case -3:
perror_with_name ("touch: ", arname);
break;
case 1:
OSS (error, NILF,
_("touch: member '%s' does not exist in '%s'"), memname, arname);
error (NILF,
_("touch: Member '%s' does not exist in '%s'"), memname, arname);
break;
case 0:
val = 0;
break;
default:
OS (error, NILF,
_("touch: bad return code from ar_member_touch on '%s'"), name);
error (NILF,
_("touch: Bad return code from ar_member_touch on '%s'"), name);
}
free (arname);
return val;
}
#endif /* !MK_OS_VMS */
#endif /* !VMS */
/* State of an 'ar_glob' run, passed to 'ar_glob_match'. */
/* On VMS, (object) modules in libraries do not have suffixes. That is, to
find a match for a pattern, the pattern must not have any suffix. So the
suffix of the pattern is saved and the pattern is stripped (ar_glob).
If there is a match and the match, which is a module name, is added to
the chain, the saved suffix is added back to construct a source filename
(ar_glob_match). */
struct ar_glob_state
{
const char *arname;
const char *pattern;
#if MK_OS_VMS
char *suffix;
#endif
size_t size;
unsigned int size;
struct nameseq *chain;
unsigned int n;
};
@ -198,11 +184,11 @@ struct ar_glob_state
/* This function is called by 'ar_scan' to match one archive
element against the pattern in STATE. */
static intmax_t
static long int
ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED,
long int hdrpos UNUSED, long int datapos UNUSED,
long int size UNUSED, intmax_t date UNUSED, int uid UNUSED,
int gid UNUSED, unsigned int mode UNUSED, const void *arg)
long int size UNUSED, long int date UNUSED, int uid UNUSED,
int gid UNUSED, int mode UNUSED, const void *arg)
{
struct ar_glob_state *state = (struct ar_glob_state *)arg;
@ -210,25 +196,19 @@ ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED,
{
/* We have a match. Add it to the chain. */
struct nameseq *new = xcalloc (state->size);
#if MK_OS_VMS
if (state->suffix)
new->name = strcache_add(
concat(5, state->arname, "(", mem, state->suffix, ")"));
else
#endif
new->name = strcache_add(concat(4, state->arname, "(", mem, ")"));
new->name = strcache_add (concat (4, state->arname, "(", mem, ")"));
new->next = state->chain;
state->chain = new;
++state->n;
}
return 0;
return 0L;
}
/* Return nonzero if PATTERN contains any metacharacters.
Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
static int
ar_glob_pattern_p (const char *pattern, int quote)
glob_pattern_p (const char *pattern, int quote)
{
const char *p;
int opened = 0;
@ -262,52 +242,25 @@ ar_glob_pattern_p (const char *pattern, int quote)
Return a malloc'd chain of matching elements (or nil if none). */
struct nameseq *
ar_glob (const char *arname, const char *member_pattern, size_t size)
ar_glob (const char *arname, const char *member_pattern, unsigned int size)
{
struct ar_glob_state state;
struct nameseq *n;
const char **names;
unsigned int i;
#if MK_OS_VMS
char *vms_member_pattern;
#endif
if (! ar_glob_pattern_p (member_pattern, 1))
if (! glob_pattern_p (member_pattern, 1))
return 0;
/* Scan the archive for matches.
ar_glob_match will accumulate them in STATE.chain. */
state.arname = arname;
state.pattern = member_pattern;
#if MK_OS_VMS
{
/* In a copy of the pattern, find the suffix, save it and remove it from
the pattern */
char *lastdot;
vms_member_pattern = xstrdup(member_pattern);
lastdot = strrchr(vms_member_pattern, '.');
state.suffix = lastdot;
if (lastdot)
{
state.suffix = xstrdup(lastdot);
*lastdot = 0;
}
state.pattern = vms_member_pattern;
}
#endif
state.size = size;
state.chain = 0;
state.n = 0;
ar_scan (arname, ar_glob_match, &state);
#if MK_OS_VMS
/* Deallocate any duplicated string */
free(vms_member_pattern);
if (state.suffix)
{
free(state.suffix);
}
#endif
if (state.chain == 0)
return 0;

View File

@ -1,5 +1,5 @@
/* Library function for scanning an archive file.
Copyright (C) 1987-2024 Free Software Foundation, Inc.
Copyright (C) 1987-2013 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
@ -12,15 +12,10 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#ifdef TEST
/* Hack, the real error() routine eventually pulls in die from main.c */
#define error(a, b, c, d)
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#else
@ -29,151 +24,105 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef NO_ARCHIVES
#if MK_OS_VMS
#ifdef VMS
#include <lbrdef.h>
#include <mhddef.h>
#include <credef.h>
#include <descrip.h>
#include <ctype.h>
#include <ssdef.h>
#include <stsdef.h>
#include <rmsdef.h>
/* This symbol should be present in lbrdef.h. */
#if !defined LBR$_HDRTRUNC
#pragma extern_model save
#pragma extern_model globalvalue
extern unsigned int LBR$_HDRTRUNC;
#pragma extern_model restore
#endif
#if __DECC
#include <unixlib.h>
#include <lbr$routines.h>
#endif
const char *
vmsify (const char *name, int type);
/* Time conversion from VMS to Unix
Conversion from local time (stored in library) to GMT (needed for gmake)
Note: The tm_gmtoff element is a VMS extension to the ANSI standard. */
static time_t
vms_time_to_unix(void *vms_time)
{
struct tm *tmp;
time_t unix_time;
unix_time = decc$fix_time(vms_time);
tmp = localtime(&unix_time);
unix_time -= tmp->tm_gmtoff;
return unix_time;
}
/* VMS library routines need static variables for callback */
static void *VMS_lib_idx;
static const void *VMS_saved_arg;
static char *VMS_saved_memname;
static intmax_t (*VMS_function) ();
static time_t VMS_member_date;
static intmax_t VMS_function_ret;
static long int (*VMS_function) ();
/* This is a callback procedure for lib$get_index */
static int
VMS_get_member_info(struct dsc$descriptor_s *module, unsigned long *rfa)
VMS_get_member_info (struct dsc$descriptor_s *module, unsigned long *rfa)
{
int status, i;
const int truncated = 0; /* Member name may be truncated */
time_t member_date; /* Member date */
char *filename;
unsigned int buffer_length; /* Actual buffer length */
long int fnval;
/* Unused constants - Make does not actually use most of these */
const int file_desc = -1; /* archive file descriptor for reading the data */
const int header_position = 0; /* Header position */
const int data_position = 0; /* Data position in file */
const int data_size = 0; /* Data size */
const int uid = 0; /* member gid */
const int gid = 0; /* member gid */
const int mode = 0; /* member protection mode */
/* End of unused constants */
time_t val;
static struct dsc$descriptor_s bufdesc =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
/* Only need the module definition */
struct mhddef *mhd;
char filename[128];
/* If a previous callback is non-zero, just return that status */
if (VMS_function_ret)
bufdesc.dsc$a_pointer = filename;
bufdesc.dsc$w_length = sizeof (filename);
status = lbr$set_module (&VMS_lib_idx, rfa, &bufdesc,
&bufdesc.dsc$w_length, 0);
if (! (status & 1))
{
return SS$_NORMAL;
error (NILF, _("lbr$set_module() failed to extract module info, status = %d"),
status);
lbr$close (&VMS_lib_idx);
return 0;
}
/* lbr_set_module returns more than just the module header. So allocate
a buffer which is big enough: the maximum LBR$C_MAXHDRSIZ. That's at
least bigger than the size of struct mhddef.
If the request is too small, a buffer truncated warning is issued so
it can be reissued with a larger buffer.
We do not care if the buffer is truncated, so that is still a success. */
mhd = xmalloc(LBR$C_MAXHDRSIZ);
bufdesc.dsc$a_pointer = (char *) mhd;
bufdesc.dsc$w_length = LBR$C_MAXHDRSIZ;
mhd = (struct mhddef *) filename;
status = lbr$set_module(&VMS_lib_idx, rfa, &bufdesc, &buffer_length, 0);
#ifdef __DECC
/* John Fowler <jfowler@nyx.net> writes this is needed in his environment,
* but that decc$fix_time() isn't documented to work this way. Let me
* know if this causes problems in other VMS environments.
*/
{
/* Modified by M. Gehre at 11-JAN-2008 because old formula is wrong:
* val = decc$fix_time (&mhd->mhd$l_datim) + timezone - daylight*3600;
* a) daylight specifies, if the timezone has daylight saving enabled, not
* if it is active
* b) what we need is the information, if daylight saving was active, if
* the library module was replaced. This information we get using the
* localtime function
*/
if ((status != LBR$_HDRTRUNC) && !$VMS_STATUS_SUCCESS(status))
{
ON(error, NILF,
_("lbr$set_module() failed to extract module info, status = %d"),
status);
struct tm *tmp;
lbr$close(&VMS_lib_idx);
/* Conversion from VMS time to C time */
val = decc$fix_time (&mhd->mhd$l_datim);
return status;
}
#ifdef TEST
/* When testing this code, it is useful to know the length returned */
printf ("Input length = %d, actual = %u\n",
bufdesc.dsc$w_length, buffer_length);
/*
* Conversion from local time (stored in library) to GMT (needed for gmake)
* Note: The tm_gmtoff element is a VMS extension to the ANSI standard.
*/
tmp = localtime (&val);
val -= tmp->tm_gmtoff;
}
#endif
/* Conversion from VMS time to C time.
VMS defectlet - mhddef is sub-optimal, for the time, it has a 32 bit
longword, mhd$l_datim, and a 32 bit fill instead of two longwords, or
equivalent. */
member_date = vms_time_to_unix(&mhd->mhd$l_datim);
free(mhd);
/* Here we have a problem. The module name on VMS does not have
a file type, but the filename pattern in the "VMS_saved_arg"
may have one.
But only the method being called knows how to interpret the
filename pattern.
There are currently two different formats being used.
This means that we need a VMS specific code in those methods
to handle it. */
filename = xmalloc(module->dsc$w_length + 1);
/* TODO: We may need an option to preserve the case of the module
For now force the module name to lower case */
for (i = 0; i < module->dsc$w_length; i++)
filename[i] = _tolower((unsigned char )module->dsc$a_pointer[i]);
filename[i] = _tolower ((unsigned char)module->dsc$a_pointer[i]);
filename[i] = '\0';
VMS_function_ret = (*VMS_function)(file_desc, filename, truncated,
header_position, data_position, data_size, member_date, uid, gid, mode,
VMS_saved_arg);
VMS_member_date = (time_t) -1;
free(filename);
return SS$_NORMAL;
fnval =
(*VMS_function) (-1, filename, 0, 0, 0, 0, val, 0, 0, 0,
VMS_saved_memname);
if (fnval)
{
VMS_member_date = fnval;
return 0;
}
else
return 1;
}
/* Takes three arguments ARCHIVE, FUNCTION and ARG.
Open the archive named ARCHIVE, find its members one by one,
@ -203,97 +152,68 @@ VMS_get_member_info(struct dsc$descriptor_s *module, unsigned long *rfa)
Returns -2 if archive has invalid format.
Returns 0 if have scanned successfully. */
intmax_t
ar_scan (const char *archive, ar_member_func_t function, const void *varg)
long int
ar_scan (const char *archive, ar_member_func_t function, const void *arg)
{
char *vms_archive;
char *p;
static struct dsc$descriptor_s libdesc =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
const unsigned long func = LBR$C_READ;
const unsigned long type = LBR$C_TYP_UNK;
const unsigned long index = 1;
unsigned long lib_idx;
unsigned long func = LBR$C_READ;
unsigned long type = LBR$C_TYP_UNK;
unsigned long index = 1;
int status;
VMS_saved_arg = varg;
status = lbr$ini_control (&VMS_lib_idx, &func, &type, 0);
/* Null archive string can show up in test and cause an access violation */
if (archive == NULL)
if (! (status & 1))
{
/* Null filenames do not exist */
return -1;
}
/* archive path name must be in VMS format */
vms_archive = (char *) vmsify(archive, 0);
status = lbr$ini_control(&VMS_lib_idx, &func, &type, 0);
if (!$VMS_STATUS_SUCCESS(status))
{
ON(error, NILF, _("lbr$ini_control() failed with status = %d"), status);
error (NILF, _("lbr$ini_control() failed with status = %d"), status);
return -2;
}
libdesc.dsc$a_pointer = vms_archive;
libdesc.dsc$w_length = strlen(vms_archive);
/* there is no such descriptor with "const char *dsc$a_pointer" */
libdesc.dsc$a_pointer = (char *)archive;
libdesc.dsc$w_length = strlen (archive);
status = lbr$open(&VMS_lib_idx, &libdesc, 0, NULL, 0, NULL, 0);
status = lbr$open (&VMS_lib_idx, &libdesc, 0, 0, 0, 0, 0);
if (!$VMS_STATUS_SUCCESS(status))
if (! (status & 1))
{
/* TODO: A library format failure could mean that this is a file
generated by the GNU AR utility and in that case, we need to
take the UNIX codepath. This will also take a change to the
GNV AR wrapper program. */
switch (status)
{
case RMS$_FNF:
/* Archive does not exist */
return -1;
default:
#ifndef TEST
OSN(error, NILF,
_("unable to open library '%s' to lookup member status %d"),
archive, status);
#endif
/* For library format errors, specification says to return -2 */
return -2;
}
error (NILF, _("unable to open library '%s' to lookup member '%s'"),
archive, (char *)arg);
return -1;
}
VMS_saved_memname = (char *)arg;
/* For comparison, delete .obj from arg name. */
p = strrchr (VMS_saved_memname, '.');
if (p)
*p = '\0';
VMS_function = function;
/* Clear the return status, as we are supposed to stop calling the
callback function if it becomes non-zero, and this is a static
variable. */
VMS_function_ret = 0;
VMS_member_date = (time_t) -1;
lbr$get_index (&VMS_lib_idx, &index, VMS_get_member_info, 0);
status = lbr$get_index(&VMS_lib_idx, &index, VMS_get_member_info, NULL, 0);
/* Undo the damage. */
if (p)
*p = '.';
lbr$close(&VMS_lib_idx);
lbr$close (&VMS_lib_idx);
/* Unless a failure occurred in the lbr$ routines, return the
the status from the 'function' routine. */
if ($VMS_STATUS_SUCCESS(status))
{
return VMS_function_ret;
}
/* This must be something wrong with the library and an error
message should already have been printed. */
return -2;
return VMS_member_date > 0 ? VMS_member_date : 0;
}
#else /* !MK_OS_VMS */
#else /* !VMS */
/* SCO Unix's compiler defines both of these. */
#ifdef M_UNIX
#undef M_XENIX
#ifdef M_UNIX
#undef M_XENIX
#endif
/* On the sun386i and in System V rel 3, ar.h defines two different archive
@ -302,7 +222,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
to have a nonzero value. */
#if (!defined (PORTAR) || PORTAR == 0) && (!defined (PORT5AR) || PORT5AR == 0)
#undef PORTAR
#undef PORTAR
#ifdef M_XENIX
/* According to Jim Sievert <jas1@rsvl.unisys.com>, for SCO XENIX defining
PORTAR to 1 gets the wrong archive format, and defining it to 0 gets the
@ -330,11 +250,11 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
# define __AR_BIG__
#endif
#if !MK_OS_W32
# if !defined (__ANDROID__) && !defined (__BEOS__) && !defined(MK_OS_ZOS)
#ifndef WINDOWS32
# ifndef __BEOS__
# include <ar.h>
# else
/* These platforms don't have <ar.h> but have archives in the same format
/* BeOS 5 doesn't have <ar.h> but has archives in the same format
* as many other Unices. This was taken from GNU binutils for BeOS.
*/
# define ARMAG "!<arch>\n" /* String that begins an archive file. */
@ -375,38 +295,7 @@ struct ar_hdr
#ifndef AR_HDR_SIZE
# define AR_HDR_SIZE (sizeof (struct ar_hdr))
#endif
#include "intprops.h"
#include "output.h"
static uintmax_t
parse_int (const char *ptr, const size_t len, const int base, uintmax_t max,
const char *type, const char *archive, const char *name)
{
const char *const ep = ptr + len;
const int maxchar = '0' + base - 1;
uintmax_t val = 0;
/* In all the versions I know of the spaces come last, but be safe. */
while (ptr < ep && *ptr == ' ')
++ptr;
while (ptr < ep && *ptr != ' ')
{
if (*ptr < '0' || *ptr > maxchar
|| INT_MULTIPLY_WRAPV (val, base, &val)
|| INT_ADD_WRAPV (val, *ptr - '0', &val)
|| val > max)
OSSS (fatal, NILF,
_("invalid %s for archive %s member %s"), type, archive, name);
++ptr;
}
return val;
}
/* Takes three arguments ARCHIVE, FUNCTION and ARG.
Open the archive named ARCHIVE, find its members one by one,
@ -434,7 +323,7 @@ parse_int (const char *ptr, const size_t len, const int base, uintmax_t max,
Returns -2 if archive has invalid format.
Returns 0 if have scanned successfully. */
intmax_t
long int
ar_scan (const char *archive, ar_member_func_t function, const void *arg)
{
#ifdef AIAMAG
@ -445,51 +334,59 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
# endif
#endif
char *namemap = 0;
unsigned int namemap_size = 0;
int desc = open (archive, O_RDONLY, 0);
if (desc < 0)
return -1;
#ifdef SARMAG
{
char buf[SARMAG];
int nread;
nread = readbuf (desc, buf, SARMAG);
register int nread = read (desc, buf, SARMAG);
if (nread != SARMAG || memcmp (buf, ARMAG, SARMAG))
goto invalid;
{
(void) close (desc);
return -2;
}
}
#else
#ifdef AIAMAG
{
int nread;
nread = readbuf (desc, &fl_header, FL_HSZ);
if (nread != FL_HSZ)
goto invalid;
register int nread = read (desc, &fl_header, FL_HSZ);
if (nread != FL_HSZ)
{
(void) close (desc);
return -2;
}
#ifdef AIAMAGBIG
/* If this is a "big" archive, then set the flag and
re-read the header into the "big" structure. */
if (!memcmp (fl_header.fl_magic, AIAMAGBIG, SAIAMAG))
{
off_t o;
big_archive = 1;
/* seek back to beginning of archive */
EINTRLOOP (o, lseek (desc, 0, 0));
if (o < 0)
goto invalid;
if (lseek (desc, 0, 0) < 0)
{
(void) close (desc);
return -2;
}
/* re-read the header into the "big" structure */
nread = readbuf (desc, &fl_header_big, FL_HSZ_BIG);
nread = read (desc, &fl_header_big, FL_HSZ_BIG);
if (nread != FL_HSZ_BIG)
goto invalid;
{
(void) close (desc);
return -2;
}
}
else
#endif
/* Check to make sure this is a "normal" archive. */
if (memcmp (fl_header.fl_magic, AIAMAG, SAIAMAG))
goto invalid;
{
(void) close (desc);
return -2;
}
}
#else
{
@ -498,10 +395,12 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
#else
unsigned short int buf;
#endif
int nread;
nread = readbuf (desc, &buf, sizeof (buf));
register int nread = read (desc, &buf, sizeof (buf));
if (nread != sizeof (buf) || buf != ARMAG)
goto invalid;
{
(void) close (desc);
return -2;
}
}
#endif
#endif
@ -509,7 +408,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
/* Now find the members one by one. */
{
#ifdef SARMAG
long int member_offset = SARMAG;
register long int member_offset = SARMAG;
#else
#ifdef AIAMAG
long int member_offset;
@ -536,46 +435,41 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
}
#else
#ifndef M_XENIX
long int member_offset = sizeof (int);
register long int member_offset = sizeof (int);
#else /* Xenix. */
long int member_offset = sizeof (unsigned short int);
register long int member_offset = sizeof (unsigned short int);
#endif /* Not Xenix. */
#endif
#endif
while (1)
{
ssize_t nread;
register int nread;
struct ar_hdr member_header;
#ifdef AIAMAGBIG
struct ar_hdr_big member_header_big;
#endif
#ifdef AIAMAG
# define ARNAME_MAX 255
char name[ARNAME_MAX + 1];
char name[256];
int name_len;
intmax_t dateval;
long int dateval;
int uidval, gidval;
long int data_offset;
#else
# define ARNAME_MAX (int)sizeof(member_header.ar_name)
char namebuf[ARNAME_MAX + 1];
char namebuf[sizeof member_header.ar_name + 1];
char *name;
int is_namemap; /* Nonzero if this entry maps long names. */
int long_name = 0;
#endif
long int eltsize;
unsigned int eltmode;
intmax_t eltdate;
int eltuid, eltgid;
intmax_t fnval;
off_t o;
int eltmode;
long int fnval;
memset(&member_header, '\0', sizeof (member_header));
EINTRLOOP (o, lseek (desc, member_offset, 0));
if (o < 0)
goto invalid;
if (lseek (desc, member_offset, 0) < 0)
{
(void) close (desc);
return -2;
}
#ifdef AIAMAG
#define AR_MEMHDR_SZ(x) (sizeof(x) - sizeof (x._ar_name))
@ -583,23 +477,27 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
#ifdef AIAMAGBIG
if (big_archive)
{
nread = readbuf (desc, &member_header_big,
AR_MEMHDR_SZ(member_header_big));
nread = read (desc, &member_header_big,
AR_MEMHDR_SZ(member_header_big) );
if (nread != AR_MEMHDR_SZ(member_header_big))
goto invalid;
{
(void) close (desc);
return -2;
}
sscanf (member_header_big.ar_namlen, "%4d", &name_len);
if (name_len < 1 || name_len > ARNAME_MAX)
goto invalid;
nread = read (desc, name, name_len);
nread = readbuf (desc, name, name_len);
if (nread != name_len)
goto invalid;
{
(void) close (desc);
return -2;
}
name[name_len] = '\0';
name[name_len] = 0;
sscanf (member_header_big.ar_date, "%12" SCNdMAX, &dateval);
sscanf (member_header_big.ar_date, "%12ld", &dateval);
sscanf (member_header_big.ar_uid, "%12d", &uidval);
sscanf (member_header_big.ar_gid, "%12d", &gidval);
sscanf (member_header_big.ar_mode, "%12o", &eltmode);
@ -611,23 +509,27 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
else
#endif
{
nread = readbuf (desc, &member_header,
AR_MEMHDR_SZ(member_header));
nread = read (desc, &member_header,
AR_MEMHDR_SZ(member_header) );
if (nread != AR_MEMHDR_SZ(member_header))
goto invalid;
{
(void) close (desc);
return -2;
}
sscanf (member_header.ar_namlen, "%4d", &name_len);
if (name_len < 1 || name_len > ARNAME_MAX)
goto invalid;
nread = read (desc, name, name_len);
nread = readbuf (desc, name, name_len);
if (nread != name_len)
goto invalid;
{
(void) close (desc);
return -2;
}
name[name_len] = '\0';
name[name_len] = 0;
sscanf (member_header.ar_date, "%12" SCNdMAX, &dateval);
sscanf (member_header.ar_date, "%12ld", &dateval);
sscanf (member_header.ar_uid, "%12d", &uidval);
sscanf (member_header.ar_gid, "%12d", &gidval);
sscanf (member_header.ar_mode, "%12o", &eltmode);
@ -645,7 +547,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
eltmode, arg);
#else /* Not AIAMAG. */
nread = readbuf (desc, &member_header, AR_HDR_SIZE);
nread = read (desc, &member_header, AR_HDR_SIZE);
if (nread == 0)
/* No data left means end of file; that is OK. */
break;
@ -667,12 +569,15 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
)
#endif
)
goto invalid;
{
(void) close (desc);
return -2;
}
name = namebuf;
memcpy (name, member_header.ar_name, sizeof member_header.ar_name);
{
char *p = name + sizeof member_header.ar_name;
register char *p = name + sizeof member_header.ar_name;
do
*p = '\0';
while (p > name && *--p == ' ');
@ -687,7 +592,6 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
is_namemap = (!strcmp (name, "//")
|| !strcmp (name, "ARFILENAMES/"));
#endif /* Not AIAMAG. */
/* On some systems, there is a slash after each member name. */
if (*p == '/')
*p = '\0';
@ -702,35 +606,23 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
&& (name[0] == ' ' || name[0] == '/')
&& namemap != 0)
{
const char* err;
unsigned int name_off = make_toui (name + 1, &err);
size_t name_len;
if (err|| name_off >= namemap_size)
goto invalid;
name = namemap + name_off;
name_len = strlen (name);
if (name_len < 1)
goto invalid;
name = namemap + atoi (name + 1);
long_name = 1;
}
else if (name[0] == '#'
&& name[1] == '1'
&& name[2] == '/')
{
const char* err;
unsigned int name_len = make_toui (name + 3, &err);
int namesize = atoi (name + 3);
if (err || name_len == 0 || name_len >= MIN (PATH_MAX, INT_MAX))
goto invalid;
name = alloca (name_len + 1);
nread = readbuf (desc, name, name_len);
if (nread < 0 || (unsigned int) nread != name_len)
goto invalid;
name[name_len] = '\0';
name = alloca (namesize + 1);
nread = read (desc, name, namesize);
if (nread != namesize)
{
close (desc);
return -2;
}
name[namesize] = '\0';
long_name = 1;
}
@ -738,16 +630,8 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
}
#ifndef M_XENIX
#define PARSE_INT(_m, _t, _b, _n) \
(_t) parse_int (TOCHAR (member_header._m), sizeof (member_header._m), \
_b, TYPE_MAXIMUM (_t), _n, archive, name)
eltmode = PARSE_INT (ar_mode, unsigned int, 8, "mode");
eltsize = PARSE_INT (ar_size, long, 10, "size");
eltdate = PARSE_INT (ar_date, intmax_t, 10, "date");
eltuid = PARSE_INT (ar_uid, int, 10, "uid");
eltgid = PARSE_INT (ar_gid, int, 10, "gid");
#undef PARSE_INT
sscanf (TOCHAR (member_header.ar_mode), "%o", &eltmode);
eltsize = atol (TOCHAR (member_header.ar_size));
#else /* Xenix. */
eltmode = (unsigned short int) member_header.ar_mode;
eltsize = member_header.ar_size;
@ -757,7 +641,9 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
(*function) (desc, name, ! long_name, member_offset,
member_offset + AR_HDR_SIZE, eltsize,
#ifndef M_XENIX
eltdate, eltuid, eltgid,
atol (TOCHAR (member_header.ar_date)),
atoi (TOCHAR (member_header.ar_uid)),
atoi (TOCHAR (member_header.ar_gid)),
#else /* Xenix. */
member_header.ar_date,
member_header.ar_uid,
@ -786,7 +672,10 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
sscanf (member_header.ar_nxtmem, "%12ld", &member_offset);
if (lseek (desc, member_offset, 0) != member_offset)
goto invalid;
{
(void) close (desc);
return -2;
}
#else
/* If this member maps archive names, we must read it in. The
@ -797,13 +686,13 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
char *clear;
char *limit;
if (eltsize > INT_MAX)
goto invalid;
namemap = alloca (eltsize + 1);
nread = readbuf (desc, namemap, eltsize);
namemap = alloca (eltsize);
nread = read (desc, namemap, eltsize);
if (nread != eltsize)
goto invalid;
namemap_size = eltsize;
{
(void) close (desc);
return -2;
}
/* The names are separated by newlines. Some formats have
a trailing slash. Null terminate the strings for
@ -818,7 +707,6 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
clear[-1] = '\0';
}
}
*limit = '\0';
is_namemap = 0;
}
@ -832,12 +720,8 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
close (desc);
return 0;
invalid:
close (desc);
return -2;
}
#endif /* !MK_OS_VMS */
#endif /* !VMS */
/* Return nonzero iff NAME matches MEM.
If TRUNCATED is nonzero, MEM may be truncated to
@ -848,16 +732,11 @@ ar_name_equal (const char *name, const char *mem, int truncated)
{
const char *p;
/* GNU ar allows -P to preserve parent paths, so test the literal name
before stripping off the directory. */
if (streq (name, mem))
return 1;
p = strrchr (name, '/');
if (p != 0)
name = p + 1;
#if !MK_OS_VMS
#ifndef VMS
if (truncated)
{
#ifdef AIAMAG
@ -872,41 +751,18 @@ ar_name_equal (const char *name, const char *mem, int truncated)
#endif /* !__hpux && !cray */
#endif /* !AIAMAG */
}
#endif /* !VMS */
return !strcmp (name, mem);
#else
/* VMS members do not have suffixes, but the filenames usually
have.
Do we need to strip VMS disk/directory format paths?
Most VMS compilers etc. by default are case insensitive
but produce uppercase external names, incl. module names.
However the VMS librarian (ar) and the linker by default
are case sensitive: they take what they get, usually
uppercase names. So for the non-default settings of the
compilers etc. there is a need to have a case sensitive
mode. */
{
int len;
len = strlen(mem);
int match;
char *dot;
if ((dot=strrchr(name,'.')))
match = (len == dot - name) && !strncasecmp(name, mem, len);
else
match = !strcasecmp (name, mem);
return match;
}
#endif /* !MK_OS_VMS */
}
#if !MK_OS_VMS
#ifndef VMS
/* ARGSUSED */
static intmax_t
static long int
ar_member_pos (int desc UNUSED, const char *mem, int truncated,
long int hdrpos, long int datapos UNUSED, long int size UNUSED,
intmax_t date UNUSED, int uid UNUSED, int gid UNUSED,
unsigned int mode UNUSED, const void *name)
long int date UNUSED, int uid UNUSED, int gid UNUSED,
int mode UNUSED, const void *name)
{
if (!ar_name_equal (name, mem, truncated))
return 0;
@ -923,13 +779,11 @@ ar_member_pos (int desc UNUSED, const char *mem, int truncated,
int
ar_member_touch (const char *arname, const char *memname)
{
intmax_t pos = ar_scan (arname, ar_member_pos, memname);
off_t opos;
long int pos = ar_scan (arname, ar_member_pos, memname);
int fd;
struct ar_hdr ar_hdr;
off_t o;
int r;
int datelen;
int i;
unsigned int ui;
struct stat statbuf;
if (pos < 0)
@ -937,67 +791,63 @@ ar_member_touch (const char *arname, const char *memname)
if (!pos)
return 1;
opos = (off_t) pos;
EINTRLOOP (fd, open (arname, O_RDWR, 0666));
fd = open (arname, O_RDWR, 0666);
if (fd < 0)
return -3;
/* Read in this member's header */
EINTRLOOP (o, lseek (fd, opos, 0));
if (o < 0)
if (lseek (fd, pos, 0) < 0)
goto lose;
r = readbuf (fd, &ar_hdr, AR_HDR_SIZE);
if (r != AR_HDR_SIZE)
if (AR_HDR_SIZE != read (fd, &ar_hdr, AR_HDR_SIZE))
goto lose;
/* Write back the header, thus touching the archive file. */
if (lseek (fd, pos, 0) < 0)
goto lose;
if (AR_HDR_SIZE != write (fd, &ar_hdr, AR_HDR_SIZE))
goto lose;
/* The file's mtime is the time we we want. */
EINTRLOOP (r, fstat (fd, &statbuf));
if (r < 0)
EINTRLOOP (i, fstat (fd, &statbuf));
if (i < 0)
goto lose;
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32)
/* Advance member's time to that time */
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || MK_OS_W32
datelen = snprintf (TOCHAR (ar_hdr.ar_date), sizeof ar_hdr.ar_date,
"%" PRIdMAX, (intmax_t) statbuf.st_mtime);
if (! (0 <= datelen && datelen < (int) sizeof ar_hdr.ar_date))
goto lose;
memset (ar_hdr.ar_date + datelen, ' ', sizeof ar_hdr.ar_date - datelen);
for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)
ar_hdr.ar_date[ui] = ' ';
sprintf (TOCHAR (ar_hdr.ar_date), "%ld", (long int) statbuf.st_mtime);
#ifdef AIAMAG
ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';
#endif
#else
ar_hdr.ar_date = statbuf.st_mtime;
#endif
/* Write back this member's header */
EINTRLOOP (o, lseek (fd, opos, 0));
if (o < 0)
if (lseek (fd, pos, 0) < 0)
goto lose;
r = writebuf (fd, &ar_hdr, AR_HDR_SIZE);
if (r != AR_HDR_SIZE)
if (AR_HDR_SIZE != write (fd, &ar_hdr, AR_HDR_SIZE))
goto lose;
close (fd);
return 0;
lose:
r = errno;
i = errno;
close (fd);
errno = r;
errno = i;
return -3;
}
#endif
#ifdef TEST
intmax_t
long int
describe_member (int desc, const char *name, int truncated,
long int hdrpos, long int datapos, long int size,
intmax_t date, int uid, int gid, unsigned int mode,
const void *arg)
long int date, int uid, int gid, int mode, const void *arg)
{
extern char *ctime ();
time_t d = date;
char const *ds;
printf (_("Member '%s'%s: %ld bytes at %ld (%ld).\n"),
name, truncated ? _(" (name might be truncated)") : "",
size, hdrpos, datapos);
ds = ctime (&d);
printf (_(" Date %s"), ds ? ds : "?");
printf (_(" Date %s"), ctime (&date));
printf (_(" uid = %d, gid = %d, mode = 0%o.\n"), uid, gid, mode);
return 0;

View File

@ -1,39 +0,0 @@
#!/bin/sh
# Convenience script for regenerating all autogeneratable files that are
# omitted from the version control repository. In particular, this script
# also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
# with new versions of autoconf or automake.
# Copyright (C) 2003-2024 Free Software Foundation, Inc.
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as top/autogen.sh in gnulib. However, to be
# useful to your package, you should place a copy of it under version
# control in the top-level directory of your package. The intent is
# that all customization can be done with a bootstrap.conf file also
# maintained in your version control; gnulib comes with a template
# build-aux/bootstrap.conf to get you started.
#
# Alternatively, you can use an autogen.sh script that is specific
# to your package.
me="$0"
medir=`dirname "$me"`
# Read the function library and the configuration.
. "$medir"/bootstrap-funclib.sh
autogen "$@"

View File

@ -1,37 +0,0 @@
#!/bin/sh
# Convenience script for fetching auxiliary files that are omitted from
# the version control repository of this package.
# Copyright (C) 2003-2024 Free Software Foundation, Inc.
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as top/autopull.sh in gnulib. However, to be
# useful to your package, you should place a copy of it under version
# control in the top-level directory of your package. The intent is
# that all customization can be done with a bootstrap.conf file also
# maintained in your version control; gnulib comes with a template
# build-aux/bootstrap.conf to get you started.
#
# Alternatively, you can use an autopull.sh script that is specific
# to your package.
me="$0"
medir=`dirname "$me"`
# Read the function library and the configuration.
. "$medir"/bootstrap-funclib.sh
autopull "$@"

226
bootstrap
View File

@ -1,226 +0,0 @@
#! /bin/sh
# Bootstrap this package from checked-out sources.
scriptversion=2022-12-27.07; # UTC
# Copyright (C) 2003-2023 Free Software Foundation, Inc.
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as top/bootstrap in gnulib. However, to be
# useful to your package, you should place a copy of it under version
# control in the top-level directory of your package. The intent is
# that all customization can be done with a bootstrap.conf file also
# maintained in your version control; gnulib comes with a template
# build-aux/bootstrap.conf to get you started.
# Please report bugs or propose patches to bug-gnulib@gnu.org.
me="$0"
medir=`dirname "$me"`
# Read the function library and the configuration.
. "$medir"/bootstrap-funclib.sh
usage() {
cat <<EOF
Usage: $me [OPTION]...
Bootstrap this package from the checked-out sources.
Optional environment variables:
GNULIB_SRCDIR Specifies the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
do not want to waste your bandwidth downloading
them again.
GNULIB_URL Cloneable URL of the gnulib repository.
Options:
--pull Do phase 1: pull files from network
--gen Do phase 2: generate from local files.
(The default is to do both phases.)
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
you want to use these sources. Defaults
to \$GNULIB_SRCDIR
--gnulib-refdir=DIRNAME specify the local directory where a gnulib
repository (with a .git subdirectory) resides.
Use this if you already have gnulib sources
and history on your machine, and do not want
to waste your bandwidth downloading them again.
Defaults to \$GNULIB_REFDIR
--bootstrap-sync if this bootstrap script is not identical to
the version in the local gnulib sources,
update this script, and then restart it with
/bin/sh or the shell \$CONFIG_SHELL
--no-bootstrap-sync do not check whether bootstrap is out of sync
--copy copy files instead of creating symbolic links
--force attempt to bootstrap even if the sources seem
not to have been checked out
--no-git do not use git to update gnulib. Requires that
\$GNULIB_SRCDIR or the --gnulib-srcdir option
points to a gnulib repository with the correct
revision
--skip-po do not download po files
EOF
bootstrap_print_option_usage_hook
cat <<EOF
If the file bootstrap.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Gnulib sources can be fetched in various ways:
* If the environment variable GNULIB_SRCDIR is set (either as an
environment variable or via the --gnulib-srcdir option), then sources
are fetched from that local directory. If it is a git repository and
the configuration variable GNULIB_REVISION is set in bootstrap.conf,
then that revision is checked out.
* Otherwise, if this package is in a git repository with a 'gnulib'
submodule configured, then that submodule is initialized and updated
and sources are fetched from there. If GNULIB_REFDIR is set (either
as an environment variable or via the --gnulib-refdir option) and is
a git repository, then it is used as a reference.
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
are cloned into that directory using git from \$GNULIB_URL, defaulting
to $default_gnulib_url.
If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
then that revision is checked out.
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
used. If it is a git repository and the configuration variable
GNULIB_REVISION is set in bootstrap.conf, then that revision is
checked out.
If you maintain a package and want to pin a particular revision of the
Gnulib sources that has been tested with your package, then there are
two possible approaches: either configure a 'gnulib' submodule with the
appropriate revision, or set GNULIB_REVISION (and if necessary
GNULIB_URL) in bootstrap.conf.
Running without arguments will suffice in most cases.
EOF
}
# Parse options.
# Whether to pull and generate.
pull=false
gen=false
# Whether to use copies instead of symlinks.
copy=false
# Use git to update gnulib sources
use_git=true
for option
do
case $option in
--help)
usage
exit;;
--version)
set -e
echo "bootstrap $scriptversion lib $scriptlibversion"
echo "$copyright"
exit 0
;;
--pull)
pull=true;;
--gen)
gen=true;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--gnulib-refdir=*)
GNULIB_REFDIR=${option#--gnulib-refdir=};;
--skip-po)
SKIP_PO=t;;
--force)
checkout_only_file=;;
--copy)
copy=true;;
--bootstrap-sync)
bootstrap_sync=true;;
--no-bootstrap-sync)
bootstrap_sync=false;;
--no-git)
use_git=false;;
*)
bootstrap_option_hook $option || die "$option: unknown option";;
esac
done
# Default is to do both.
$pull || $gen || pull=true gen=true
$use_git || test -n "$GNULIB_SRCDIR" \
|| die "Error: --no-git requires \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option"
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
|| die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option is specified, but does not denote a directory"
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
die "Bootstrapping from a non-checked-out distribution is risky."
fi
check_build_prerequisites $use_git
if $bootstrap_sync; then
prepare_GNULIB_SRCDIR
upgrade_bootstrap
# Since we have now upgraded if needed, no need to try it a second time below.
bootstrap_sync=false
fi
echo "$0: Bootstrapping from checked-out $package sources..."
# Pass GNULIB_SRCDIR and GNULIB_REFDIR to any subsidiary commands that care.
export GNULIB_SRCDIR
export GNULIB_REFDIR
if $pull && { $use_git || test -z "$SKIP_PO"; }; then
autopull \
`if $bootstrap_sync; then echo ' --bootstrap-sync'; else echo ' --no-bootstrap-sync'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
`if ! $use_git; then echo ' --no-git'; fi` \
`if test -n "$SKIP_PO"; then echo ' --skip-po'; fi` \
|| die "could not fetch auxiliary files"
fi
if $gen; then
autogen \
`if $copy; then echo ' --copy'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|| die "could not generate auxiliary files"
fi
# ----------------------------------------------------------------------------
# Local Variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -1,116 +0,0 @@
@echo off
:: Copyright (C) 2018-2024 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 3 of the License, 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 this program. If not, see <https://www.gnu.org/licenses/>.
setlocal
set "svurl=https://git.savannah.gnu.org/cgit"
set "gnuliburl=%svurl%/gnulib.git/plain"
where curl >nul 2>&1
if ERRORLEVEL 1 (
echo Cannot find curl: it must be installed for bootstrap
exit /b 1
)
where sed >nul 2>&1
if ERRORLEVEL 1 (
echo Cannot find sed: it must be installed for bootstrap
echo Hint: you can use the sed provided in the Git for Windows install
exit /b 1
)
if exist lib goto Downloads
mkdir lib
if ERRORLEVEL 1 exit /b 1
:Downloads
echo -- Downloading Gnulib modules
call :Download lib getloadavg.c
call :Download lib intprops.h
call :Download lib intprops-internal.h
echo -- Configuring the workspace
copy /Y gl\lib\*.* lib > nul
:: In general it's tricky to use special characters as arguments to a program
:: in Windows batch files; the quoting rules are obscure and have changed over
:: time which means older systems may behave differently. However, Windows
:: echo is a dumb program that just writes out its command line without much
:: interpreting: all we have to be careful of is ^ quoting. So, use echo
:: to create script files to use with sed -f rather than using sed -e.
:: Create a sed script to convert templates
if exist convert.sed del /Q convert.sed
echo s,@PACKAGE@,make,g > convert.sed
if ERRORLEVEL 1 goto Failed
echo s,@PACKAGE_BUGREPORT@,bug-make@gnu.org,g >> convert.sed
if ERRORLEVEL 1 goto Failed
echo s,@PACKAGE_NAME@,GNU Make,g >> convert.sed
if ERRORLEVEL 1 goto Failed
echo s,@PACKAGE_TARNAME@,make,g >> convert.sed
if ERRORLEVEL 1 goto Failed
echo s,@PACKAGE_URL@,https://www.gnu.org/software/make/,g >> convert.sed
echo s/^^AC_INIT^(\[GNU.Make\],\[\^([0-9.]*\^)\].*/s,@PACKAGE_VERSION@,\1,g/p > cac.sed
sed -n -f cac.sed configure.ac >> convert.sed
if ERRORLEVEL 1 goto Failed
:: Get the list of sources from Makefile.am
echo s,\\\n,,g > mam.sed
echo s,[ \t][ \t]*, ,g >> mam.sed
echo s, [^^ ]*\.h,,g >> mam.sed
echo s,src/,$^(src^),g >> mam.sed
echo s,lib/,$^(lib^),g >> mam.sed
echo s/^^\^([A-Za-z0-9]*\^)_SRCS *= *\^(.*\^)/s,%%\1_SOURCES%%,\2,/p > mam2.sed
sed -z -f mam.sed Makefile.am | sed -n -f mam2.sed >> convert.sed
if ERRORLEVEL 1 goto Failed
echo - Creating Basic.mk
sed -f convert.sed Basic.mk.template > Basic.mk
if ERRORLEVEL 1 goto Failed
echo - Creating src\mkconfig.h
sed -f convert.sed src\mkconfig.h.in > src\mkconfig.h
if ERRORLEVEL 1 goto Failed
echo - Creating src\gmk-default.h
echo static const char *const GUILE_module_defn = ^" \ > src\gmk-default.h
echo s/;.*// > gmk.sed
echo /^^[ \t]*$/d >> gmk.sed
echo s/"/\\"/g >> gmk.sed
echo s/$/ \\/ >> gmk.sed
sed -f gmk.sed src\gmk-default.scm >> src\gmk-default.h
if ERRORLEVEL 1 goto Failed
echo ^";>> src\gmk-default.h
:: These files would be created by bootstrap; they are not needed on Windows
:: but our makefile depends on them
echo >> lib\alloca.in.h
del /Q convert.sed cac.sed mam.sed mam2.sed gmk.sed
echo.
echo Done. Run build_w32.bat to build GNU Make.
goto :EOF
:Download
if exist "%1\%2" goto :EOF
echo - Downloading %1\%2
curl -sS -o "%1\%2" "%gnuliburl%/%1/%2"
if ERRORLEVEL 1 exit /b 1
goto :EOF
:Failed
echo *** Bootstrap failed.
echo Resolve the issue, or use the configured source in the release tarball
exit /b 1

View File

@ -1,65 +0,0 @@
# Bootstrap configuration. -*-shell-script-*-
# Copyright (C) 2018-2024 Free Software Foundation, Inc.
# 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 3 of the License, 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
# this program. If not, see <https://www.gnu.org/licenses/>.
# Allow bootstrap to know that this is not a package
checkout_only_file=README.git
# Choose a specific version of gnulib, when checking out
GNULIB_REVISION=stable-202407
# Always copy files rather than symlink
copy=true
# Additional xgettext options to use. Use "\\\newline" to break lines.
# Ensure that all our magical output macros are correctly marked as
# C (printf) format strings.
XGETTEXT_OPTIONS='\\\
--from-code=UTF-8\\\
--flag=_:1:pass-c-format\\\
--flag=N_:1:pass-c-format\\\
--flag=DB:2:c-format --flag=DBF:2:c-format --flag=DBS:2:c-format\\\
--flag=O:3:c-format --flag=OSN:3:c-format --flag=ONS:3:c-format\\\
--flag=OS:3:c-format --flag=OSS:3:c-format --flag=OSSS:3:c-format\\\
--flag=ON:3:c-format --flag=ONN:3:c-format\\\
'
# We manage our own .gitignore files
vc_ignore=
# Build prerequisites
buildreq="\
autoconf 2.72
automake 1.16.5
"
gnulib_name=libgnu
gnulib_files="doc/make-stds.texi m4/sig_atomic_t.m4"
# Using the full strtoll module pulls in a lot of stuff. But, it's pretty
# simple to use just the base source file, so pull that. We'll use it in
# src/misc.c if strtoll() is not found.
gnulib_files="$gnulib_files lib/strtol.c"
gnulib_modules="\
alloca
fdl
findprog-in
getloadavg
host-cpu-c-abi
largefile
make-glob
make-macros"

View File

@ -1,38 +0,0 @@
# Configuration for building GNU Make in the absence of any 'make' program.
# @configure_input@
# Copyright (C) 1993-2024 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 3 of the License, 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
# this program. If not, see <https://www.gnu.org/licenses/>.
# See Makefile.in for comments describing these variables.
top_srcdir='@top_srcdir@'
prefix='@prefix@'
exec_prefix=`eval echo @exec_prefix@`
CC='@CC@'
AR='@AR@'
CFLAGS='@CFLAGS@ @GUILE_CFLAGS@'
CPPFLAGS='@CPPFLAGS@'
DEFS='@DEFS@'
ARFLAGS='@ARFLAGS@'
LDFLAGS='@AM_LDFLAGS@ @LDFLAGS@'
ALLOCA='@ALLOCA@'
LOADLIBES='@LIBS@ @GUILE_LIBS@ @LIBINTL@'
REMOTE='@REMOTE@'
OBJEXT='@OBJEXT@'
EXEEXT='@EXEEXT@'

176
build.sh
View File

@ -1,176 +0,0 @@
#!/bin/sh
# Shell script to build GNU Make in the absence of any 'make' program.
# Copyright (C) 1993-2024 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 3 of the License, 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
# this program. If not, see <https://www.gnu.org/licenses/>.
# Get configure-generated values
. ./build.cfg
die () { echo "$*" 1>&2; exit 1; }
usage () { echo "$0 [-k]"; exit $1; }
keep_going=false
: ${OUTDIR:=.}
OUTLIB="$OUTDIR/lib"
# Directory to find libraries in for '-lXXX'.
libdir=$exec_prefix/lib
# Directory to search by default for included makefiles.
includedir=$prefix/include
localedir=$prefix/share/locale
defines="-DLOCALEDIR=\"$localedir\" -DLIBDIR=\"$libdir\" -DINCLUDEDIR=\"$includedir\""
# Look up a make variable value.
# It can handle simple recursion where variables are separate words.
# Print the value to stdout.
get_mk_var ()
{
v=$(sed -e :a -e '/\\$/N; s/\\\n//; ta' "$1" | sed -n "s=^ *$2 *\= *==p")
for w in $v; do
case $w in
(\$[\(\{]*[\)\}]) w=${w#\$[\(\{]}; (get_mk_var "$1" "${w%[\)\}]}") ;;
(*) echo "$w" ;;
esac
done
}
# Compile source files. Object files are put into $objs.
compile ()
{
success=true
objs=
for ofile in "$@"; do
# We should try to use a Makefile variable like libgnu_a_SOURCES or
# something but just hardcode it.
file="${ofile%.$OBJEXT}.c"
case $file in
(lib/libgnu_a-*.c) file="lib/${file#lib/libgnu_a-}" ;;
esac
echo "compiling $file..."
of="$OUTDIR/$ofile"
mkdir -p "${of%/*}" || exit 1
if $CC $cflags $CPPFLAGS $CFLAGS -c -o "$of" "$top_srcdir/$file"; then
: worked
else
$keep_going || die "Compilation failed."
success=false
fi
objs="${objs:+$objs }$of"
done
$success
}
# Use config.status to convert a .in file. Output file is put into $out.
# $out will be empty if no conversion was needed.
convert ()
{
out=
base=$1
var="GENERATE_$(echo $base | tr 'a-z./+' A-Z__X)"
# Is this file disabled?
grep "${var}_FALSE\"]=\"\"" config.status >/dev/null && return 0
# If there's no .in file then no conversion needed
in="$top_srcdir/lib/$(echo ${base%.*}.in.${base##*.} | tr / _)"
test -f "$in" || return 0
# Not disabled, so create it
out="$OUTLIB/$base"
mkdir -p "${out%/*}"
# First perform the normal replacements, using config.status
sed -e 's|@GUARD_PREFIX@|GL|g' \
-e 's/@GNULIB_UNISTD_H_GETOPT@/0/g' \
"$in" > "${out}_"
./config.status --file "${out}__:${out}_"
int="${out}__"
# Then see if there any files we need to include. Unfortunately there's no
# algorithmic conversion so we just have to hard-code it.
incls=$(sed -n 's/.*definitions* of \(_[^ $]*\).*/\1/p' "$in")
for inc in $incls; do
case $inc in
(_GL_FUNCDECL_RPL) fn=$(get_mk_var lib/Makefile CXXDEFS_H) ;;
(_GL_ARG_NONNULL) fn=$(get_mk_var lib/Makefile ARG_NONNULL_H) ;;
(_GL_WARN_ON_USE) fn=$(get_mk_var lib/Makefile WARN_ON_USE_H) ;;
(_Noreturn) fn=$(get_mk_var lib/Makefile _NORETURN_H) ;;
(*) echo "Unknown file replacement: $inc"; exit 1 ;;
esac
fn="$top_srcdir/lib/${fn##*/}"
test -f "$fn" || { echo "Missing file: $fn"; exit 1; }
sed "/definitions* of $inc/r $fn" "$int" > "${int}_"
int=${int}_
done
# Done!
mv "$int" "$out"
}
# Get source files provided from gnulib and convert to object files
LIBOBJS=
for lo in $( (get_mk_var lib/Makefile libgnu_a_OBJECTS; get_mk_var lib/Makefile libgnu_a_LIBADD) | sed "s=\$[\(\{]OBJEXT[\)\}]=$OBJEXT=g"); do
LIBOBJS="${LIBOBJS:+$LIBOBJS }lib/$lo"
done
# Get object files from the Makefile
OBJS=$(get_mk_var Makefile make_OBJECTS | sed "s=\$[\(\{]OBJEXT[\)\}]=$OBJEXT=g")
while test -n "$1"; do
case $1 in
(-k) keep_going=true; shift ;;
(--) shift; break ;;
(-[h?]) usage 0 ;;
(-*) echo "Unknown option: $1"; usage 1 ;;
esac
done
test -z "$1" || die "Unknown argument: $*"
# Generate gnulib header files that would normally be created by make
set -e
for b in $(get_mk_var lib/Makefile BUILT_SOURCES); do
convert $b
done
set +e
# Build the gnulib library
cflags="$DEFS -I$OUTLIB -Ilib -I$top_srcdir/lib -I$OUTDIR/src -Isrc -I$top_srcdir/src"
compile $LIBOBJS || die "Compilation failed."
echo "creating libgnu.a..."
$AR $ARFLAGS "$OUTLIB"/libgnu.a $objs || die "Archive of libgnu failed."
# Compile the source files into those objects.
cflags="$DEFS $defines -I$OUTDIR/src -Isrc -I$top_srcdir/src -I$OUTLIB -Ilib -I$top_srcdir/lib"
compile $OBJS || die "Compilation failed."
# Link all the objects together.
echo "linking make..."
$CC $CFLAGS $LDFLAGS -L"$OUTLIB" -o "$OUTDIR/makenew$EXEEXT" $objs -lgnu $LOADLIBES || die "Link failed."
mv -f "$OUTDIR/makenew$EXEEXT" "$OUTDIR/make$EXEEXT" || exit 1
echo done.

81
build.template Normal file
View File

@ -0,0 +1,81 @@
#!/bin/sh
# Shell script to build GNU Make in the absence of any 'make' program.
# @configure_input@
# Copyright (C) 1993-2013 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
# See Makefile.in for comments describing these variables.
srcdir='@srcdir@'
CC='@CC@'
CFLAGS='@CFLAGS@'
CPPFLAGS='@CPPFLAGS@'
LDFLAGS='@LDFLAGS@'
ALLOCA='@ALLOCA@'
LOADLIBES='@LIBS@ @LIBINTL@'
eval extras=\'@LIBOBJS@\'
REMOTE='@REMOTE@'
GLOBLIB='@GLOBLIB@'
PATH_SEPARATOR='@PATH_SEPARATOR@'
OBJEXT='@OBJEXT@'
EXEEXT='@EXEEXT@'
# Common prefix for machine-independent installed files.
prefix='@prefix@'
# Common prefix for machine-dependent installed files.
exec_prefix=`eval echo @exec_prefix@`
# Directory to find libraries in for '-lXXX'.
libdir=${exec_prefix}/lib
# Directory to search by default for included makefiles.
includedir=${prefix}/include
localedir=${prefix}/share/locale
aliaspath=${localedir}${PATH_SEPARATOR}.
defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\""' @DEFS@'
# Exit as soon as any command fails.
set -e
# These are all the objects we need to link together.
objs="%objs% remote-${REMOTE}.${OBJEXT} ${extras} ${ALLOCA}"
if [ x"$GLOBLIB" != x ]; then
objs="$objs %globobjs%"
globinc=-I${srcdir}/glob
fi
# Compile the source files into those objects.
for file in `echo ${objs} | sed 's/\.'${OBJEXT}'/.c/g'`; do
echo compiling ${file}...
$CC $defines $CPPFLAGS $CFLAGS \
-c -I. -I${srcdir} ${globinc} ${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 $CFLAGS $LDFLAGS $objs $LOADLIBES -o makenew${EXEEXT}
echo done
mv -f makenew${EXEEXT} make${EXEEXT}

View File

@ -1,498 +1,321 @@
@echo off
:: Copyright (C) 1996-2024 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 3 of the License, 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 this program. If not, see <https://www.gnu.org/licenses/>.
setlocal
if not "%RECURSEME%"=="%~0" (
set "RECURSEME=%~0"
%ComSpec% /s /c ""%~0" %*"
goto :EOF
)
call :Reset
if "%1" == "-h" goto Usage
if "%1" == "--help" goto Usage
echo.
echo Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8/10/11
echo.
set MAKE=gnumake
set GUILE=Y
set COMPILER=cl.exe
set RC=rc.exe
set O=obj
set ARCH=x64
set DEBUG=N
set DIRENT=Y
set VERBOSE=N
if exist maintMakefile (
set MAINT=Y
) else (
set MAINT=N
)
:ParseSW
if "%1" == "--verbose" goto SetVerbose
if "%1" == "--debug" goto SetDebug
if "%1" == "--without-guile" goto NoGuile
if "%1" == "--x86" goto Set32Bit
if "%1" == "gcc" goto SetCC
if "%1" == "tcc" goto SetTCC
if "%1" == "" goto DoneSW
goto Usage
:SetVerbose
set VERBOSE=Y
shift
goto ParseSW
:SetDebug
set DEBUG=Y
echo - Building without compiler optimizations
shift
goto ParseSW
:NoGuile
set GUILE=N
echo - Building without Guile
shift
goto ParseSW
:Set32Bit
set ARCH=x86
echo - Building 32bit GNU Make
shift
goto ParseSW
:SetCC
set COMPILER=gcc
set RC=windres
set O=o
echo - Building with GCC
shift
goto ParseSW
:SetTCC
set COMPILER=tcc
set RC=windres
set O=o
echo - Building with TinyC
shift
goto ParseSW
:DoneSW
if "%MAINT%" == "Y" echo - Enabling maintainer mode
if "%COMPILER%" == "gcc" goto FindGcc
if "%COMPILER%" == "tcc" goto FindTcc
:: Find a compiler. Visual Studio requires a lot of effort to locate :-/.
call %COMPILER% >nul 2>&1
if not ERRORLEVEL 1 goto FoundMSVC
:: Visual Studio 15 2017 and above provides the "vswhere" tool
call :FindVswhere
if ERRORLEVEL 1 goto LegacyVS
for /f "tokens=* usebackq" %%i in (`"%VSWHERE%" -latest -property installationPath`) do (
set InstallPath=%%i
)
set "VSVARS=%InstallPath%\VC\Auxiliary\Build\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
:: No "vswhere" or it can't find a compiler. Go old-school.
:LegacyVS
set "VSVARS=%VS150COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS110COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS71COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%VS70COMNTOOLS%\..\..\VC\vcvarsall.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%V6TOOLS%\VC98\Bin\vcvars32.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%V6TOOLS%\VC97\Bin\vcvars32.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
set "VSVARS=%V5TOOLS%\VC\Bin\vcvars32.bat"
call :CheckMSVC
if not ERRORLEVEL 1 goto FoundMSVC
:: We did not find anything--fail
echo No MSVC compiler available.
echo Please run vcvarsall.bat and/or configure your Path.
exit 1
:FoundMSVC
set OUTDIR=.\WinRel
set LNKOUT=./WinRel
set "OPTS=/O2 /D NDEBUG"
set LINKOPTS=
if "%DEBUG%" == "Y" set OUTDIR=.\WinDebug
if "%DEBUG%" == "Y" set LNKOUT=./WinDebug
if "%DEBUG%" == "Y" set "OPTS=/Zi /Od /D _DEBUG"
if "%DEBUG%" == "Y" set LINKOPTS=/DEBUG
if "%MAINT%" == "Y" set "OPTS=%OPTS% /D MAKE_MAINTAINER_MODE"
:: Show the compiler version that we found
:: Unfortunately this also shows a "usage" note; I can't find anything better.
echo.
call %COMPILER%
goto FindRC
:FindGcc
set OUTDIR=.\GccRel
set LNKOUT=./GccRel
set OPTS=-O2
set DIRENT=N
if "%DEBUG%" == "Y" set OPTS=-O0
if "%DEBUG%" == "Y" set OUTDIR=.\GccDebug
if "%DEBUG%" == "Y" set LNKOUT=./GccDebug
if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"
:: Show the compiler version that we found
echo.
call %COMPILER% --version
if not ERRORLEVEL 1 goto FindRC
echo No %COMPILER% found.
exit 1
:FindTcc
set OUTDIR=.\TccRel
set LNKOUT=./TccRel
set OPTS=-O2
if "%DEBUG%" == "Y" set OPTS=-O0
if "%DEBUG%" == "Y" set OUTDIR=.\TccDebug
if "%DEBUG%" == "Y" set LNKOUT=./TccDebug
if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"
:: Show the compiler version that we found
echo.
call %COMPILER% -v
if not ERRORLEVEL 1 goto FindRC
echo No %COMPILER% found.
exit 1
:FindRC
set HAVE_RC=Y
call where %RC% >nul 2>&1
if not ERRORLEVEL 1 goto Build
echo.
echo %RC% was not found. Building without UTF-8 resource.
set HAVE_RC=N
:Build
echo.
:: Clean the directory if it exists
if exist %OUTDIR%\nul rmdir /S /Q %OUTDIR%
:: Recreate it
mkdir %OUTDIR%
mkdir %OUTDIR%\src
mkdir %OUTDIR%\src\w32
mkdir %OUTDIR%\src\w32\compat
mkdir %OUTDIR%\src\w32\subproc
mkdir %OUTDIR%\lib
if "%GUILE%" == "Y" call :ChkGuile
if not exist src\config.h.W32 goto NotConfig
echo.
echo Compiling %OUTDIR% version
copy src\config.h.W32 %OUTDIR%\src\config.h
copy lib\glob.in.h %OUTDIR%\lib\glob.h
copy lib\fnmatch.in.h %OUTDIR%\lib\fnmatch.h
if exist %OUTDIR%\link.sc del %OUTDIR%\link.sc
call :Compile src/ar
call :Compile src/arscan
call :Compile src/commands
call :Compile src/default
call :Compile src/dir
call :Compile src/expand
call :Compile src/file
call :Compile src/function
call :Compile src/getopt
call :Compile src/getopt1
call :Compile src/guile GUILE
call :Compile src/hash
call :Compile src/implicit
call :Compile src/job
call :Compile src/load
call :Compile src/loadapi
call :Compile src/main GUILE
call :Compile src/misc
call :Compile src/output
call :Compile src/read
call :Compile src/remake
call :Compile src/remote-stub
call :Compile src/rule
call :Compile src/shuffle
call :Compile src/signame
call :Compile src/strcache
call :Compile src/variable
call :Compile src/version
call :Compile src/vpath
call :Compile src/warning
call :Compile src/w32/pathstuff
call :Compile src/w32/w32os
call :Compile src/w32/compat/posixfcn
call :Compile src/w32/subproc/misc
call :Compile src/w32/subproc/sub_proc
call :Compile src/w32/subproc/w32err
call :Compile lib/fnmatch
call :Compile lib/glob
call :Compile lib/getloadavg
:: Compile dirent unless it is supported by compiler library (like with gcc).
if "%DIRENT%" == "Y" call :Compile src\w32\compat\dirent
:: Compile UTF-8 resource if a resource compiler is available.
if "%HAVE_RC%" == "Y" call :ResourceCompile src/w32/utf8
call :Link
echo.
if exist %OUTDIR%\%MAKE%.exe goto Success
echo %OUTDIR% build FAILED!
exit 1
:Success
echo %OUTDIR% build succeeded.
if exist Basic.mk copy /Y Basic.mk Makefile
if not exist tests\config-flags.pm copy /Y tests\config-flags.pm.W32 tests\config-flags.pm
call :Reset
goto :EOF
::
:: Subroutines
::
:Compile
if "%VERBOSE%" == "N" echo - Compiling %1.c
echo %LNKOUT%/%1.%O% >>%OUTDIR%\link.sc
set EXTRAS=
if "%2" == "GUILE" set "EXTRAS=%GUILECFLAGS%"
if exist "%OUTDIR%\%1.%O%" del "%OUTDIR%\%1.%O%"
if "%COMPILER%" == "gcc" goto GccCompile
if "%COMPILER%" == "tcc" goto TccCompile
:: MSVC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c
@echo off
goto CompileDone
:GccCompile
:: GCC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
goto CompileDone
:TccCompile
:: TCC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% -mthreads -Wall -std=c11 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -D_cdecl= -D_MSC_VER -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
goto CompileDone
:ResourceCompile
if "%VERBOSE%" == "N" echo - Compiling %1.rc
echo %LNKOUT%/%1.%O% >>%OUTDIR%\link.sc
if exist "%OUTDIR%\%1.%O%" del "%OUTDIR%\%1.%O%"
if "%COMPILER%" == "gcc" goto GccResourceCompile
if "%COMPILER%" == "tcc" goto TccResourceCompile
:: MSVC Resource Compile
if "%VERBOSE%" == "Y" echo on
call %RC% /fo %OUTDIR%\%1.%O% %1.rc
@echo off
goto CompileDone
:GccResourceCompile
:: GCC Resource Compile
if "%VERBOSE%" == "Y" echo on
call %RC% -o %OUTDIR%/%1.%O% -i %1.rc
@echo off
goto CompileDone
:TccResourceCompile
:: TCC Resource Compile
goto GccResourceCompile
:CompileDone
if not exist "%OUTDIR%\%1.%O%" exit 1
goto :EOF
:Link
echo.
echo - Linking %LNKOUT%/%MAKE%.exe
if "%COMPILER%" == "gcc" goto GccLink
if "%COMPILER%" == "tcc" goto TccLink
:: MSVC Link
echo %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib >>%OUTDIR%\link.sc
if "%VERBOSE%" == "Y" echo on
call link.exe /NOLOGO /SUBSYSTEM:console /PDB:%LNKOUT%\%MAKE%.pdb %LINKOPTS% /OUT:%LNKOUT%\%MAKE%.exe @%LNKOUT%\link.sc
@echo off
goto :EOF
:GccLink
:: GCC Link
if "%VERBOSE%" == "Y" echo on
echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc
call %COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/libgnumake-1.dll.a
@echo off
goto :EOF
:TccLink
:: TCC Link
if "%VERBOSE%" == "Y" echo on
echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc
call %COMPILER% -mthreads %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc
@echo off
goto :EOF
:ChkGuile
:: Build with Guile is supported only on NT and later versions
if not "%OS%" == "Windows_NT" goto NoGuile
call pkg-config --help > %OUTDIR%\guile.tmp 2> NUL
if ERRORLEVEL 1 goto NoPkgCfg
set PKGMSC=
if not "%COMPILER%" == "gcc" set PKGMSC=--msvc-syntax
echo Checking for Guile 2.0
call pkg-config --cflags --short-errors "guile-2.0" > %OUTDIR%\gl-c2.tmp 2> NUL
if not ERRORLEVEL 1 set /P GUILECFLAGS= < %OUTDIR%\gl-c2.tmp
call pkg-config --libs --static --short-errors %PKGMSC% "guile-2.0" > %OUTDIR%\gl-l2.tmp 2> NUL
if not ERRORLEVEL 1 set /P GUILELIBS= < %OUTDIR%\gl-l2.tmp
if not "%GUILECFLAGS%" == "" goto GuileDone
echo Checking for Guile 1.8
call pkg-config --cflags --short-errors "guile-1.8" > %OUTDIR%\gl-c18.tmp 2> NUL
if not ERRORLEVEL 1 set /P GUILECFLAGS= < %OUTDIR%\gl-c18.tmp
call pkg-config --libs --static --short-errors %PKGMSC% "guile-1.8" > %OUTDIR%\gl-l18.tmp 2> NUL
if not ERRORLEVEL 1 set /P GUILELIBS= < %OUTDIR%\gl-l18.tmp
if not "%GUILECFLAGS%" == "" goto GuileDone
echo - No Guile found, building without Guile
goto GuileDone
:NoPkgCfg
echo - pkg-config not found, building without Guile
:GuileDone
if "%GUILECFLAGS%" == "" goto :EOF
echo - Guile found: building with Guile
set "GUILECFLAGS=%GUILECFLAGS% -DHAVE_GUILE"
goto :EOF
:FindVswhere
set VSWHERE=vswhere
call "%VSWHERE%" -help >nul 2>&1
if not ERRORLEVEL 1 exit /b 0
set "VSWHERE=C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere"
call "%VSWHERE%" -help >nul 2>&1
if ERRORLEVEL 1 exit /b 1
goto :EOF
:CheckMSVC
if not exist "%VSVARS%" exit /b 1
call "%VSVARS%" %ARCH%
if ERRORLEVEL 1 exit /b 1
call %COMPILER% >nul 2>&1
if ERRORLEVEL 1 exit /b 1
goto :EOF
:NotConfig
echo.
echo *** This workspace is not configured.
echo Either retrieve the configured source in the release tarball
echo or, if building from Git, run the .\bootstrap.bat script first.
exit /b 1
:Usage
echo Usage: %0 [options] [gcc] OR [tcc]
echo Options:
echo. --without-guile Do not compile Guile support even if found
echo. --debug Make a Debug build--default is Release
echo. --x86 Make a 32bit binary--default is 64bit
echo. --help Display these instructions and exit
echo.
echo. "gcc" means compile with GCC, "tcc" means compile with Tiny C's TCC
goto :EOF
:Reset
set ARCH=
set COMPILER=
set DEBUG=
set GUILE=
rem Copyright (C) 1996-2013 Free Software Foundation, Inc.
rem This file is part of GNU Make.
rem
rem GNU Make is free software; you can redistribute it and/or modify it under
rem the terms of the GNU General Public License as published by the Free
rem Software Foundation; either version 3 of the License, or (at your option)
rem any later version.
rem
rem GNU Make is distributed in the hope that it will be useful, but WITHOUT
rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
rem more details.
rem
rem You should have received a copy of the GNU General Public License along
rem with this program. If not, see <http://www.gnu.org/licenses/>.
if "%1" == "-h" GoTo Usage
if "%1" == "--help" GoTo Usage
if not exist config.h.W32.template GoTo NotSCM
sed -n "s/^AC_INIT(\[GNU make\],\[\([^]]\+\)\].*/s,%%VERSION%%,\1,g/p" configure.ac > config.h.W32.sed
echo s,%%PACKAGE%%,make,g >> config.h.W32.sed
sed -f config.h.W32.sed config.h.W32.template > config.h.W32
echo static const char *const GUILE_module_defn = ^" \> gmk-default.h
sed -e "s/;.*//" -e "/^[ \t]*$/d" -e "s/\"/\\\\\"/g" -e "s/$/ \\/" gmk-default.scm >> gmk-default.h
echo ^";>> gmk-default.h
:NotSCM
copy config.h.W32 config.h
rem Guile configuration
set GUILECFLAGS=
set GUILELIBS=
set LINKOPTS=
set MAKE=
set GUILESRC=
set NOGUILE=
set O=
set OPTS=
set OUTDIR=
set LNKOUT=
set OPT=-O2
set COMPILER=
set PKGMSC=
set VSVARS=
goto :EOF
:ParseSW
if "%1" == "--debug" GoTo SetOpt
if "%1" == "--without-guile" GoTo NoGuile
if "%1" == "gcc" GoTo SetCC
if "%1" == "" GoTo ChkGuile
:SetOpt
set OPT=-O0
shift
GoTo ParseSW
:NoGuile
set NOGUILE=Y
echo "Building without Guile"
shift
GoTo ParseSW
:SetCC
set COMPILER=gcc
echo "Building with GCC"
shift
GoTo ParseSW
rem Build with Guile is supported only on NT and later versions
:ChkGuile
if "%NOGUILE%" == "Y" GoTo GuileDone
if not "%OS%" == "Windows_NT" GoTo NoGuile
pkg-config --help > guile.tmp 2> NUL
if ERRORLEVEL 1 GoTo NoPkgCfg
echo "Checking for Guile 2.0"
if not "%COMPILER%" == "gcc" set PKGMSC=--msvc-syntax
pkg-config --cflags --short-errors "guile-2.0" > guile.tmp
if not ERRORLEVEL 1 set /P GUILECFLAGS= < guile.tmp
pkg-config --libs --static --short-errors %PKGMSC% "guile-2.0" > guile.tmp
if not ERRORLEVEL 1 set /P GUILELIBS= < guile.tmp
if not "%GUILECFLAGS%" == "" GoTo GuileDone
echo "Checking for Guile 1.8"
pkg-config --cflags --short-errors "guile-1.8" > guile.tmp
if not ERRORLEVEL 1 set /P GUILECFLAGS= < guile.tmp
pkg-config --libs --static --short-errors %PKGMSC% "guile-1.8" > guile.tmp
if not ERRORLEVEL 1 set /P GUILELIBS= < guile.tmp
if not "%GUILECFLAGS%" == "" GoTo GuileDone
echo "No Guile found, building without Guile"
GoTo GuileDone
:NoPkgCfg
echo "pkg-config not found, building without Guile"
:GuileDone
if not "%GUILECFLAGS%" == "" echo "Guile found, building with Guile"
if not "%GUILECFLAGS%" == "" set GUILESRC=guile.c
if not "%GUILECFLAGS%" == "" set GUILECFLAGS=%GUILECFLAGS% -DHAVE_GUILE
if "%COMPILER%" == "gcc" if "%OPT%" == "-O0" echo "Building without compiler optimizations"
cd w32\subproc
echo.
echo "Creating the subproc library"
%ComSpec% /c build.bat
cd ..\..
if exist link.dbg del link.dbg
if exist link.rel del link.rel
echo.
echo "Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8"
if "%COMPILER%" == "gcc" GoTo GCCBuild
set make=gnumake
echo on
if not exist .\WinDebug\nul mkdir .\WinDebug
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D TIVOLI /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c variable.c
echo WinDebug\variable.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c rule.c
echo WinDebug\rule.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c remote-stub.c
echo WinDebug\remote-stub.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c commands.c
echo WinDebug\commands.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c file.c
echo WinDebug\file.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c getloadavg.c
echo WinDebug\getloadavg.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c default.c
echo WinDebug\default.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c signame.c
echo WinDebug\signame.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c expand.c
echo WinDebug\expand.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c dir.c
echo WinDebug\dir.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od %GUILECFLAGS% /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c main.c
echo WinDebug\main.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c getopt1.c
echo WinDebug\getopt1.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c job.c
echo WinDebug\job.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c output.c
echo WinDebug\output.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c read.c
echo WinDebug\read.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c version.c
echo WinDebug\version.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c getopt.c
echo WinDebug\getopt.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c arscan.c
echo WinDebug\arscan.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c hash.c
echo WinDebug\hash.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c strcache.c
echo WinDebug\strcache.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c remake.c
echo WinDebug\remake.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c misc.c
echo WinDebug\misc.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c ar.c
echo WinDebug\ar.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c function.c
echo WinDebug\function.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c vpath.c
echo WinDebug\vpath.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c implicit.c
echo WinDebug\implicit.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c loadapi.c
echo WinDebug\loadapi.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c load.c
echo WinDebug\load.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c .\w32\compat\dirent.c
echo WinDebug\dirent.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c .\w32\compat\posixfcn.c
echo WinDebug\posixfcn.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c .\glob\glob.c
echo WinDebug\glob.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c .\glob\fnmatch.c
echo WinDebug\fnmatch.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c .\w32\pathstuff.c
echo WinDebug\pathstuff.obj >>link.dbg
if "%GUILESRC%" == "" GoTo LinkDbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od %GUILECFLAGS%% /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c guile.c
echo WinDebug\guile.obj >>link.dbg
:LinkDbg
echo off
echo "Linking WinDebug/%make%.exe"
rem link.exe %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\windebug\subproc.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes /PDB:.\WinDebug/%make%.pdb /DEBUG /OUT:.\WinDebug/%make%.exe .\WinDebug/variable.obj .\WinDebug/rule.obj .\WinDebug/remote-stub.obj .\WinDebug/commands.obj .\WinDebug/file.obj .\WinDebug/getloadavg.obj .\WinDebug/default.obj .\WinDebug/signame.obj .\WinDebug/expand.obj .\WinDebug/dir.obj .\WinDebug/main.obj .\WinDebug/getopt1.obj .\WinDebug/job.obj .\WinDebug/output.obj .\WinDebug/read.obj .\WinDebug/version.obj .\WinDebug/getopt.obj .\WinDebug/arscan.obj .\WinDebug/remake.obj .\WinDebug/hash.obj .\WinDebug/strcache.obj .\WinDebug/misc.obj .\WinDebug/ar.obj .\WinDebug/function.obj .\WinDebug/vpath.obj .\WinDebug/implicit.obj .\WinDebug/dirent.obj .\WinDebug/glob.obj .\WinDebug/fnmatch.obj .\WinDebug/pathstuff.obj
echo %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\windebug\subproc.lib >>link.dbg
link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes /PDB:.\WinDebug/%make%.pdb /DEBUG /OUT:.\WinDebug/%make%.exe @link.dbg
if not exist .\WinDebug/%make%.exe echo "WinDebug build failed"
if exist .\WinDebug/%make%.exe echo "WinDebug build succeeded!"
if not exist .\WinRel\nul mkdir .\WinRel
echo on
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /D TIVOLI /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c variable.c
echo WinRel\variable.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c rule.c
echo WinRel\rule.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c remote-stub.c
echo WinRel\remote-stub.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c commands.c
echo WinRel\commands.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c file.c
echo WinRel\file.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c getloadavg.c
echo WinRel\getloadavg.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c default.c
echo WinRel\default.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c signame.c
echo WinRel\signame.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c expand.c
echo WinRel\expand.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c dir.c
echo WinRel\dir.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 %GUILECFLAGS% /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c main.c
echo WinRel\main.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c getopt1.c
echo WinRel\getopt1.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c job.c
echo WinRel\job.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c output.c
echo WinRel\output.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c read.c
echo WinRel\read.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c version.c
echo WinRel\version.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c getopt.c
echo WinRel\getopt.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c arscan.c
echo WinRel\arscan.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c remake.c
echo WinRel\remake.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c hash.c
echo WinRel\hash.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c strcache.c
echo WinRel\strcache.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c misc.c
echo WinRel\misc.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c ar.c
echo WinRel\ar.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c function.c
echo WinRel\function.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c vpath.c
echo WinRel\vpath.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c implicit.c
echo WinRel\implicit.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c loadapi.c
echo WinRel\loadapi.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c load.c
echo WinRel\load.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c .\w32\compat\dirent.c
echo WinRel\dirent.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c .\w32\compat\posixfcn.c
echo WinRel\posixfcn.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c .\glob\glob.c
echo WinRel\glob.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c .\glob\fnmatch.c
echo WinRel\fnmatch.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c .\w32\pathstuff.c
echo WinRel\pathstuff.obj >>link.rel
if "%GUILESRC%" == "" GoTo LinkRel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c guile.c
echo WinRel\guile.obj >>link.rel
:LinkRel
echo off
echo "Linking WinRel/%make%.exe"
rem link.exe %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\winrel\subproc.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /PDB:.\WinRel/%make%.pdb /OUT:.\WinRel/%make%.exe .\WinRel/variable.obj .\WinRel/rule.obj .\WinRel/remote-stub.obj .\WinRel/commands.obj .\WinRel/file.obj .\WinRel/getloadavg.obj .\WinRel/default.obj .\WinRel/signame.obj .\WinRel/expand.obj .\WinRel/dir.obj .\WinRel/main.obj .\WinRel/getopt1.obj .\WinRel/job.obj .\WinRel/output.obj .\WinRel/read.obj .\WinRel/version.obj .\WinRel/getopt.obj .\WinRel/arscan.obj .\WinRel/remake.obj .\WinRel/misc.obj .\WinRel/hash.obj .\WinRel/strcache.obj .\WinRel/ar.obj .\WinRel/function.obj .\WinRel/vpath.obj .\WinRel/implicit.obj .\WinRel/dirent.obj .\WinRel/glob.obj .\WinRel/fnmatch.obj .\WinRel/pathstuff.obj
echo %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\winrel\subproc.lib >>link.rel
link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /PDB:.\WinRel/%make%.pdb /OUT:.\WinRel/%make%.exe @link.rel
if not exist .\WinRel/%make%.exe echo "WinRel build failed"
if exist .\WinRel/%make%.exe echo "WinRel build succeeded!"
set make=
GoTo BuildEnd
:GCCBuild
echo on
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c variable.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c rule.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c remote-stub.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c commands.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c file.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c getloadavg.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c default.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c signame.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c expand.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c dir.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H %GUILECFLAGS% -c main.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c getopt1.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c job.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c output.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c read.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c version.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c getopt.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c arscan.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c remake.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c hash.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c strcache.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c misc.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ar.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c function.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c vpath.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c implicit.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c loadapi.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c load.c
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./glob/glob.c -o glob.o
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./glob/fnmatch.c -o fnmatch.o
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./w32/pathstuff.c -o pathstuff.o
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./w32/compat/posixfcn.c -o posixfcn.o
@echo off
set GUILEOBJ=
if "%GUILESRC%" == "" GoTo LinkGCC
set GUILEOBJ=guile.o
echo on
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% %GUILECFLAGS% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c guile.c
:LinkGCC
@echo off
Rem The version NN of libgnumake-NN.dll.a should be bumped whenever
Rem the API changes in binary-incompatible manner.
@echo on
gcc -mthreads -gdwarf-2 -g3 -o gnumake.exe variable.o rule.o remote-stub.o commands.o file.o getloadavg.o default.o signame.o expand.o dir.o main.o getopt1.o %GUILEOBJ% job.o output.o read.o version.o getopt.o arscan.o remake.o misc.o hash.o strcache.o ar.o function.o vpath.o implicit.o loadapi.o load.o glob.o fnmatch.o pathstuff.o posixfcn.o w32_misc.o sub_proc.o w32err.o %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -Wl,--out-implib=libgnumake-1.dll.a
@GoTo BuildEnd
:Usage
echo Usage: %0 [options] [gcc]
echo Options:
echo. --debug For GCC only, make a debug build
echo. (MSVC build always makes both debug and release)
echo. --without-guile Do not compile Guile support even if found
echo. --help Display these instructions and exit
:BuildEnd
@echo off
set GUILEOBJ=
set GUILESRC=
set GUILELIBS=
set GUILECFLAGS=
set PKGMSC=
set OPT=
set COMPILER=
set NOGUILE=
echo on

View File

@ -1,98 +0,0 @@
@echo off
rem Copyright (C) 1998-2024 Free Software Foundation, Inc.
rem This file is part of GNU Make.
rem
rem GNU Make is free software; you can redistribute it and/or modify it under
rem the terms of the GNU General Public License as published by the Free
rem Software Foundation; either version 3 of the License, or (at your option)
rem any later version.
rem
rem GNU Make is distributed in the hope that it will be useful, but WITHOUT
rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
rem more details.
rem
rem You should have received a copy of the GNU General Public License along
rem with this program. If not, see <https://www.gnu.org/licenses/>.
echo Building Make for MSDOS with DJGPP
rem The SmallEnv trick protects against too small environment block,
rem in which case the values will be truncated and the whole thing
rem goes awry. COMMAND.COM will say "Out of environment space", but
rem many people don't care, so we force them to care by refusing to go.
rem Where is the srcdir?
set XSRC=.
if not "%XSRC%"=="." goto SmallEnv
if "%1%"=="" goto SrcDone
if "%1%"=="." goto SrcDone
set XSRC=%1
if not "%XSRC%"=="%1" goto SmallEnv
:SrcDone
if not exist src mkdir src
if not exist lib mkdir lib
copy /Y %XSRC%\src\configh.dos .\src\config.h
copy /Y %XSRC%\lib\glob.in.h .\lib\glob.h
copy /Y %XSRC%\lib\fnmatch.in.h .\lib\fnmatch.h
rem Echo ON so they will see what is going on.
@echo on
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/commands.c -o commands.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/output.c -o output.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/job.c -o job.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/dir.c -o dir.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/file.c -o file.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/misc.c -o misc.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DLOCALEDIR=\"/dev/env/DJDIR/share/locale\" -O2 -g %XSRC%/src/main.c -o main.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DINCLUDEDIR=\"/dev/env/DJDIR/include\" -O2 -g %XSRC%/src/read.c -o read.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DLIBDIR=\"/dev/env/DJDIR/lib\" -O2 -g %XSRC%/src/remake.c -o remake.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/rule.c -o rule.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/implicit.c -o implicit.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/default.c -o default.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/variable.c -o variable.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/warning.c -o warning.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/expand.c -o expand.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/function.c -o function.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/vpath.c -o vpath.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/hash.c -o hash.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/strcache.c -o strcache.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/version.c -o version.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/ar.c -o ar.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/arscan.c -o arscan.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/signame.c -o signame.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/remote-stub.c -o remote-stub.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt.c -o getopt.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt1.c -o getopt1.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/shuffle.c -o shuffle.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/load.c -o load.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/lib/glob.c -o lib/glob.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/lib/fnmatch.c -o lib/fnmatch.o
@echo off
echo commands.o > respf.$$$
for %%f in (job output dir file misc main read remake rule implicit default variable warning load) do echo %%f.o >> respf.$$$
for %%f in (expand function vpath hash strcache version ar arscan signame remote-stub getopt getopt1 shuffle) do echo %%f.o >> respf.$$$
for %%f in (lib\glob lib\fnmatch) do echo %%f.o >> respf.$$$
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/guile.c -o guile.o
echo guile.o >> respf.$$$
@echo Linking...
@echo on
gcc -o make.exe @respf.$$$
@echo off
if not exist make.exe echo Make.exe build failed...
if exist make.exe echo make.exe is now built!
if exist make.exe del respf.$$$
if exist make.exe copy /Y %XSRC%\Basic.mk Makefile
goto End
:SmallEnv
echo Your environment is too small. Please enlarge it and run me again.
:End
set XRSC=
@echo on

View File

@ -1,5 +1,5 @@
/* Command processing for GNU Make.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2013 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
@ -12,25 +12,32 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include <dlfcn.h>
#include "makeint.h"
#include "filedef.h"
#include "os.h"
#include "dep.h"
#include "filedef.h"
#include "variable.h"
#include "job.h"
#include "commands.h"
#if MK_OS_W32
#ifdef WINDOWS32
#include <windows.h>
#include "w32err.h"
#endif
#if MK_OS_VMS
# define FILE_LIST_SEPARATOR (vms_comma_separator ? ',' : ' ')
#if VMS
# define FILE_LIST_SEPARATOR ','
#else
# define FILE_LIST_SEPARATOR ' '
#endif
int remote_kill (int id, int sig);
#ifndef HAVE_UNISTD_H
int getpid ();
#endif
static unsigned long
@ -55,13 +62,10 @@ dep_hash_cmp (const void *x, const void *y)
return strcmp (dep_name (dx), dep_name (dy));
}
/* Set FILE's automatic variables up.
* Use STEM to set $*.
* If STEM is 0, then set FILE->STEM and $* to the target name with any
* suffix in the .SUFFIXES list stripped off. */
/* Set FILE's automatic variables up. */
void
set_file_variables (struct file *file, const char *stem)
set_file_variables (struct file *file)
{
struct dep *d;
const char *at, *percent, *star, *less;
@ -72,7 +76,7 @@ set_file_variables (struct file *file, const char *stem)
if (ar_name (file->name))
{
size_t len;
unsigned int len;
const char *cp;
char *p;
@ -95,13 +99,13 @@ set_file_variables (struct file *file, const char *stem)
}
/* $* is the stem from an implicit or static pattern rule. */
if (stem == 0)
if (file->stem == 0)
{
/* In Unix make, $* is set to the target name with
any suffix in the .SUFFIXES list stripped off for
explicit rules. We store this in the 'stem' member. */
const char *name;
size_t len;
unsigned int len;
#ifndef NO_ARCHIVES
if (ar_name (file->name))
@ -118,29 +122,29 @@ set_file_variables (struct file *file, const char *stem)
for (d = enter_file (strcache_add (".SUFFIXES"))->deps; d ; d = d->next)
{
const char *dn = dep_name (d);
size_t slen = strlen (dn);
if (len > slen && memcmp (dn, name + (len - slen), slen) == 0)
unsigned int slen = strlen (dep_name (d));
if (len > slen && strneq (dep_name (d), name + (len - slen), slen))
{
file->stem = stem = strcache_add_len (name, len - slen);
file->stem = strcache_add_len (name, len - slen);
break;
}
}
if (d == 0)
file->stem = stem = "";
file->stem = "";
}
star = stem;
star = file->stem;
/* $< is the first not order-only dependency. */
less = "";
for (d = file->deps; d != 0; d = d->next)
if (!d->ignore_mtime && !d->ignore_automatic_vars && !d->need_2nd_expansion)
if (!d->ignore_mtime)
{
less = dep_name (d);
if (!d->need_2nd_expansion)
less = dep_name (d);
break;
}
if (file->cmds != 0 && file->cmds == default_file->cmds)
if (file->cmds == default_file->cmds)
/* This file got its commands from .DEFAULT.
In this case $< is the same as $@. */
less = at;
@ -159,14 +163,14 @@ set_file_variables (struct file *file, const char *stem)
{
static char *plus_value=0, *bar_value=0, *qmark_value=0;
static size_t plus_max=0, bar_max=0, qmark_max=0;
static unsigned int plus_max=0, bar_max=0, qmark_max=0;
size_t qmark_len, plus_len, bar_len;
unsigned int qmark_len, plus_len, bar_len;
char *cp;
char *caret_value;
char *qp;
char *bp;
size_t len;
unsigned int len;
struct hash_table dep_hash;
void **slot;
@ -178,7 +182,7 @@ set_file_variables (struct file *file, const char *stem)
bar_len = 0;
for (d = file->deps; d != 0; d = d->next)
{
if (!d->need_2nd_expansion && !d->ignore_automatic_vars)
if (!d->need_2nd_expansion)
{
if (d->ignore_mtime)
bar_len += strlen (dep_name (d)) + 1;
@ -200,7 +204,7 @@ set_file_variables (struct file *file, const char *stem)
qmark_len = plus_len + 1; /* Will be this or less. */
for (d = file->deps; d != 0; d = d->next)
if (! d->ignore_mtime && ! d->need_2nd_expansion && ! d->ignore_automatic_vars)
if (! d->ignore_mtime && ! d->need_2nd_expansion)
{
const char *c = dep_name (d);
@ -214,7 +218,8 @@ set_file_variables (struct file *file, const char *stem)
#endif
len = strlen (c);
cp = mempcpy (cp, c, len);
memcpy (cp, c, len);
cp += len;
*cp++ = FILE_LIST_SEPARATOR;
if (! (d->changed || always_make_flag))
qmark_len -= len + 1; /* Don't space in $? for this one. */
@ -246,7 +251,7 @@ set_file_variables (struct file *file, const char *stem)
for (d = file->deps; d != 0; d = d->next)
{
if (d->need_2nd_expansion || d->ignore_automatic_vars)
if (d->need_2nd_expansion)
continue;
slot = hash_find_slot (&dep_hash, d);
@ -268,7 +273,7 @@ set_file_variables (struct file *file, const char *stem)
{
const char *c;
if (d->need_2nd_expansion || d->ignore_automatic_vars || hash_find_item (&dep_hash, d) != d)
if (d->need_2nd_expansion || hash_find_item (&dep_hash, d) != d)
continue;
c = dep_name (d);
@ -284,16 +289,19 @@ set_file_variables (struct file *file, const char *stem)
if (d->ignore_mtime)
{
bp = mempcpy (bp, c, len);
memcpy (bp, c, len);
bp += len;
*bp++ = FILE_LIST_SEPARATOR;
}
else
{
cp = mempcpy (cp, c, len);
memcpy (cp, c, len);
cp += len;
*cp++ = FILE_LIST_SEPARATOR;
if (d->changed || always_make_flag)
{
qp = mempcpy (qp, c, len);
memcpy (qp, c, len);
qp += len;
*qp++ = FILE_LIST_SEPARATOR;
}
}
@ -313,7 +321,7 @@ set_file_variables (struct file *file, const char *stem)
DEFINE_VARIABLE ("|", 1, bar_value);
}
#undef DEFINE_VARIABLE
#undef DEFINE_VARIABLE
}
/* Chop CMDS up into individual command lines if necessary.
@ -322,19 +330,20 @@ set_file_variables (struct file *file, const char *stem)
void
chop_commands (struct commands *cmds)
{
unsigned short nlines;
unsigned short i;
unsigned int nlines, idx;
char **lines;
/* If we don't have any commands, or we already parsed them, never mind. */
if (!cmds || cmds->command_lines != NULL)
/* If we don't have any commands,
or we already parsed them, never mind. */
if (!cmds || cmds->command_lines != 0)
return;
/* Chop CMDS->commands up into lines in CMDS->command_lines. */
if (one_shell)
{
size_t l = strlen (cmds->commands);
int l = strlen (cmds->commands);
nlines = 1;
lines = xmalloc (nlines * sizeof (char *));
@ -346,27 +355,25 @@ chop_commands (struct commands *cmds)
}
else
{
const char *p = cmds->commands;
size_t max = 5;
const char *p;
nlines = 0;
lines = xmalloc (max * sizeof (char *));
nlines = 5;
lines = xmalloc (nlines * sizeof (char *));
idx = 0;
p = cmds->commands;
while (*p != '\0')
{
const char *end = p;
find_end:;
end = strchr (end, '\n');
if (end == NULL)
if (end == 0)
end = p + strlen (p);
else if (end > p && end[-1] == '\\')
{
int backslash = 1;
if (end > p + 1)
{
const char *b;
for (b = end - 2; b >= p && *b == '\\'; --b)
backslash = !backslash;
}
const char *b;
for (b = end - 2; b >= p && *b == '\\'; --b)
backslash = !backslash;
if (backslash)
{
++end;
@ -374,38 +381,42 @@ chop_commands (struct commands *cmds)
}
}
if (nlines == USHRT_MAX)
ON (fatal, &cmds->fileinfo,
_("recipe has too many lines (limit %hu)"), nlines);
if (nlines == max)
if (idx == nlines)
{
max += 2;
lines = xrealloc (lines, max * sizeof (char *));
nlines += 2;
lines = xrealloc (lines, nlines * sizeof (char *));
}
lines[nlines++] = xstrndup (p, (size_t) (end - p));
lines[idx++] = xstrndup (p, end - p);
p = end;
if (*p != '\0')
++p;
}
if (idx != nlines)
{
nlines = idx;
lines = xrealloc (lines, nlines * sizeof (char *));
}
}
/* Finally, set the corresponding CMDS->lines_flags elements and the
CMDS->any_recurse flag. */
if (nlines > USHRT_MAX)
fatal (&cmds->fileinfo, _("Recipe has too many lines (%ud)"), nlines);
cmds->ncommand_lines = nlines;
cmds->command_lines = lines;
cmds->any_recurse = 0;
cmds->lines_flags = xmalloc (nlines);
for (i = 0; i < nlines; ++i)
for (idx = 0; idx < nlines; ++idx)
{
unsigned char flags = 0;
const char *p = lines[i];
int flags = 0;
const char *p = lines[idx];
while (ISBLANK (*p) || *p == '-' || *p == '@' || *p == '+')
while (isblank (*p) || *p == '-' || *p == '@' || *p == '+')
switch (*(p++))
{
case '+':
@ -420,12 +431,12 @@ chop_commands (struct commands *cmds)
}
/* If no explicit '+' was given, look for MAKE variable references. */
if (! ANY_SET (flags, COMMANDS_RECURSE)
if (!(flags & COMMANDS_RECURSE)
&& (strstr (p, "$(MAKE)") != 0 || strstr (p, "${MAKE}") != 0))
flags |= COMMANDS_RECURSE;
cmds->lines_flags[i] = flags;
cmds->any_recurse |= ANY_SET (flags, COMMANDS_RECURSE) ? 1 : 0;
cmds->lines_flags[idx] = flags;
cmds->any_recurse |= flags & COMMANDS_RECURSE ? 1 : 0;
}
}
@ -442,7 +453,7 @@ execute_file_commands (struct file *file)
the commands are nothing but whitespace. */
for (p = file->cmds->commands; *p != '\0'; ++p)
if (!ISSPACE (*p) && *p != '-' && *p != '@' && *p != '+')
if (!isspace ((unsigned char)*p) && *p != '-' && *p != '@')
break;
if (*p == '\0')
{
@ -457,17 +468,12 @@ execute_file_commands (struct file *file)
initialize_file_variables (file, 0);
set_file_variables (file, file->stem);
set_file_variables (file);
/* Some systems don't support overwriting a loaded object so if this one
unload it before remaking. Keep its name in .LOADED: it will be rebuilt
and loaded again. If rebuilding or loading again fail, then we'll exit
anyway and it won't matter. */
if (file->loaded && unload_file (file->name) == 0)
{
file->loaded = 0;
file->unloaded = 1;
}
/* If this is a loaded dynamic object, unload it before remaking.
Some systems don't support overwriting a loaded object. */
if (file->loaded)
unload_file (file->name);
/* Start the commands running. */
new_job (file);
@ -476,14 +482,14 @@ execute_file_commands (struct file *file)
/* This is set while we are inside fatal_error_signal,
so things can avoid nonreentrant operations. */
volatile sig_atomic_t handling_fatal_signal = 0;
int handling_fatal_signal = 0;
/* Handle fatal signals. */
void
RETSIGTYPE
fatal_error_signal (int sig)
{
#if MK_OS_DOS
#ifdef __MSDOS__
extern int dos_status, dos_command_running;
if (dos_command_running)
@ -494,11 +500,18 @@ fatal_error_signal (int sig)
}
remove_intermediates (1);
exit (EXIT_FAILURE);
#else /* not MK_OS_DOS */
#if MK_OS_W32
#else /* not __MSDOS__ */
#ifdef _AMIGA
remove_intermediates (1);
if (sig == SIGINT)
fputs (_("*** Break.\n"), stderr);
exit (10);
#else /* not Amiga */
#ifdef WINDOWS32
extern HANDLE main_thread;
/* Windows creates a separate thread for handling Ctrl+C, so we need
/* Windows creates a sperate thread for handling Ctrl+C, so we need
to suspend the main thread, or else we will have race conditions
when both threads call reap_children. */
if (main_thread)
@ -506,12 +519,12 @@ fatal_error_signal (int sig)
DWORD susp_count = SuspendThread (main_thread);
if (susp_count != 0)
fprintf (stderr, "SuspendThread: suspend count = %lu\n", susp_count);
fprintf (stderr, "SuspendThread: suspend count = %ld\n", susp_count);
else if (susp_count == (DWORD)-1)
{
DWORD ierr = GetLastError ();
fprintf (stderr, "SuspendThread: error %lu: %s\n",
fprintf (stderr, "SuspendThread: error %ld: %s\n",
ierr, map_windows32_error_to_string (ierr));
}
}
@ -522,10 +535,6 @@ fatal_error_signal (int sig)
It is blocked now while we run this handler. */
signal (sig, SIG_DFL);
temp_stdin_unlink ();
osync_clear ();
jobserver_clear ();
/* A termination signal won't be sent to the entire
process group, but it means we want to kill the children. */
@ -533,7 +542,7 @@ fatal_error_signal (int sig)
{
struct child *c;
for (c = children; c != 0; c = c->next)
if (!c->remote && c->pid > 0)
if (!c->remote)
(void) kill (c->pid, SIGTERM);
}
@ -554,7 +563,7 @@ fatal_error_signal (int sig)
/* Remote children won't automatically get signals sent
to the process group, so we must send them. */
for (c = children; c != 0; c = c->next)
if (c->remote && c->pid > 0)
if (c->remote)
(void) remote_kill (c->pid, sig);
for (c = children; c != 0; c = c->next)
@ -578,10 +587,10 @@ fatal_error_signal (int sig)
if (sig == SIGQUIT)
/* We don't want to send ourselves SIGQUIT, because it will
cause a core dump. Just exit instead. */
exit (MAKE_TROUBLE);
exit (EXIT_FAILURE);
#endif
#if MK_OS_W32
#ifdef WINDOWS32
if (main_thread)
CloseHandle (main_thread);
/* Cannot call W32_kill with a pid (it needs a handle). The exit
@ -590,10 +599,11 @@ fatal_error_signal (int sig)
#else
/* Signal the same code; this time it will really be fatal. The signal
will be unblocked when we return and arrive then to kill us. */
if (kill (make_pid (), sig) < 0)
if (kill (getpid (), sig) < 0)
pfatal_with_name ("kill");
#endif /* not MK_OS_W32 */
#endif /* not MK_OS_DOS */
#endif /* not WINDOWS32 */
#endif /* not Amiga */
#endif /* not __MSDOS__ */
}
/* Delete FILE unless it's precious or not actually a file (phony),
@ -617,13 +627,11 @@ delete_target (struct file *file, const char *on_behalf_of)
if (ar_member_date (file->name) != file_date)
{
if (on_behalf_of)
OSS (error, NILF,
_("*** [%s] archive member '%s' may be bogus; not deleted"),
on_behalf_of, file->name);
error (NILF, _("*** [%s] Archive member '%s' may be bogus; not deleted"),
on_behalf_of, file->name);
else
OS (error, NILF,
_("*** archive member '%s' may be bogus; not deleted"),
file->name);
error (NILF, _("*** Archive member '%s' may be bogus; not deleted"),
file->name);
}
return;
}
@ -635,10 +643,9 @@ delete_target (struct file *file, const char *on_behalf_of)
&& FILE_TIMESTAMP_STAT_MODTIME (file->name, st) != file->last_mtime)
{
if (on_behalf_of)
OSS (error, NILF,
_("*** [%s] deleting file '%s'"), on_behalf_of, file->name);
error (NILF, _("*** [%s] Deleting file '%s'"), on_behalf_of, file->name);
else
OS (error, NILF, _("*** deleting file '%s'"), file->name);
error (NILF, _("*** Deleting file '%s'"), file->name);
if (unlink (file->name) < 0
&& errno != ENOENT) /* It disappeared; so what. */
perror_with_name ("unlink: ", file->name);
@ -654,7 +661,7 @@ delete_child_targets (struct child *child)
{
struct dep *d;
if (child->deleted || child->pid < 0)
if (child->deleted)
return;
/* Delete the target file if it changed. */

View File

@ -1,5 +1,5 @@
/* Definition of data structures describing shell commands for GNU Make.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2013 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
@ -12,17 +12,17 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
/* Structure that gives the commands to make a file
and information about where these commands came from. */
struct commands
{
floc fileinfo; /* Where commands were defined. */
gmk_floc fileinfo; /* Where commands were defined. */
char *commands; /* Commands text. */
char **command_lines; /* Commands chopped up into lines. */
unsigned char *lines_flags; /* One set of flag bits for each line. */
char *lines_flags; /* One set of flag bits for each line. */
unsigned short ncommand_lines;/* Number of command lines. */
char recipe_prefix; /* Recipe prefix for this command set. */
unsigned int any_recurse:1; /* Nonzero if any 'lines_flags' elt has */
@ -34,12 +34,8 @@ struct commands
#define COMMANDS_SILENT 2 /* Silent: @. */
#define COMMANDS_NOERROR 4 /* No errors: -. */
struct file;
struct child;
void fatal_error_signal (int sig);
void execute_file_commands (struct file *file);
void print_commands (const struct commands *cmds);
void delete_child_targets (struct child *child);
void chop_commands (struct commands *cmds);
void set_file_variables (struct file *file, const char *stem);
void set_file_variables (struct file *file);

328
config.ami.template Normal file
View File

@ -0,0 +1,328 @@
/* config.h -- hand-massaged for Amiga -*-C-*-
Copyright (C) 1995-2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* #undef _ALL_SOURCE */
#endif
/* Define if using alloca.c. */
#define C_ALLOCA
/* Define if the closedir function returns void instead of int. */
/* #undef CLOSEDIR_VOID */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
/* #undef CRAY_STACKSEG_END */
/* Define for DGUX with <sys/dg_sys_info.h>. */
/* #undef DGUX */
/* Define if the 'getloadavg' function needs to be run setuid or setgid. */
/* #undef GETLOADAVG_PRIVILEGED */
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long
/* Define to 'int' if <sys/types.h> doesn't define. */
#define gid_t int
/* Define if you have alloca, as a function or macro. */
/* #undef HAVE_ALLOCA */
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
/* #undef HAVE_ALLOCA_H */
/* Define if your system has a working fnmatch function. */
/* #undef HAVE_FNMATCH */
/* Define if your system has its own 'getloadavg' function. */
/* #undef HAVE_GETLOADAVG */
/* Define if you have the getmntent function. */
/* #undef HAVE_GETMNTENT */
/* Embed GNU Guile support */
/* #undef HAVE_GUILE */
/* Define if the 'long double' type works. */
/* #undef HAVE_LONG_DOUBLE */
/* Define if you support file names longer than 14 characters. */
#define HAVE_LONG_FILE_NAMES 1
/* Define if you have a working 'mmap' system call. */
/* #undef HAVE_MMAP */
/* Define if system calls automatically restart after interruption
by a signal. */
/* #undef HAVE_RESTARTABLE_SYSCALLS */
/* Define if your struct stat has st_blksize. */
/* #undef HAVE_ST_BLKSIZE */
/* Define if your struct stat has st_blocks. */
/* #undef HAVE_ST_BLOCKS */
/* Define if you have the strcoll function and it is properly defined. */
#define HAVE_STRCOLL 1
/* Define if your struct stat has st_rdev. */
#define HAVE_ST_RDEV 1
/* Define if you have the strftime function. */
#define HAVE_STRFTIME 1
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
/* #undef HAVE_SYS_WAIT_H */
/* Define if your struct tm has tm_zone. */
/* #undef HAVE_TM_ZONE */
/* Define if you don't have tm_zone but do have the external array
tzname. */
#define HAVE_TZNAME 1
/* Define if you have <unistd.h>. */
#define HAVE_UNISTD_H 1
/* Define if utime(file, NULL) sets file's timestamp to the present. */
/* #undef HAVE_UTIME_NULL */
/* Define if you have the wait3 system call. */
/* #undef HAVE_WAIT3 */
/* Define if on MINIX. */
/* #undef _MINIX */
/* Define if your struct nlist has an n_un member. */
/* #undef NLIST_NAME_UNION */
/* Define if you have <nlist.h>. */
/* #undef NLIST_STRUCT */
/* Define if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Define to 'int' if <sys/types.h> doesn't define. */
#define pid_t int
/* Define if the system does not provide POSIX.1 features except
with this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define if you need to in order for stat and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V
before release 3. */
/* #undef SETVBUF_REVERSED */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#define STACK_DIRECTION -1
/* Define if the 'S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS
/* Define on System V Release 4. */
/* #undef SVR4 */
/* Define if 'sys_siglist' is declared by <signal.h>. */
/* #undef SYS_SIGLIST_DECLARED */
/* Define to 'int' if <sys/types.h> doesn't define. */
#define uid_t int
/* Define for Encore UMAX. */
/* #undef UMAX */
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"
/* Version of this package (needed by automake) */
#define VERSION "%VERSION%"
/* Define to the name of the SCCS 'get' command. */
#define SCCS_GET "get"
/* Define this if the SCCS 'get' command understands the '-G<file>' option. */
/* #undef SCCS_GET_MINUS_G */
/* Define this to enable job server support in GNU make. */
/* #undef MAKE_JOBSERVER */
/* Define to be the nanoseconds member of struct stat's st_mtim,
if it exists. */
/* #undef ST_MTIM_NSEC */
/* Define this if the C library defines the variable 'sys_siglist'. */
/* #undef HAVE_SYS_SIGLIST */
/* 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 if you have the dup2 function. */
/* #undef HAVE_DUP2 */
/* Define if you have the getcwd function. */
#define HAVE_GETCWD 1
/* Define if you have the getgroups function. */
/* #undef HAVE_GETGROUPS */
/* Define if you have the gethostbyname function. */
/* #undef HAVE_GETHOSTBYNAME */
/* Define if you have the gethostname function. */
/* #undef HAVE_GETHOSTNAME */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the mktemp function. */
#define HAVE_MKTEMP 1
/* Define if you have the psignal function. */
/* #undef HAVE_PSIGNAL */
/* Define if you have the pstat_getdynamic function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define if you have the setegid function. */
/* #undef HAVE_SETEGID */
/* Define if you have the seteuid function. */
/* #undef HAVE_SETEUID */
/* Define if you have the setlinebuf function. */
/* #undef HAVE_SETLINEBUF */
/* Define if you have the setregid function. */
/* #undef HAVE_SETREGID */
/* Define if you have the setreuid function. */
/* #undef HAVE_SETREUID */
/* Define if you have the sigsetmask function. */
/* #undef HAVE_SIGSETMASK */
/* Define if you have the socket function. */
/* #undef HAVE_SOCKET */
/* Define to 1 if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP */
/* Define to 1 if you have the strcmpi function. */
/* #undef HAVE_STRCMPI */
/* Define to 1 if you have the stricmp function. */
/* #undef HAVE_STRICMP */
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strsignal function. */
/* #undef HAVE_STRSIGNAL */
/* Define if you have the wait3 function. */
/* #undef HAVE_WAIT3 */
/* Define if you have the waitpid function. */
/* #undef HAVE_WAITPID */
/* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <mach/mach.h> header file. */
/* #undef HAVE_MACH_MACH_H */
/* Define if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
/* Define if you have the <stdlib.h> header file. */
/* #undef HAVE_STDLIB_H */
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the <sys/dir.h> header file. */
#define HAVE_SYS_DIR_H 1
/* Define if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H */
/* Define if you have the <sys/timeb.h> header file. */
/* #undef HAVE_SYS_TIMEB_H */
/* Define if you have the <sys/wait.h> header file. */
/* #undef HAVE_SYS_WAIT_H */
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the dgc library (-ldgc). */
/* #undef HAVE_LIBDGC */
/* Define if you have the kstat library (-lkstat). */
/* #undef HAVE_LIBKSTAT */
/* Define if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */
/* Define for Case Insensitve behavior */
#define HAVE_CASE_INSENSITIVE_FS
/* Build host information. */
#define MAKE_HOST "Amiga"

View File

@ -1,6 +1,6 @@
/* config.h-vms. Generated by hand by Klaus Kämpf <kkaempf@rmi.de> -*-C-*-
Copyright (C) 1996-2024 Free Software Foundation, Inc.
Copyright (C) 1996-2013 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
@ -13,17 +13,10 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_OS_VMS 1
/* Pull in types.h here to get __CRTL_VER defined for old versions of the
compiler which don't define it. */
#ifdef __DECC
# include <types.h>
#endif
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.ac by autoheader. */
/* Define to 1 if on AIX 3.
System headers sometimes define this.
@ -66,9 +59,8 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define for DGUX with <sys/dg_sys_info.h>. */
/* #undef DGUX */
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#define intmax_t unsigned long
/* Define to 1 if the 'getloadavg' function needs to be run setuid or setgid. */
/* #undef GETLOADAVG_PRIVILEGED */
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
@ -83,15 +75,15 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */
/* #undef HAVE_ALLOCA_H */
/* Define to 1 if you have the declaration of 'getloadavg'. */
/* #undef HAVE_DECL_GETLOADAVG */
/* Define to 1 if you have the fdopen function. */
#define HAVE_FDOPEN 1
/* Define to 1 if your system has a working fnmatch function. */
/* #undef HAVE_FNMATCH */
/* Define to 1 if your system has its own 'getloadavg' function. */
/* #undef HAVE_GETLOADAVG */
/* Define to 1 if you have the getmntent function. */
/* #undef HAVE_GETMNTENT */
@ -174,6 +166,14 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you need to in order for stat and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define to 1 if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V
before release 3. */
/* #undef SETVBUF_REVERSED */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
@ -207,13 +207,19 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
instead of <sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"
/* Version of this package (needed by automake) */
#define VERSION "%VERSION%"
/* Define to the name of the SCCS 'get' command. */
/* #undef SCCS_GET */
/* Define this if the SCCS 'get' command understands the '-G<file>' option. */
/* #undef SCCS_GET_MINUS_G */
/* Define this to enable job server support in GNU Make. */
/* Define this to enable job server support in GNU make. */
/* #undef MAKE_JOBSERVER */
/* Define to be the nanoseconds member of struct stat's st_mtim,
@ -247,9 +253,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the 'mkfifo' function. */
/* #undef HAVE_MKFIFO */
/* Define to 1 if you have the mktemp function. */
#define HAVE_MKTEMP 1
@ -289,12 +292,12 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the stricmp function. */
/* #undef HAVE_STRICMP */
/* Define to 1 if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the strsignal function. */
/* #undef HAVE_STRSIGNAL */
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
/* Define to 1 if you have the wait3 function. */
/* #undef HAVE_WAIT3 */
@ -318,9 +321,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define to 1 if you have the `mempcpy' function. */
/* #undef HAVE_MEMPCPY */
/* Define to 1 if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
@ -339,6 +339,11 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H */
/* Define to 1 if you have the <sys/timeb.h> header file. */
#ifndef __GNUC__
#define HAVE_SYS_TIMEB_H 1
#endif
/* Define to 1 if you have the <sys/wait.h> header file. */
/* #undef HAVE_SYS_WAIT_H */
@ -351,12 +356,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */
/* Define to 1 if you have the `isatty' function. */
/* #undef HAVE_ISATTY */
/* Define to 1 if you have the `ttyname' function. */
/* #undef HAVE_TTYNAME */
/* Use high resolution file timestamps if nonzero. */
#define FILE_TIMESTAMP_HI_RES 0
@ -373,9 +372,15 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* #undef HAVE_VMSDIR_H */
/* #undef _DIRENT_HAVE_D_NAMLEN */
/* On older systems without 7.0 backport of CRTL use non-VMS code for opendir() etc. */
#if __CRTL_VER < 70000000
# define HAVE_VMSDIR_H 1
/* On older systems without 7.0 backport of CRTL the first one is defined */
#ifdef __CRTL_VER
# if __CRTL_VER < 70000000
# define HAVE_VMSDIR_H 1
# endif
#else
# if __VMS_VER < 70000000
# define HAVE_VMSDIR_H 1
# endif
#endif
#if defined(HAVE_VMSDIR_H) && defined(HAVE_DIRENT_H)
@ -406,23 +411,5 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#define alloca(n) __ALLOCA(n)
#endif
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
/* # undef WORDS_BIGENDIAN */
/* Output sync sypport */
#define NO_OUTPUT_SYNC
/* Define to 1 to write even short single-line actions into a VMS/DCL command
file; this also enables exporting make environment variables into the
(sub-)process, which executes the action.
The usual make rules apply whether a shell variable - here a DCL symbol or
VMS logical [see CRTL getenv()] - is added to the make environment and
is exported. */
#define USE_DCL_COM_FILE 1
/* Build host information. */
#define MAKE_HOST "VMS"
/* Include customized declarations. */
#include "../src/mkcustom.h"

View File

@ -1,6 +1,6 @@
/* config.h.W32 -- hand-massaged config.h file for Windows builds -*-C-*-
Copyright (C) 1996-2024 Free Software Foundation, Inc.
Copyright (C) 1996-2013 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
@ -13,30 +13,34 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "mkconfig.h"
/* Build for the Windows32 API. */
#define MK_OS_W32 1
this program. If not, see <http://www.gnu.org/licenses/>. */
/* Suppress some Visual C++ warnings.
Maybe after the code cleanup for ISO C we can remove some/all of these. */
#if _MSC_VER > 1000
# pragma warning(disable:4100) /* unreferenced formal parameter */
# pragma warning(disable:4130) /* logical operation on address of string constant */
# pragma warning(disable:4102) /* unreferenced label */
# pragma warning(disable:4127) /* conditional expression is constant */
# pragma warning(disable:4131) /* uses old-style declarator */
# pragma warning(disable:4702) /* unreachable code */
# define _CRT_SECURE_NO_WARNINGS 1 /* function or variable may be unsafe */
# define _CRT_NONSTDC_NO_WARNINGS 1 /* functions w/o a leading underscore */
# define _CRT_SECURE_NO_WARNINGS /* function or variable may be unsafe */
# define _CRT_NONSTDC_NO_WARNINGS /* functions w/o a leading underscore */
#endif
/* Define to 1 if the 'closedir' function returns void instead of 'int'. */
/* #undef CLOSEDIR_VOID */
/* Define to one of '_getb67', 'GETB67', 'getb67' for Cray-2 and Cray-YMP
systems. This function is required for 'alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define to 1 if using 'alloca.c'. */
/* #undef C_ALLOCA */
/* Define to 1 if using 'getloadavg.c'. */
#define C_GETLOADAVG 1
/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
/* #undef DGUX */
@ -47,11 +51,15 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Use high resolution file timestamps if nonzero. */
#define FILE_TIMESTAMP_HI_RES 0
/* Define to 1 if you have 'alloca' after including <alloca.h>, a header that
may be supplied by this distribution. */
/* Define to 1 if the 'getloadavg' function needs to be run setuid or setgid.
*/
/* #undef GETLOADAVG_PRIVILEGED */
/* Define to 1 if you have 'alloca', as a function or macro. */
#define HAVE_ALLOCA 1
/* Define to 1 if <alloca.h> works. */
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
/* #undef HAVE_ALLOCA_H */
/* Define to 1 if you have the 'atexit' function. */
@ -63,6 +71,10 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the clock_gettime function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Embed GNU Guile support. Windows build sets this on the
compilation command line. */
/* #undef HAVE_GUILE */
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
/* #undef HAVE_DCGETTEXT */
@ -71,21 +83,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
don't. */
#define HAVE_DECL_BSD_SIGNAL 0
/* Define to 1 if you have the declaration of `dlerror', and to 0 if you
don't. */
#define HAVE_DECL_DLERROR 0
/* Define to 1 if you have the declaration of `dlopen', and to 0 if you don't.
*/
#define HAVE_DECL_DLOPEN 0
/* Define to 1 if you have the declaration of `dlsym', and to 0 if you don't.
*/
#define HAVE_DECL_DLSYM 0
/* Define to 1 if you have the declaration of 'getloadavg'. */
/* #undef HAVE_DECL_GETLOADAVG */
/* Define to 1 if you have the declaration of 'sys_siglist', and to 0 if you
don't. */
#define HAVE_DECL_SYS_SIGLIST 0
@ -105,16 +102,13 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <direct.h> header file, and it defines getcwd()
and chdir().
*/
#if (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__TINYC__)) && !defined(__INTERIX)
#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(__INTERIX)
# define HAVE_DIRECT_H 1
#endif
/* Support DOS-style pathnames. */
/* Use platform specific coding */
#define HAVE_DOS_PATHS 1
/* Define to 1 if you have the 'dup' function. */
#define HAVE_DUP 1
/* Define to 1 if you have the 'dup2' function. */
#define HAVE_DUP2 1
@ -126,8 +120,8 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#define HAVE_FDOPEN 1
#endif
/* Define to 1 if you have the `fork' function. */
/* #undef HAVE_FORK */
/* Define to 1 if you have the 'fileno' function. */
#define HAVE_FILENO 1
/* Define to 1 if you have the 'getcwd' function. */
#define HAVE_GETCWD 1
@ -141,6 +135,9 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'gethostname' function. */
/* #undef HAVE_GETHOSTNAME */
/* Define to 1 if you have the 'getloadavg' function. */
/* #undef HAVE_GETLOADAVG */
/* Define to 1 if you have the 'getrlimit' function. */
/* #undef HAVE_GETRLIMIT */
@ -152,10 +149,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#define HAVE_GETTIMEOFDAY 1
#endif
/* Embed GNU Guile support. Windows build sets this on the
compilation command line. */
/* #undef HAVE_GUILE */
/* Define if you have the iconv() function. */
/* #undef HAVE_ICONV */
@ -164,26 +157,17 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#define HAVE_INTTYPES_H 1
#endif
/* Define to 1 if you have the `isatty' function. */
#define HAVE_ISATTY 1
/* Define to 1 if you have the 'dgc' library (-ldgc). */
/* #undef HAVE_LIBDGC */
/* Define to 1 if you have the 'kstat' library (-lkstat). */
/* #undef HAVE_LIBKSTAT */
/* Define to 1 if you have the `perfstat' library (-lperfstat). */
/* #undef HAVE_LIBPERFSTAT */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <locale.h> header file. */
/* #undef HAVE_LOCALE_H */
/* Define to 1 if the system has the type 'long long int'. */
#define HAVE_LONG_LONG_INT 1
/*#define HAVE_LOCALE_H 1*/
/* Define to 1 if you have the 'lstat' function. */
/* #undef HAVE_LSTAT */
@ -194,24 +178,9 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mempcpy' function. */
/* #undef HAVE_MEMPCPY */
/* Define to 1 if you have the `memrchr' function. */
/* #undef HAVE_MEMRCHR */
/* Define to 1 if you have the <minix/config.h> header file. */
/* #undef HAVE_MINIX_CONFIG_H */
/* Define to 1 if you have the 'mkfifo' function. */
/* #undef HAVE_MKFIFO */
/* Define to 1 if you have the 'mkstemp' function. */
/* #undef HAVE_MKSTEMP */
/* Define to 1 if you have the `mkstemp' function. */
/* #undef HAVE_MKSTEMP */
/* Define to 1 if you have the 'mktemp' function. */
#define HAVE_MKTEMP 1
@ -224,15 +193,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'pipe' function. */
/* #undef HAVE_PIPE */
/* Define to 1 if you have the `posix_spawn' function. */
/* #undef HAVE_POSIX_SPAWN */
/* Define to 1 if you have the `posix_spawnattr_setsigmask' function. */
/* #undef HAVE_POSIX_SPAWNATTR_SETSIGMASK */
/* Define to 1 if you have the `pselect' function. */
/* #undef HAVE_PSELECT */
/* Define to 1 if you have the 'pstat_getdynamic' function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
@ -254,6 +214,9 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'setlinebuf' function. */
/* #undef HAVE_SETLINEBUF */
/* Define to 1 if you have the 'setlocale' function. */
/*#define HAVE_SETLOCALE 1*/
/* Define to 1 if you have the 'setregid' function. */
/* #undef HAVE_SETREGID */
@ -275,25 +238,16 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'socket' function. */
/* #undef HAVE_SOCKET */
/* Define to 1 if you have the <spawn.h> header file. */
/* #undef HAVE_SPAWN_H */
/* Define to 1 if you have the <stdint.h> header file. */
#ifdef __MINGW32__
#define HAVE_STDINT_H 1
#endif
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `stpcpy' function. */
/* #undef HAVE_STPCPY */
/* Define to 1 if you have the 'strcasecmp' function. */
#if defined(__MINGW32__) || defined(__TINYC__)
#ifdef __MINGW32__
#define HAVE_STRCASECMP 1
#endif
@ -307,22 +261,20 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
/* Define to 1 if you have the 'strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the 'stricmp' function. */
#define HAVE_STRICMP 1
/* Define to 1 if you have the <strings.h> header file. */
#ifdef __MINGW32__
#define HAVE_STRINGS_H 1
#endif
/* #define HAVE_STRINGS_H 1 */
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the 'strncasecmp' function. */
#if defined(__MINGW32__) || defined(__TINYC__)
#ifdef __MINGW32__
#define HAVE_STRNCASECMP 1
#endif
@ -340,23 +292,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'strsignal' function. */
/* #undef HAVE_STRSIGNAL */
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
#ifdef __TINYC__
# ifndef strtoll
# define strtoll _strtoi64
# endif
# ifndef strtoull
# define strtoull _strtoui64
# endif
#endif
/* Define to 1 if `d_type' is a member of `struct dirent'. */
/* SV 57152: MinGW64 version of dirent doesn't support d_type. */
#ifndef __MINGW64__
# define HAVE_STRUCT_DIRENT_D_TYPE 1
#endif
/* Define to 1 if 'n_un.n_name' is a member of 'struct nlist'. */
/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */
@ -364,12 +299,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/file.h> header file. */
/* #undef HAVE_SYS_FILE_H */
/* Define to 1 if you have the <sys/loadavg.h> header file. */
/* #undef HAVE_SYS_LOADAVG_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines 'DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
@ -382,12 +311,12 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <sys/resource.h> header file. */
/* #undef HAVE_SYS_RESOURCE_H */
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#ifdef __MINGW32__
#define HAVE_SYS_TIME_H 1
@ -399,21 +328,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <sys/wait.h> header file. */
/* #undef HAVE_SYS_WAIT_H */
/* Define to 1 if you have the `ttyname' function. */
#define HAVE_TTYNAME 1
char *ttyname (int);
/* Define to 1 if the system has the type `intmax_t'. */
#define HAVE_INTMAX_T 1
/* Define to 1 if the system has the type `uintmax_t'. */
#define HAVE_UINTMAX_T 1
/* Define to 1 if you have the `umask' function. */
#if defined(__MINGW32__) || defined(__TINYC__)
# define HAVE_UMASK 1
#endif
/* Define to 1 if you have the \'union wait' type in <sys/wait.h>. */
/* #undef HAVE_UNION_WAIT */
@ -422,40 +336,19 @@ char *ttyname (int);
#define HAVE_UNISTD_H 1
#endif
/* Define to 1 if the system has the type 'unsigned long long int'. */
#define HAVE_UNSIGNED_LONG_LONG_INT 1
/* Define to 1 if you have the `vfork' function. */
/* #undef HAVE_VFORK */
/* Define to 1 if you have the <vfork.h> header file. */
/* #undef HAVE_VFORK_H */
/* Define to 1 if you have the 'wait3' function. */
/* #undef HAVE_WAIT3 */
/* Define to 1 if you have the 'waitpid' function. */
/* #undef HAVE_WAITPID */
/* Define to 1 if you have the <wchar.h> header file. */
/* #undef HAVE_WCHAR_H */
/* Define to 1 if `fork' works. */
/* #undef HAVE_WORKING_FORK */
/* Define to 1 if `vfork' works. */
/* #undef HAVE_WORKING_VFORK */
/* Define to 1 if the system has the type `_Bool'. */
/* #undef HAVE__BOOL */
/* Build host information. */
#define MAKE_HOST "Windows32"
/* Define to 1 to enable job server support in GNU Make. */
/* Define to 1 to enable job server support in GNU make. */
#define MAKE_JOBSERVER 1
/* Define to 1 to enable 'load' support in GNU Make. */
/* Define to 1 to enable 'load' support in GNU make. */
#define MAKE_LOAD 1
/* Define to 1 to enable symbolic link timestamp checking. */
@ -471,15 +364,38 @@ char *ttyname (int);
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-make@gnu.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "GNU make"
/* Define to the home page for this package. */
#define PACKAGE_URL "http://www.gnu.org/software/make/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "%VERSION%"
/* Define to the character that separates directories in PATH. */
#define PATH_SEPARATOR_CHAR ';'
/* Define as the return type of signal handlers ('int' or 'void'). */
#define RETSIGTYPE void
/* Define to the name of the SCCS 'get' command. */
#define SCCS_GET "echo no sccs get"
/* Define this if the SCCS 'get' command understands the '-G<file>' option. */
/* #undef SCCS_GET_MINUS_G */
/* Define to 1 if the 'setvbuf' function takes the buffering type as its
second argument and the buffer pointer as the third, as on System V before
release 3. */
/* #undef SETVBUF_REVERSED */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run time.
@ -500,6 +416,11 @@ char *ttyname (int);
/* Define to 1 on System V Release 4. */
/* #undef SVR4 */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#ifdef __MINGW32__
#define TIME_WITH_SYS_TIME 1
#endif
/* Define to 1 for Encore UMAX. */
/* #undef UMAX */
@ -507,6 +428,9 @@ char *ttyname (int);
<sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Version number of package */
#define VERSION "%VERSION%"
/* Define if using the dmalloc debugging malloc package */
/* #undef WITH_DMALLOC */
@ -517,10 +441,6 @@ char *ttyname (int);
/* # undef _ALL_SOURCE */
#endif
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
/* # undef WORDS_BIGENDIAN */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
@ -540,19 +460,6 @@ char *ttyname (int);
/* Define to empty if 'const' does not conform to ANSI C. */
/* #undef const */
#ifdef __MINGW32__
# undef __USE_MINGW_ANSI_STDIO
# define __USE_MINGW_ANSI_STDIO 1
#endif
/* Number of bits in a timestamp, on hosts where this is settable. */
/* #undef _TIME_BITS */
/* For 64-bit time_t on 32-bit mingw. */
#ifdef __MINGW32__
# define __MINGW_USE_VC2005_COMPAT 1
#endif
#include <sys/types.h>
/* Define to 'int' if <sys/types.h> doesn't define. */
@ -568,16 +475,12 @@ char *ttyname (int);
#endif
#endif
/* Define to `int' if <sys/types.h> does not define. */
#define ssize_t int
/* Define to 'int' if <sys/types.h> doesn't define. */
#define uid_t int
/* Define {u,}intmax_t if not defined in <stdint.h> or <inttypes.h>. */
/* Define uintmax_t if not defined in <stdint.h> or <inttypes.h>. */
#if !HAVE_STDINT_H && !HAVE_INTTYPES_H
#define intmax_t long long
#define uintmax_t unsigned long long
#define uintmax_t unsigned long
#endif
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
@ -593,14 +496,10 @@ char *ttyname (int);
/*
* If you have a shell that does not grok 'sh -c quoted-command-line'
* correctly, you need this setting; it is the default for tcc.
* Please see below for specific shell support.
* correctly, you need this setting. Please see below for specific
* shell support.
*/
#if defined(__TINYC__)
#define BATCH_MODE_ONLY_SHELL 1
#else
/*#define BATCH_MODE_ONLY_SHELL 1 */
#endif
/*
* Define if you have the Cygnus "Cygwin" GNU Windows32 tool set.
@ -625,5 +524,4 @@ char *ttyname (int);
#undef BATCH_MODE_ONLY_SHELL
#endif
/* Include customized declarations. */
#include "../src/mkcustom.h"
#define OUTPUT_SYNC

11
config/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
compile
config.guess
config.rpath
config.sub
depcomp
install-sh
mdate-sh
missing
texinfo.tex
*.m4
!dospaths.m4

49
config/ChangeLog Normal file
View File

@ -0,0 +1,49 @@
2012-01-15 Paul Smith <psmith@gnu.org>
* dospaths.m4: Use AC_LANG_PROGRAM to encapsulate the test code.
Fixes Savannah bug #35256. Patch from Sebastian Pipping.
2006-03-09 Paul Smith <psmith@gnu.org>
* dospaths.m4: Add MSYS to the list of targets allowing DOS-style
pathnames. Reported by David Ergo <david.ergo@alterface.com>.
2005-07-01 Paul D. Smith <psmith@gnu.org>
* Makefile.am (EXTRA_DIST): Added more M4 files to EXTRA_DIST, so
users can re-run aclocal.
2003-04-30 Paul D. Smith <psmith@gnu.org>
* dospaths.m4: New macro to test for DOS-style pathnames, based on
coreutils 5.0 "dos.m4" by Jim Meyering.
2002-04-21 gettextize <bug-gnu-gettext@gnu.org>
* codeset.m4: New file, from gettext-0.11.1.
* gettext.m4: New file, from gettext-0.11.1.
* glibc21.m4: New file, from gettext-0.11.1.
* iconv.m4: New file, from gettext-0.11.1.
* isc-posix.m4: New file, from gettext-0.11.1.
* lcmessage.m4: New file, from gettext-0.11.1.
* lib-ld.m4: New file, from gettext-0.11.1.
* lib-link.m4: New file, from gettext-0.11.1.
* lib-prefix.m4: New file, from gettext-0.11.1.
* progtest.m4: New file, from gettext-0.11.1.
* Makefile.am: New file.
Copyright (C) 2002-2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>.

18
config/Makefile.am Normal file
View File

@ -0,0 +1,18 @@
# -*-Makefile-*-, or close enough
# Copyright (C) 2002-2013 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
# Autoconf / automake know how to handle this directory.

View File

@ -1,7 +1,7 @@
# Test if the system uses DOS-style pathnames (drive specs and backslashes)
# By Paul Smith <psmith@gnu.org>. Based on dos.m4 by Jim Meyering.
#
# Copyright (C) 1993-2024 Free Software Foundation, Inc.
# Copyright (C) 1993-2013 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
@ -15,7 +15,7 @@
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.
# this program. If not, see <http://www.gnu.org/licenses/>.
AC_DEFUN([pds_AC_DOS_PATHS], [
AC_CACHE_CHECK([whether system uses MSDOS-style paths], [ac_cv_dos_paths], [

View File

@ -1,6 +1,6 @@
/* configh.dos -- hand-massaged config.h file for MS-DOS builds -*-C-*-
Copyright (C) 1994-2024 Free Software Foundation, Inc.
Copyright (C) 1994-2013 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
@ -13,11 +13,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_OS_DOS 1
this program. If not, see <http://www.gnu.org/licenses/>. */
/* Include this header to make __DJGPP_MINOR__ available because DJGPP ports
of GCC 4.3.0 and later no longer do it automatically. */
@ -53,9 +49,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'getgroups' function. */
#define HAVE_GETGROUPS 1
/* Define to 1 if the system has the type 'long long int'. */
#define HAVE_LONG_LONG_INT 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
@ -73,6 +66,13 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#define SCCS_GET "get"
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long long
/* Define the type of the first arg to select(). */
#define fd_set_size_t int
/* Define to 1 if you have the select function. */
#define HAVE_SELECT 1
@ -82,33 +82,32 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
/* Name of the package */
#define PACKAGE "%PACKAGE%"
/* Output sync support */
#define NO_OUTPUT_SYNC 1
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-%PACKAGE%@gnu.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "GNU %PACKAGE%"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "GNU %PACKAGE% %VERSION%"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "%PACKAGE%"
/* Define to the version of this package. */
#define PACKAGE_VERSION "%VERSION%"
/* Define to 1 if the C compiler supports function prototypes. */
#define PROTOTYPES 1
/* Version number of package */
#define VERSION "%VERSION%"
/* Build host information. */
#define MAKE_HOST "i386-pc-msdosdjgpp"
/* Grok DOS paths (drive specs and backslash path element separators) */
#define HAVE_DOS_PATHS 1
/* Define the type of the first arg to select(). */
#define fd_set_size_t int
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#define intmax_t long long
/* Define to `int' if <sys/types.h> does not define. */
#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 5
#define ssize_t int
#endif
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long long
/* Include customized declarations. */
#include "../src/mkcustom.h"
#define HAVE_DOS_PATHS

View File

@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 1993-2024 Free Software Foundation, Inc.
# Copyright (C) 1993-2013 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
@ -14,36 +14,22 @@
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.
# this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([GNU Make],[4.4.90],[bug-make@gnu.org])
AC_INIT([GNU make],[3.99.91],[bug-make@gnu.org])
AC_PREREQ([2.69])
AC_PREREQ([2.62])
# Autoconf setup
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/vpath.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_LIBOBJ_DIR([lib])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_SRCDIR([vpath.c])
AC_CONFIG_HEADERS([config.h])
# Automake setup
# We have to enable "foreign" because ChangeLog is auto-generated
# Automake 1.15 and gnulib don't get along: gnulib has some strange error
# in the way it handles getloadavg.c which causes make distcheck to fail.
# https://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00024.html
AM_INIT_AUTOMAKE([1.16.1 foreign -Werror -Wall])
AM_INIT_AUTOMAKE([1.11.1 silent-rules])
# Checks for programs.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_CXX
AC_DEFINE_UNQUOTED(MAKE_CXX, ["$CXX"], [Default C++ compiler.])
# Configure gnulib
gl_EARLY
gl_INIT
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_CPP
@ -53,35 +39,45 @@ AC_CHECK_PROG([PERL], [perl], [perl], [perl])
# Specialized system macros
AC_CANONICAL_HOST
AC_C_BIGENDIAN
AC_AIX
AC_ISC_POSIX
AC_MINIX
# Enable gettext, in "external" mode.
AM_GNU_GETTEXT_VERSION([0.19.4])
AM_GNU_GETTEXT_VERSION([0.18.1])
AM_GNU_GETTEXT([external])
# This test must come as early as possible after the compiler configuration
# tests, because the choice of the file model can (in principle) affect
# whether functions and headers are available, whether they work, etc.
AC_SYS_LARGEFILE
# Checks for libraries.
AC_SEARCH_LIBS([strerror],[cposix])
AC_SEARCH_LIBS([getpwnam], [sun])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_CHECK_HEADERS([stdlib.h string.h strings.h locale.h unistd.h limits.h \
memory.h sys/param.h sys/resource.h sys/time.h sys/select.h \
sys/file.h fcntl.h spawn.h])
AC_HEADER_TIME
AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h])
AM_PROG_CC_C_O
AC_C_CONST
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T
# Check for sig_atomic_t
gt_TYPE_SIG_ATOMIC_T
# Find some definition for uintmax_t
AC_CHECK_TYPE([uintmax_t],[],
[ uintmax_t="unsigned long"
AC_CHECK_TYPE([unsigned long long],[uintmax_t="unsigned long long"])
AC_DEFINE_UNQUOTED([uintmax_t], [$uintmax_t],
[Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])
])
# Find out whether our struct stat returns nanosecond resolution timestamps.
@ -94,12 +90,12 @@ AC_CACHE_CHECK([whether to use high resolution file timestamps],
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif]],
[[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
[[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
[make_cv_file_timestamp_hi_res=yes])
])])
AS_IF([test "$make_cv_file_timestamp_hi_res" = yes], [val=1], [val=0])
AC_DEFINE_UNQUOTED([FILE_TIMESTAMP_HI_RES], [$val],
[Use high resolution file timestamps if nonzero.])
[Use high resolution file timestamps if nonzero.])
AS_IF([test "$make_cv_file_timestamp_hi_res" = yes],
[ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
@ -107,10 +103,13 @@ AS_IF([test "$make_cv_file_timestamp_hi_res" = yes],
AC_SEARCH_LIBS([clock_gettime], [rt posix4])
AS_IF([test "$ac_cv_search_clock_gettime" != no],
[ AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
[Define to 1 if you have the clock_gettime function.])
[Define to 1 if you have the clock_gettime function.])
])
])
# Check for DOS-style pathnames.
pds_AC_DOS_PATHS
# See if we have a standard version of gettimeofday(). Since actual
# implementations can differ, just make sure we have the most common
# one.
@ -118,25 +117,24 @@ AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday],
[ac_cv_func_gettimeofday=no
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
int main ()
{
struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
return gettimeofday (&t, 0) != 0
|| t.tv_sec < 0 || t.tv_usec < 0;
}]])],
[ac_cv_func_gettimeofday=yes],
[ac_cv_func_gettimeofday=no],
[ac_cv_func_gettimeofday="no (cross-compiling)"])])
{
struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
exit (gettimeofday (&t, 0) != 0
|| t.tv_sec < 0 || t.tv_usec < 0);
}]])],
[ac_cv_func_gettimeofday=yes],
[ac_cv_func_gettimeofday=no],
[ac_cv_func_gettimeofday="no (cross-compiling)"])])
AS_IF([test "$ac_cv_func_gettimeofday" = yes],
[ AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
[Define to 1 if you have a standard gettimeofday function])
[Define to 1 if you have a standard gettimeofday function])
])
AC_CHECK_FUNCS([strtoll strdup strndup stpcpy memrchr mempcpy umask mkstemp \
mktemp fdopen dup dup2 getcwd realpath sigsetmask sigaction \
AC_CHECK_FUNCS([strdup strndup mkstemp mktemp fdopen fileno \
dup dup2 getcwd realpath sigsetmask sigaction \
getgroups seteuid setegid setlinebuf setreuid setregid \
mkfifo getrlimit setrlimit setvbuf pipe strerror strsignal \
lstat readlink atexit isatty ttyname pselect posix_spawn \
posix_spawnattr_setsigmask])
getrlimit setrlimit setvbuf pipe strerror strsignal \
lstat readlink atexit])
# We need to check declarations, not just existence, because on Tru64 this
# function is not declared without special flags, which themselves cause
@ -144,7 +142,7 @@ AC_CHECK_FUNCS([strtoll strdup strndup stpcpy memrchr mempcpy umask mkstemp \
AC_CHECK_DECLS([bsd_signal], [], [], [[#define _GNU_SOURCE 1
#include <signal.h>]])
AC_FUNC_FORK
AC_FUNC_SETVBUF_REVERSED
# Rumor has it that strcasecmp lives in -lresolv on some odd systems.
# It doesn't hurt much to use our own if we can't find it so I don't
@ -153,65 +151,46 @@ AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
# strcoll() is used by the GNU glob library
AC_FUNC_STRCOLL
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID
# dir.c and our glob.c use dirent.d_type if available
AC_STRUCT_DIRENT_D_TYPE
# See if the user wants to add (or not) GNU Guile support
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
[Support GNU Guile for embedded scripting])])
# Annoyingly, each version of Guile comes with it's own PC file so we have to
# specify them as individual packages. Ugh.
PKG_PROG_PKG_CONFIG
# For some strange reason, at least on Ubuntu, each version of Guile
# comes with it's own PC file so we have to specify them as individual
# packages. Ugh.
AS_IF([test "x$with_guile" != xno],
[ guile_versions="3.0 2.2 2.0 1.8"
guile_version=no
have_guile=no
AC_MSG_CHECKING([for GNU Guile])
for v in $guile_versions; do
PKG_CHECK_EXISTS([guile-$v], [guile_version=$v; have_guile=yes; break], [])
done
AC_MSG_RESULT([$guile_version])
AS_IF([test "$have_guile" = yes],
[ PKG_CHECK_MODULES(GUILE, [guile-$guile_version])
# Unfortunately pkg doesn't help in multi-arch environments where the
# package is installed for some architectures but not others; we need
# to try to link.
keep_CPPFLAGS="$CPPFLAGS"
keep_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
LIBS="$LIBS $GUILE_LIBS"
AC_CHECK_HEADER([libguile.h],
[have_guile=yes],
[have_guile=no],
[/* Avoid configuration error warnings. */])
AS_IF([test "$have_guile" = yes],
[ AC_MSG_CHECKING([whether we can link GNU Guile])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <libguile.h>
static void *
guile_init (void *arg)
{
(void) arg;
return 0;
}
]], [[
scm_with_guile (guile_init, 0);
]])],
[have_guile=yes],
[have_guile=no])
AC_MSG_RESULT([$have_guile])])
CPPFLAGS="$keep_CPPFLAGS"
LIBS="$keep_LIBS"
])
[ PKG_CHECK_MODULES([GUILE], [guile-2.0], [have_guile=yes],
[PKG_CHECK_MODULES([GUILE], [guile-1.8], [have_guile=yes],
[have_guile=no])])
])
AS_IF([test "$have_guile" = yes],
[AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])])
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = "yes"])
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes])
AC_FUNC_GETLOADAVG
# AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
# doesn't. So, we will.
AS_IF([test "$ac_cv_header_nlist_h" = yes],
[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
[[struct nlist nl;
nl.n_name = "string";
return 0;]])],
[make_cv_nlist_struct=yes],
[make_cv_nlist_struct=no])
AS_IF([test "$make_cv_nlist_struct" = yes],
[ AC_DEFINE([NLIST_STRUCT], [1],
[Define to 1 if struct nlist.n_name is a pointer rather than an array.])
])
])
AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
[AC_INCLUDES_DEFAULT
@ -264,7 +243,8 @@ AS_IF([test "$PATH_SEPARATOR" = ';'],
AC_SUBST([REMOTE]) REMOTE=stub
use_customs=false
AC_ARG_WITH([customs],
[AS_HELP_STRING([--with-customs=DIR],[enable remote jobs via Customs--see README.customs])],
[ AC_HELP_STRING([--with-customs=DIR],
[enable remote jobs via Customs--see README.customs])],
[ AS_CASE([$withval], [n|no], [:],
[make_cppflags="$CPPFLAGS"
AS_CASE([$withval],
@ -274,7 +254,7 @@ AC_ARG_WITH([customs],
CF_NETLIBS
AC_CHECK_HEADER([customs.h],
[use_customs=true
REMOTE=cstms
REMOTE=cstms
LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
[with_customs=no
CPPFLAGS="$make_cppflags" make_badcust=yes])
@ -287,12 +267,14 @@ AM_CONDITIONAL([USE_CUSTOMS], [test "$use_customs" = true])
# See if the user asked to handle case insensitive file systems.
AH_TEMPLATE([HAVE_CASE_INSENSITIVE_FS], [Use case insensitive file names])
AC_ARG_ENABLE([case-insensitive-file-system],
AS_HELP_STRING([--enable-case-insensitive-file-system],[assume file systems are case insensitive]),
AC_HELP_STRING([--enable-case-insensitive-file-system],
[assume file systems are case insensitive]),
[AS_IF([test "$enableval" = yes], [AC_DEFINE([HAVE_CASE_INSENSITIVE_FS])])])
# See if we can handle the job server feature, and if the user wants it.
AC_ARG_ENABLE([job-server],
AS_HELP_STRING([--disable-job-server],[disallow recursive make communication during -jN]),
AC_HELP_STRING([--disable-job-server],
[disallow recursive make communication during -jN]),
[make_cv_job_server="$enableval" user_job_server="$enableval"],
[make_cv_job_server="yes"])
@ -322,7 +304,7 @@ AS_CASE([$host_os], [os2*|mingw*], [make_cv_job_server=yes])
AS_CASE([/$make_cv_job_server/$user_job_server/],
[*/no/*], [: no jobserver],
[AC_DEFINE(MAKE_JOBSERVER, 1,
[Define to 1 to enable job server support in GNU Make.])
[Define to 1 to enable job server support in GNU make.])
])
# If dl*() functions are supported we can enable the load operation
@ -330,22 +312,23 @@ AC_CHECK_DECLS([dlopen, dlsym, dlerror], [], [],
[[#include <dlfcn.h>]])
AC_ARG_ENABLE([load],
AS_HELP_STRING([--disable-load],[disable support for the 'load' operation]),
AC_HELP_STRING([--disable-load],
[disable support for the 'load' operation]),
[make_cv_load="$enableval" user_load="$enableval"],
[make_cv_load="yes"])
AS_CASE([/$ac_cv_have_decl_dlopen/$ac_cv_have_decl_dlsym/$ac_cv_have_decl_dlerror/],
AS_CASE([/$ac_cv_func_dlopen/$ac_cv_func_dlsym/$ac_cv_func_dlerror/],
[*/no/*], [make_cv_load=no])
# We might need -ldl
AS_IF([test "$make_cv_load" = yes], [
AC_SEARCH_LIBS([dlopen], [dl], [], [make_cv_load=])
])
AS_CASE([/$make_cv_load/$user_load/],
[*/no/*], [make_cv_load=no],
[AC_DEFINE(MAKE_LOAD, 1,
[Define to 1 to enable 'load' support in GNU Make.])
[Define to 1 to enable 'load' support in GNU make.])
])
# We might need -ldl
AS_IF([test "$make_cv_load" = yes], [
AC_SEARCH_LIBS([dlopen], [dl], [], [make_cv_load=])
])
# If we want load support, we might need to link with export-dynamic.
@ -353,14 +336,14 @@ AS_CASE([/$make_cv_load/$user_load/],
# For example passing -rdynamic to the SunPRO linker gives a warning
# but succeeds and creates a shared object, not an executable!
AS_IF([test "$make_cv_load" = yes], [
AC_MSG_CHECKING([if the linker accepts -Wl,--export-dynamic])
AC_MSG_CHECKING([If the linker accepts -Wl,--export-dynamic])
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
[AC_MSG_RESULT([yes])
AC_SUBST([AM_LDFLAGS], [-Wl,--export-dynamic])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([if the linker accepts -rdynamic])
AC_MSG_CHECKING([If the linker accepts -rdynamic])
LDFLAGS="$old_LDFLAGS -rdynamic"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
[AC_MSG_RESULT([yes])
@ -377,38 +360,6 @@ AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes],
[Define to 1 to enable symbolic link timestamp checking.])
])
# Use posix_spawn if we have support and the user didn't disable it
AC_ARG_ENABLE([posix-spawn],
AS_HELP_STRING([--disable-posix-spawn],[disable support for posix_spawn()]),
[make_cv_posix_spawn="$enableval" user_posix_spawn="$enableval"],
[make_cv_posix_spawn="yes"])
AS_CASE([/$ac_cv_header_spawn/$ac_cv_func_posix_spawn/],
[*/no/*], [make_cv_posix_spawn=no])
AS_IF([test "$make_cv_posix_spawn" = yes],
AC_CACHE_CHECK([for posix_spawn that fails synchronously],
[make_cv_synchronous_posix_spawn],
[make_cv_synchronous_posix_spawn=no
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <errno.h>
#include <spawn.h>
extern char **environ;
int main () {
char path[[]] = "./xxx-non-existent";
char *argv[[]] = {path, 0};
return posix_spawn (0, path, 0, 0, argv, environ) == ENOENT ? 0 : 1;
}]])],
[make_cv_synchronous_posix_spawn=yes],
[make_cv_synchronous_posix_spawn=no],
[make_cv_synchronous_posix_spawn="no (cross-compiling)"])]))
AS_CASE([/$user_posix_spawn/$make_cv_posix_spawn/$make_cv_synchronous_posix_spawn/],
[*/no/*], [make_cv_posix_spawn=no],
[AC_DEFINE(USE_POSIX_SPAWN, 1, [Define to 1 to use posix_spawn().])
])
# Find the SCCS commands, so we can include them in our default rules.
AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
@ -417,7 +368,7 @@ AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
[make_cv_path_sccs_get=get])
])
AC_DEFINE_UNQUOTED([SCCS_GET], ["$make_cv_path_sccs_get"],
[Define to the name of the SCCS 'get' command.])
[Define to the name of the SCCS 'get' command.])
ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 &&
@ -436,6 +387,33 @@ AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 &&
])
rm -f s.conftest conftoast
# Check the system to see if it provides GNU glob. If not, use our
# local version.
AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob],
[ AC_EGREP_CPP([gnu glob],[
#include <features.h>
#include <glob.h>
#include <fnmatch.h>
#define GLOB_INTERFACE_VERSION 1
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
# include <gnu-versions.h>
# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
gnu glob
# endif
#endif],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no])])
AS_IF([test "$make_cv_sys_gnu_glob" = no],
[ GLOBINC='-I$(srcdir)/glob'
GLOBLIB=glob/libglob.a
])
AC_SUBST([GLOBINC])
AC_SUBST([GLOBLIB])
# Tell automake about this, so it can build the right .c files.
AM_CONDITIONAL([USE_LOCAL_GLOB], [test "$make_cv_sys_gnu_glob" = no])
# Let the makefile know what our build host is
AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.])
@ -444,31 +422,19 @@ AC_SUBST([MAKE_HOST])
w32_target_env=no
AM_CONDITIONAL([WINDOWSENV], [false])
AM_CONDITIONAL([HAVE_WINDRES], [false])
AS_CASE([$host],
[*-*-mingw32],
[AM_CONDITIONAL([WINDOWSENV], [true])
w32_target_env=yes
AC_DEFINE([MK_OS_W32], [1], [Build for the Windows32 API.])
AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
# Windows host tools.
# If windres is available, make will use UTF-8.
AC_CHECK_TOOL([WINDRES], [windres], [:])
AM_CONDITIONAL([HAVE_WINDRES], [test "$WINDRES" != ':'])
AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
AC_DEFINE([OUTPUT_SYNC], [1], [Support synchronized output])
AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
])
AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
[Define to the character that separates directories in PATH.])
AC_DEFINE_UNQUOTED([HAVE_DECL_GETLOADAVG],[$HAVE_DECL_GETLOADAVG],
[Define to 1 if you have the declaration of 'getloadavg'.])
# Remember that we ran configure to generate config.h
AC_DEFINE([MK_CONFIGURE], [1],
[Define to 1 if config.h is generated by running the configure script.])
# Include the Maintainer's Makefile section, if it's here.
MAINT_MAKEFILE=/dev/null
@ -480,10 +446,6 @@ AC_SUBST_FILE([MAINT_MAKEFILE])
# Allow building with dmalloc
AM_WITH_DMALLOC
# Add custom header to config.h
AH_BOTTOM([/* Include customized declarations. */
#include "../src/mkcustom.h"])
# Forcibly disable SET_MAKE. If it's set it breaks things like the test
# scripts, etc.
SET_MAKE=
@ -503,7 +465,7 @@ AS_CASE([$with_customs],
[ echo
echo "WARNING: '$with_customs/lib' does not appear to contain the"
echo " Customs library. You must build and install Customs"
echo " before compiling GNU Make."
echo " before compiling GNU make."
echo
])])
@ -511,7 +473,7 @@ AS_IF([test "x$has_wait_nohang" = xno],
[ echo
echo "WARNING: Your system has neither waitpid() nor wait3()."
echo " Without one of these, signal handling is unreliable."
echo " You should be aware that running GNU Make with -j"
echo " You should be aware that running GNU make with -j"
echo " could result in erratic behavior."
echo
])
@ -535,30 +497,21 @@ AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes],
echo
])
AS_IF([test "x$make_cv_posix_spawn" = xno && test "x$user_posix_spawn" = xyes],
[ echo
echo "WARNING: posix_spawn() is not supported on this system."
echo
])
# autoconf initializes $prefix to NONE.
AM_CONDITIONAL([KNOWN_PREFIX],
[test "x$prefix" = xNONE -o "x$prefix" = x/usr/local \
-o "x$prefix" = x/usr/gnu -o "x$prefix" = x/usr])
# Specify what files are to be created.
AC_CONFIG_FILES([build.cfg tests/config-flags.pm \
Makefile lib/Makefile doc/Makefile po/Makefile.in])
# We don't need this: the standard automake output suffices for POSIX systems.
#mk/Posix.mk
# Put build.sh in the build directory so it's easy to find
AC_CONFIG_LINKS([build.sh:build.sh])
AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \
doc/Makefile w32/Makefile])
# OK, do it!
AC_OUTPUT
# We only generate the build.sh if we have a build.sh.in; we won't have
# one before we've created a distribution.
AS_IF([test -f "$srcdir/build.sh.in"],
[ ./config.status --file build.sh
chmod +x build.sh
])
dnl Local Variables:
dnl comment-start: "dnl "
dnl comment-end: ""

60
configure.bat Normal file
View File

@ -0,0 +1,60 @@
@echo off
rem Copyright (C) 1994-2013 Free Software Foundation, Inc.
rem This file is part of GNU Make.
rem
rem GNU Make is free software; you can redistribute it and/or modify it under
rem the terms of the GNU General Public License as published by the Free
rem Software Foundation; either version 3 of the License, or (at your option)
rem any later version.
rem
rem GNU Make is distributed in the hope that it will be useful, but WITHOUT
rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
rem more details.
rem
rem You should have received a copy of the GNU General Public License along
rem with this program. If not, see <http://www.gnu.org/licenses/>.
echo Configuring MAKE for DJGPP
rem The SmallEnv trick protects against too small environment block,
rem in which case the values will be truncated and the whole thing
rem goes awry. COMMAND.COM will say "Out of environment space", but
rem many people don't care, so we force them to care by refusing to go.
rem Where is the srcdir?
set XSRC=.
if not "%XSRC%"=="." goto SmallEnv
if "%1%"=="" goto SrcDone
set XSRC=%1
if not "%XSRC%"=="%1" goto SmallEnv
:SrcDone
update %XSRC%/configh.dos ./config.h
rem Do they have Make?
redir -o junk.$$$ -eo make -n -f NUL
rem REDIR will return 1 if it cannot run Make.
rem If it can run Make, it will usually return 2,
rem but 0 is also OK with us.
if errorlevel 2 goto MakeOk
if not errorlevel 1 goto MakeOk
if exist junk.$$$ del junk.$$$
echo No Make program found--use DOSBUILD.BAT to build Make.
goto End
rem They do have Make. Generate the Makefile.
:MakeOk
del junk.$$$
update %XSRC%/Makefile.DOS ./Makefile
echo Done.
if not "%XSRC%"=="." echo Invoke Make thus: "make srcdir=%XSRC%"
goto End
:SmallEnv
echo Your environment is too small. Please enlarge it and run me again.
:End
set XRSC=

View File

@ -1,5 +1,5 @@
/* Debugging macros and interface.
Copyright (C) 1999-2024 Free Software Foundation, Inc.
Copyright (C) 1999-2013 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
@ -12,15 +12,13 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#define DB_NONE (0x000)
#define DB_BASIC (0x001)
#define DB_VERBOSE (0x002)
#define DB_JOBS (0x004)
#define DB_IMPLICIT (0x008)
#define DB_PRINT (0x010)
#define DB_WHY (0x020)
#define DB_MAKEFILES (0x100)
#define DB_ALL (0xfff)
@ -29,8 +27,6 @@ extern int db_level;
#define ISDB(_l) ((_l)&db_level)
/* When adding macros to this list be sure to update the value of
XGETTEXT_OPTIONS in the po/Makevars file. */
#define DBS(_l,_x) do{ if(ISDB(_l)) {print_spaces (depth); \
printf _x; fflush (stdout);} }while(0)

View File

@ -1,5 +1,5 @@
/* Data base of default implicit rules for GNU Make.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2013 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
@ -12,7 +12,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
@ -27,7 +27,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define GCC_IS_NATIVE if gcc is the native development environment on
your system (gcc/bison/flex vs cc/yacc/lex). */
#if MK_OS_DOS || MK_OS_OS2
#if defined(__MSDOS__) || defined(__EMX__)
# define GCC_IS_NATIVE
#endif
@ -36,14 +36,12 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
'.s' must come last, so that a '.o' file will be made from
a '.c' or '.p' or ... file rather than from a .s file. */
static const char default_suffixes[]
#if MK_OS_VMS
/* VMS should include all UNIX/POSIX + some VMS extensions */
= ".out .exe .a .olb .hlb .tlb .mlb .ln .o .obj .c .cxx .cc .cpp .pas .p \
.for .f .r .y .l .ym .yl .mar .s .ss .i .ii .mod .sym .def .h .info .dvi \
.tex .texinfo .texi .txinfo .mem .hlp .brn .rnh .rno .rnt .rnx .w .ch .cweb \
.web .com .sh .elc .el";
#elif MK_OS_OS2
static char default_suffixes[]
#ifdef VMS
= ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \
.s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
.w .ch .cweb .web .com .sh .elc .el";
#elif defined(__EMX__)
= ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \
.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
.w .ch .web .sh .elc .el .obj .exe .dll .lib";
@ -53,37 +51,21 @@ static const char default_suffixes[]
.w .ch .web .sh .elc .el";
#endif
static const struct pspec default_pattern_rules[] =
static struct pspec default_pattern_rules[] =
{
#if MK_OS_VMS
{ "(%)", "%",
"@if f$$search(\"$@\") .eqs. \"\" then $(LIBRARY)/CREATE/"
"$(or "
"$(patsubst %,TEXT,$(filter %.tlb %.TLB,$@)),"
"$(patsubst %,HELP,$(filter %.hlb %.HLB,$@)),"
"$(patsubst %,MACRO,$(filter %.mlb %.MLB,$@)),"
"$(and "
"$(patsubst %,SHARE,$(filter %.olb %.OLB,$@)),"
"$(patsubst %,SHARE,$(filter %.exe %.EXE,$<))),"
"OBJECT)"
" $@\n"
"$(AR) $(ARFLAGS) $@ $<" },
#else
{ "(%)", "%",
"$(AR) $(ARFLAGS) $@ $<" },
#endif
/* The X.out rules are only in BSD's default set because
BSD Make has no null-suffix rules, so 'foo.out' and
'foo' are the same thing. */
#if MK_OS_VMS
#ifdef VMS
{ "%.exe", "%",
"$(CP) $< $@" },
#endif
"copy $< $@" },
#else
{ "%.out", "%",
"@rm -f $@ \n cp $< $@" },
#endif
/* Syntax is "ctangle foo.w foo.ch foo.c". */
{ "%.c", "%.w %.ch",
"$(CTANGLE) $^ $@" },
@ -93,23 +75,21 @@ static const struct pspec default_pattern_rules[] =
{ 0, 0, 0 }
};
static const struct pspec default_terminal_rules[] =
static struct pspec default_terminal_rules[] =
{
#if MK_OS_VMS
#ifdef VMS
/* RCS. */
{ "%", "%$$5lv", /* Multinet style */
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "[.$$rcs]%$$5lv", /* Multinet style */
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "%_v", /* Normal style */
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "[.rcs]%_v", /* Normal style */
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
/* SCCS. */
/* ain't no SCCS on vms */
#else
/* RCS. */
{ "%", "%,v",
@ -124,54 +104,17 @@ static const struct pspec default_terminal_rules[] =
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
{ "%", "SCCS/s.%",
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
#endif /* !MK_OS_VMS */
#endif /* !VMS */
{ 0, 0, 0 }
};
static const char *const default_suffix_rules[] =
static char *default_suffix_rules[] =
{
#if MK_OS_VMS
".o",
"$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".obj",
"$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".s",
"$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".S",
"$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".c",
"$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".cc",
"$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".C",
"$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".cpp",
"$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".f",
"$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".m",
"$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".p",
"$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".F",
"$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".r",
"$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
".mod",
"$(COMPILE.mod) -o $@ -e $@ $^",
".def.sym",
"$(COMPILE.def) -o $@ $<",
".sh",
"copy $< >$@",
#ifdef VMS
".obj.exe",
"$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
".mar.exe",
"$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
".s.o",
"$(COMPILE.s) -o $@ $<",
".s.exe",
"$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
".c.exe",
@ -206,8 +149,6 @@ static const char *const default_suffix_rules[] =
"$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
".c.obj",
"$(COMPILE.c) /obj=$@ $<",
".c.o",
"$(COMPILE.c) /obj=$@ $<",
".cc.ii",
"$(COMPILE.cc)/prep /list=$@ $<",
".cc.ss",
@ -216,20 +157,12 @@ static const char *const default_suffix_rules[] =
"$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
".cc.obj",
"$(COMPILE.cc) /obj=$@ $<",
".cc.o",
"$(COMPILE.cc) /obj=$@ $<",
".cxx.obj",
"$(COMPILE.cxx) /obj=$@ $<",
".cxx.o",
"$(COMPILE.cxx) /obj=$@ $<",
".for.obj",
"$(COMPILE.for) /obj=$@ $<",
".for.o",
"$(COMPILE.for) /obj=$@ $<",
".pas.obj",
"$(COMPILE.pas) /obj=$@ $<",
".pas.o",
"$(COMPILE.pas) /obj=$@ $<",
".y.c",
"$(YACC.y) $< \n rename y_tab.c $@",
@ -242,28 +175,7 @@ static const char *const default_suffix_rules[] =
".tex.dvi",
"$(TEX) $<",
".cpp.o",
"$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
".f.o",
"$(COMPILE.f) $(OUTPUT_OPTION) $<",
".m.o",
"$(COMPILE.m) $(OUTPUT_OPTION) $<",
".p.o",
"$(COMPILE.p) $(OUTPUT_OPTION) $<",
".r.o",
"$(COMPILE.r) $(OUTPUT_OPTION) $<",
".mod.o",
"$(COMPILE.mod) -o $@ $<",
".c.ln",
"$(LINT.c) -C$* $<",
".y.ln",
"$(YACC.y) $< \n rename y_tab.c $@",
".l.ln",
"@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
#else /* ! MK_OS_VMS */
#else /* ! VMS */
".o",
"$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
@ -326,19 +238,19 @@ static const char *const default_suffix_rules[] =
".c.ln",
"$(LINT.c) -C$* $<",
".y.ln",
#if MK_OS_DOS
"$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
#else
#ifndef __MSDOS__
"$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
#else
"$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
#endif
".l.ln",
"@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
".y.c",
#if MK_OS_DOS
"$(YACC.y) $< \n mv -f y_tab.c $@",
#else
#ifndef __MSDOS__
"$(YACC.y) $< \n mv -f y.tab.c $@",
#else
"$(YACC.y) $< \n mv -f y_tab.c $@",
#endif
".l.c",
"@$(RM) $@ \n $(LEX.l) $< > $@",
@ -393,14 +305,14 @@ static const char *const default_suffix_rules[] =
".web.tex",
"$(WEAVE) $<",
#endif /* !MK_OS_VMS */
#endif /* !VMS */
0, 0,
};
static const char *const default_variables[] =
static const char *default_variables[] =
{
#if MK_OS_VMS
#ifdef VMS
#ifdef __ALPHA
"ARCH", "ALPHA",
#endif
@ -410,8 +322,7 @@ static const char *const default_variables[] =
#ifdef __VAX
"ARCH", "VAX",
#endif
"AR", "library",
"LIBRARY", "library",
"AR", "library/obj",
"ARFLAGS", "/replace",
"AS", "macro",
"MACRO", "macro",
@ -421,21 +332,15 @@ static const char *const default_variables[] =
"CC", "cc",
#endif
"CD", "builtin_cd",
"ECHO", "builtin_echo",
"MAKE", "make",
"ECHO", "write sys$$output \"",
#ifdef GCC_IS_NATIVE
"C++", "gcc/plus",
"CXX", "gcc/plus",
#else
"C++", "cxx",
"CXX", "cxx",
#ifndef __ia64
"CXXLD", "cxxlink",
"CXXLINK", "cxxlink",
#else
/* CXXLINK is not used on VMS/IA64 */
"CXXLD", "link",
"CXXLINK", "link",
#endif
#endif
"CO", "co",
"CPP", "$(CC) /preprocess_only",
@ -471,80 +376,43 @@ static const char *const default_variables[] =
"LDLIBS", "",
#endif
"LINK.o", "$(LD) $(LDFLAGS)",
"LINK.obj", "$(LD) $(LDFLAGS)",
#ifndef GCC_IS_NATIVE
"CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
"COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
#endif
"COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
"LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
"COMPILE.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
"LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
"COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
"COMPILE.C", "$(COMPILE.cc)",
"COMPILE.cpp", "$(COMPILE.cc)",
"LINK.C", "$(LINK.cc)",
"LINK.cpp", "$(LINK.cc)",
"YACC.y", "$(YACC) $(YFLAGS)",
"LEX.l", "$(LEX) $(LFLAGS)",
"YACC.m", "$(YACC) $(YFLAGS)",
"LEX.m", "$(LEX) $(LFLAGS) -t",
"COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
"COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
"LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
"COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
"LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
"COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
"LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
"COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
"COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
"COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
"COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
"LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
"COMPILE.mar", "$(MACRO) $(MACROFLAGS)",
"COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
"LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
"COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
"PREPROCESS.S", "$(CPP) $(CPPFLAGS)",
"PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
"PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
"LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
"MV", "rename/new_version",
"CP", "copy",
".LIBPATTERNS", "%.olb lib%.a",
#else /* !MK_OS_VMS */
#else /* !VMS */
"AR", "ar",
#ifdef _AIX
/* AIX requires object file format specification: choose -Xany. */
"ARFLAGS", "-Xany -rv",
#else
"ARFLAGS", "-rv",
#endif
"ARFLAGS", "rv",
"AS", "as",
#ifdef GCC_IS_NATIVE
"CC", "gcc",
# ifdef __MSDOS__
"CXX", "gpp", /* g++ is an invalid name on MSDOS */
# else
"CXX", "gcc",
# endif /* __MSDOS__ */
"OBJC", "gcc",
#else
"CC", "cc",
"CXX", "g++",
"OBJC", "cc",
#endif
#ifdef MAKE_CXX
"CXX", MAKE_CXX,
#else
# ifdef GCC_IS_NATIVE
# ifdef MK_OS_DOS
"CXX", "gpp", /* g++ is an invalid name on MSDOS */
# else
"CXX", "gcc",
# endif /* __MSDOS__ */
# else
"CXX", "g++",
# endif
#endif
/* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
and to the empty string if $@ does exist. */
"CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
@ -552,17 +420,17 @@ static const char *const default_variables[] =
"COFLAGS", "",
"CPP", "$(CC) -E",
#ifdef CRAY
#ifdef CRAY
"CF77PPFLAGS", "-P",
"CF77PP", "/lib/cpp",
"CFT", "cft77",
"CF", "cf77",
"FC", "$(CF)",
#else /* Not CRAY. */
#ifdef _IBMR2
#else /* Not CRAY. */
#ifdef _IBMR2
"FC", "xlf",
#else
#ifdef __convex__
#ifdef __convex__
"FC", "fc",
#else
"FC", "f77",
@ -582,10 +450,10 @@ static const char *const default_variables[] =
#endif
"LINT", "lint",
"M2C", "m2c",
#ifdef pyr
#ifdef pyr
"PC", "pascal",
#else
#ifdef CRAY
#ifdef CRAY
"PC", "PASCAL",
"SEGLDR", "segldr",
#else
@ -613,21 +481,10 @@ static const char *const default_variables[] =
"COMPILE.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
"LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
"COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
#ifndef HAVE_CASE_INSENSITIVE_FS
/* On case-insensitive filesystems, treat *.C files as *.c files,
to avoid erroneously compiling C sources as C++, which will
probably fail. */
"COMPILE.C", "$(COMPILE.cc)",
#else
"COMPILE.C", "$(COMPILE.c)",
#endif
"COMPILE.cpp", "$(COMPILE.cc)",
"LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
#ifndef HAVE_CASE_INSENSITIVE_FS
"LINK.C", "$(LINK.cc)",
#else
"LINK.C", "$(LINK.c)",
#endif
"LINK.cpp", "$(LINK.cc)",
"YACC.y", "$(YACC) $(YFLAGS)",
"LEX.l", "$(LEX) $(LFLAGS) -t",
@ -647,7 +504,7 @@ static const char *const default_variables[] =
"COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
"LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
"COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
"PREPROCESS.S", "$(CPP) $(CPPFLAGS)",
"PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
"PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
"PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
"LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
@ -656,23 +513,23 @@ static const char *const default_variables[] =
"OUTPUT_OPTION", "-o $@",
#endif
#ifdef SCCS_GET_MINUS_G
#ifdef SCCS_GET_MINUS_G
"SCCS_OUTPUT_OPTION", "-G$@",
#endif
#if MK_OS_DOS
#if defined(_AMIGA)
".LIBPATTERNS", "%.lib",
#elif defined(__MSDOS__)
".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
#elif defined(__APPLE__)
".LIBPATTERNS", "lib%.dylib lib%.a",
#elif defined(__CYGWIN__) || MK_OS_W32
".LIBPATTERNS", "lib%.dll.a %.dll.a lib%.a %.lib lib%.dll %.dll",
#else
".LIBPATTERNS", "lib%.so lib%.a",
#endif
#endif /* !MK_OS_VMS */
#endif /* !VMS */
/* Make this assignment to avoid undefined variable warnings. */
GNUMAKEFLAGS_NAME, "",
"GNUMAKEFLAGS", "",
0, 0
};
@ -689,8 +546,8 @@ set_default_suffixes (void)
else
{
struct dep *d;
const char *p = default_suffixes;
suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ ((char **)&p, struct dep),
char *p = default_suffixes;
suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ (&p, struct dep),
NULL);
for (d = suffix_file->deps; d; d = d->next)
d->file->builtin = 1;
@ -705,9 +562,9 @@ set_default_suffixes (void)
installed after. */
void
install_default_suffix_rules ()
install_default_suffix_rules (void)
{
const char *const *s;
char **s;
if (no_builtin_rules_flag)
return;
@ -715,16 +572,14 @@ install_default_suffix_rules ()
for (s = default_suffix_rules; *s != 0; s += 2)
{
struct file *f = enter_file (strcache_add (s[0]));
/* Install the default rule only if there is no user defined rule. */
if (!f->cmds)
{
f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = NULL;
f->cmds->commands = xstrdup (s[1]);
f->cmds->command_lines = NULL;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1;
}
/* This function should run before any makefile is parsed. */
assert (f->cmds == 0);
f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = 0;
f->cmds->commands = s[1];
f->cmds->command_lines = 0;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1;
}
}
@ -734,7 +589,7 @@ install_default_suffix_rules ()
void
install_default_implicit_rules (void)
{
const struct pspec *p;
struct pspec *p;
if (no_builtin_rules_flag)
return;
@ -749,7 +604,7 @@ install_default_implicit_rules (void)
void
define_default_variables (void)
{
const char *const *s;
const char **s;
if (no_builtin_variables_flag)
return;
@ -761,8 +616,8 @@ define_default_variables (void)
void
undefine_default_variables (void)
{
const char *const *s;
const char **s;
for (s = default_variables; *s != 0; s += 2)
undefine_variable_global (NILF, s[0], strlen (s[0]), o_default);
undefine_variable_global (s[0], strlen (s[0]), o_default);
}

92
dep.h Normal file
View File

@ -0,0 +1,92 @@
/* Definitions of dependency data structures for GNU Make.
Copyright (C) 1988-2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>. */
/* Flag bits for the second argument to 'read_makefile'.
These flags are saved in the 'changed' field of each
'struct dep' in the chain returned by 'read_all_makefiles'. */
#define RM_NO_DEFAULT_GOAL (1 << 0) /* Do not set default goal. */
#define RM_INCLUDED (1 << 1) /* Search makefile search path. */
#define RM_DONTCARE (1 << 2) /* No error if it doesn't exist. */
#define RM_NO_TILDE (1 << 3) /* Don't expand ~ in file name. */
#define RM_NOFLAG 0
/* Structure representing one dependency of a file.
Each struct file's 'deps' points to a chain of these,
chained through the 'next'. 'stem' is the stem for this
dep line of static pattern rule or NULL.
Note that the first two words of this match a struct nameseq. */
struct dep
{
struct dep *next;
const char *name;
const char *stem;
struct file *file;
unsigned int changed : 8;
unsigned int ignore_mtime : 1;
unsigned int staticpattern : 1;
unsigned int need_2nd_expansion : 1;
unsigned int dontcare : 1;
};
/* Structure used in chains of names, for parsing and globbing. */
struct nameseq
{
struct nameseq *next;
const char *name;
};
#define PARSEFS_NONE 0x0000
#define PARSEFS_NOSTRIP 0x0001
#define PARSEFS_NOAR 0x0002
#define PARSEFS_NOGLOB 0x0004
#define PARSEFS_EXISTS 0x0008
#define PARSEFS_NOCACHE 0x0010
#define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
(_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
#define PARSE_SIMPLE_SEQ(_s,_t) \
(_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE)
#ifdef VMS
void *parse_file_seq ();
#else
void *parse_file_seq (char **stringp, unsigned int size,
int stopmap, const char *prefix, int flags);
#endif
char *tilde_expand (const char *name);
#ifndef NO_ARCHIVES
struct nameseq *ar_glob (const char *arname, const char *member_pattern, unsigned int size);
#endif
#define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
#define alloc_dep() (xcalloc (sizeof (struct dep)))
#define free_ns(_n) free (_n)
#define free_dep(_d) free_ns (_d)
struct dep *copy_dep_chain (const struct dep *d);
void free_dep_chain (struct dep *d);
void free_ns_chain (struct nameseq *n);
struct dep *read_all_makefiles (const char **makefiles);
void eval_buffer (char *buffer, const gmk_floc *floc);
enum update_status update_goal_chain (struct dep *goals);

File diff suppressed because it is too large Load Diff

4
doc/.gitignore vendored
View File

@ -1,7 +1,3 @@
manual/
make.t2d/
make.t2p/
gendocs_template
fdl.texi
make-stds.texi
stamp-vti

View File

@ -1,5 +1,5 @@
# -*-Makefile-*-, or close enough
# Copyright (C) 2000-2024 Free Software Foundation, Inc.
# Copyright (C) 2000-2013 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
@ -13,7 +13,7 @@
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.
# this program. If not, see <http://www.gnu.org/licenses/>.
TEXI2HTML = texi2html
TEXI2HTML_FLAGS = -split_chapter
@ -22,3 +22,14 @@ info_TEXINFOS = make.texi
make_TEXINFOS = fdl.texi make-stds.texi
CLEANFILES = make*.html
## ----------------------------- ##
## Other documentation formats. ##
## ----------------------------- ##
html: make_1.html
make_1.html: $(info_TEXINFOS) $(make_TEXINFOS)
$(TEXI2HTML) $(TEXI2HTML_FLAGS) $(srcdir)/make.texi
.PHONY: html

File diff suppressed because it is too large Load Diff

65
dosbuild.bat Normal file
View File

@ -0,0 +1,65 @@
@echo off
rem Copyright (C) 1998-2013 Free Software Foundation, Inc.
rem This file is part of GNU Make.
rem
rem GNU Make is free software; you can redistribute it and/or modify it under
rem the terms of the GNU General Public License as published by the Free
rem Software Foundation; either version 3 of the License, or (at your option)
rem any later version.
rem
rem GNU Make is distributed in the hope that it will be useful, but WITHOUT
rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
rem more details.
rem
rem You should have received a copy of the GNU General Public License along
rem with this program. If not, see <http://www.gnu.org/licenses/>.
echo Building Make for MSDOS
rem Echo ON so they will see what is going on.
@echo on
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g commands.c -o commands.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g output.c -o output.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g job.c -o job.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g dir.c -o dir.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g file.c -o file.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g misc.c -o misc.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g main.c -o main.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -DINCLUDEDIR=\"c:/djgpp/include\" -O2 -g read.c -o read.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -DLIBDIR=\"c:/djgpp/lib\" -O2 -g remake.c -o remake.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g rule.c -o rule.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g implicit.c -o implicit.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g default.c -o default.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g variable.c -o variable.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g expand.c -o expand.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g function.c -o function.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g vpath.c -o vpath.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g hash.c -o hash.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g strcache.c -o strcache.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g version.c -o version.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g ar.c -o ar.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g arscan.c -o arscan.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g signame.c -o signame.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g remote-stub.c -o remote-stub.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt.c -o getopt.o
gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g getopt1.c -o getopt1.o
@cd glob
@if exist libglob.a del libglob.a
gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g glob.c -o glob.o
gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g fnmatch.c -o fnmatch.o
ar rv libglob.a glob.o fnmatch.o
@echo off
cd ..
echo commands.o > respf.$$$
for %%f in (job output dir file misc main read remake rule implicit default variable) do echo %%f.o >> respf.$$$
for %%f in (expand function vpath hash strcache version ar arscan signame remote-stub getopt getopt1) do echo %%f.o >> respf.$$$
echo glob/libglob.a >> respf.$$$
rem gcc -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g guile.c -o guile.o
rem echo guile.o >> respf.$$$
@echo Linking...
@echo on
gcc -o make.new @respf.$$$
@if exist make.exe echo Make.exe is now built!
@if not exist make.exe echo Make.exe build failed...
@if exist make.exe del respf.$$$

View File

@ -1,5 +1,5 @@
/* Variable expansion functions for GNU Make.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2013 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
@ -12,23 +12,21 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include <assert.h>
#include "commands.h"
#include "debug.h"
#include "filedef.h"
#include "job.h"
#include "commands.h"
#include "variable.h"
#include "rule.h"
#include "warning.h"
/* Initially, any errors reported when expanding strings will be reported
against the file where the error appears. */
const floc **expanding_var = &reading_file;
const gmk_floc **expanding_var = &reading_file;
/* The next two describe the variable output buffer.
This buffer is used to hold the variable-expansion of a line of the
@ -44,98 +42,52 @@ const floc **expanding_var = &reading_file;
#define VARIABLE_BUFFER_ZONE 5
static size_t variable_buffer_length;
static unsigned int variable_buffer_length;
char *variable_buffer;
/* Append LENGTH chars of STRING at PTR which must point into variable_buffer.
The buffer will always be kept nul-terminated.
The updated pointer into the buffer is returned as the value. Thus, the
value returned by each call to variable_buffer_output should be the first
argument to the following call. */
/* Subroutine of variable_expand and friends:
The text to add is LENGTH chars starting at STRING to the variable_buffer.
The text is added to the buffer at PTR, and the updated pointer into
the buffer is returned as the value. Thus, the value returned by
each call to variable_buffer_output should be the first argument to
the following call. */
char *
variable_buffer_output (char *ptr, const char *string, size_t length)
variable_buffer_output (char *ptr, const char *string, unsigned int length)
{
size_t newlen = length + (ptr - variable_buffer);
register unsigned int newlen = length + (ptr - variable_buffer);
assert (ptr >= variable_buffer);
assert (ptr < variable_buffer + variable_buffer_length);
if (newlen + VARIABLE_BUFFER_ZONE + 1 > variable_buffer_length)
if ((newlen + VARIABLE_BUFFER_ZONE) > variable_buffer_length)
{
size_t offset = ptr - variable_buffer;
unsigned int offset = ptr - variable_buffer;
variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length
? newlen + 100
: 2 * variable_buffer_length);
variable_buffer = xrealloc (variable_buffer, variable_buffer_length + 1);
variable_buffer = xrealloc (variable_buffer, variable_buffer_length);
ptr = variable_buffer + offset;
}
ptr = mempcpy (ptr, string, length);
*ptr = '\0';
return ptr;
memcpy (ptr, string, length);
return ptr + length;
}
/* Return a pointer to the beginning of the variable buffer.
This is called from main() and it should never be null afterward. */
/* Return a pointer to the beginning of the variable buffer. */
char *
initialize_variable_output ()
static char *
initialize_variable_output (void)
{
/* If we don't have a variable output buffer yet, get one. */
if (!variable_buffer)
if (variable_buffer == 0)
{
variable_buffer_length = 200;
variable_buffer = xmalloc (variable_buffer_length);
variable_buffer[0] = '\0';
}
variable_buffer[0] = '\0';
return variable_buffer;
}
/* Install a new variable_buffer context, returning the current one for
safe-keeping. */
void
install_variable_buffer (char **bufp, size_t *lenp)
{
*bufp = variable_buffer;
*lenp = variable_buffer_length;
variable_buffer = NULL;
initialize_variable_output ();
}
/* Free the current variable_buffer and restore a previously-saved one.
*/
void
restore_variable_buffer (char *buf, size_t len)
{
free (variable_buffer);
variable_buffer = buf;
variable_buffer_length = len;
}
/* Restore a previously-saved variable_buffer context, and return the
current one.
*/
char *
swap_variable_buffer (char *buf, size_t len)
{
char *p = variable_buffer;
variable_buffer = buf;
variable_buffer_length = len;
return p;
}
/* Recursively expand V. The returned string is malloc'd. */
static char *allocated_variable_append (const struct variable *v);
@ -144,34 +96,10 @@ char *
recursively_expand_for_file (struct variable *v, struct file *file)
{
char *value;
const floc *this_var;
const floc **saved_varp;
struct variable_set_list *savev = 0;
const gmk_floc *this_var;
const gmk_floc **saved_varp;
struct variable_set_list *save = 0;
int set_reading = 0;
size_t nl = strlen (v->name);
struct variable *parent = NULL;
/* If we're expanding to put into the environment of a shell function then
ignore any recursion issues: for backward-compatibility we will use
the value of the environment variable we were started with. */
if (v->expanding && env_recursion)
{
char **ep;
DB (DB_VERBOSE,
(_("%s:%lu: not recursively expanding %s to export to shell function\n"),
v->fileinfo.filenm, v->fileinfo.lineno, v->name));
/* We could create a hash for the original environment for speed, but a
reasonably written makefile shouldn't hit this situation... */
for (ep = environ; *ep != 0; ++ep)
if (strncmp (*ep, v->name, nl) == 0 && (*ep)[nl] == '=')
return xstrdup ((*ep) + nl + 1);
/* If there's nothing in the parent environment, use the empty string.
This isn't quite correct since the variable should not exist at all,
but getting that to work would be involved. */
return xstrdup ("");
}
/* Don't install a new location if this location is empty.
This can happen for command-line variables, builtin variables, etc. */
@ -193,204 +121,99 @@ recursively_expand_for_file (struct variable *v, struct file *file)
{
if (!v->exp_count)
/* Expanding V causes infinite recursion. Lose. */
OS (fatal, *expanding_var,
_("recursive variable '%s' references itself (eventually)"),
v->name);
fatal (*expanding_var,
_("Recursive variable '%s' references itself (eventually)"),
v->name);
--v->exp_count;
}
if (file)
install_file_context (file, &savev, NULL);
{
save = current_variable_set_list;
current_variable_set_list = file->variables;
}
v->expanding = 1;
if (v->append)
{
/* Find a parent definition which is marked override. */
struct variable_set_list *sl;
for (sl = current_variable_set_list; sl && !parent; sl = sl->next)
{
struct variable *vp = lookup_variable_in_set (v->name, nl, sl->set);
if (vp && vp != v && vp->origin == o_override)
parent = vp;
}
}
if (parent)
/* PARENT is an override, V is appending. If V is also an override:
override hello := first
al%: override hello += second
Then construct the value from its appended parts in the parent sets.
Else if V is not an override:
override hello := first
al%: hello += second
Then ignore the value of V and use the value of PARENT. */
value = v->origin == o_override
? allocated_variable_append (v)
: xstrdup (parent->value);
else if (v->origin == o_command || v->origin == o_env_override)
/* Avoid appending to a pattern-specific variable, unless the origin of this
pattern-specific variable beats or equals the origin of one of the parent
definitions of this variable.
This is needed, because if there is a command line definition or an env
override, then the value defined in the makefile should only be appended
in the case of a file override.
In the presence of command line definition or env override and absence of
makefile override, the value should be expanded, rather than appended. In
this case, at parse time record_target_var already set the value of this
pattern-specific variable to the value defined on the command line or to
the env override value.
User provided a command line definition or an env override.
PARENT does not have an override directive, so ignore it. */
value = allocated_expand_string (v->value);
else if (v->append)
/* Construct the value from its appended parts in the parent sets. */
value = allocated_variable_append (v);
else
/* A definition without appending. */
value = allocated_expand_string (v->value);
value = allocated_variable_expand (v->value);
v->expanding = 0;
if (set_reading)
reading_file = 0;
if (file)
restore_file_context (savev, NULL);
current_variable_set_list = save;
expanding_var = saved_varp;
return value;
}
/* Expand a simple reference to variable NAME, which is LENGTH chars long.
The result is written to PTR which must point into the variable_buffer.
Returns a pointer to the new end of the variable_buffer. */
/* Expand a simple reference to variable NAME, which is LENGTH chars long. */
char *
expand_variable_output (char *ptr, const char *name, size_t length)
#ifdef __GNUC__
__inline
#endif
static char *
reference_variable (char *o, const char *name, unsigned int length)
{
struct variable *v;
unsigned int recursive;
char *value;
v = lookup_variable (name, length);
if (!v)
if (v == 0)
warn_undefined (name, length);
/* If there's no variable by that name or it has no value, stop now. */
if (!v || (v->value[0] == '\0' && !v->append))
return ptr;
if (v == 0 || (*v->value == '\0' && !v->append))
return o;
/* Remember this since expansion could change it. */
recursive = v->recursive;
value = (v->recursive ? recursively_expand (v) : v->value);
value = recursive ? recursively_expand (v) : v->value;
o = variable_buffer_output (o, value, strlen (value));
ptr = variable_buffer_output (ptr, value, strlen (value));
if (recursive)
if (v->recursive)
free (value);
return ptr;
}
/* Expand a simple reference to variable NAME, which is LENGTH chars long.
The result is written to BUF which must point into the variable_buffer.
If BUF is NULL, start at the beginning of the current variable_buffer.
Returns a pointer to the START of the expanded value of the variable.
The returned value is located inside variable_buffer.
The returned value is valid until the next call to one of the functions
which use variable_buffer. expand_variable_buf may reallocate
variable_buffer and render the passed-in BUF invalid. */
char *
expand_variable_buf (char *buf, const char *name, size_t length)
{
size_t offs;
if (!buf)
buf = initialize_variable_output ();
assert (buf >= variable_buffer);
assert (buf < variable_buffer + variable_buffer_length);
offs = buf - variable_buffer;
expand_variable_output (buf, name, length);
return variable_buffer + offs;
}
/* Expand a simple reference to variable NAME, which is LENGTH chars long.
Returns an allocated buffer containing the value. */
char *
allocated_expand_variable (const char *name, size_t length)
{
char *obuf;
size_t olen;
install_variable_buffer (&obuf, &olen);
expand_variable_output (variable_buffer, name, length);
return swap_variable_buffer (obuf, olen);
}
/* Expand a simple reference to variable NAME, which is LENGTH chars long.
Error messages refer to the file and line where FILE's commands were found.
Expansion uses FILE's variable set list.
Returns an allocated buffer containing the value. */
char *
allocated_expand_variable_for_file (const char *name, size_t length, struct file *file)
{
char *result;
struct variable_set_list *savev;
const floc *savef;
if (!file)
return allocated_expand_variable (name, length);
install_file_context (file, &savev, &savef);
result = allocated_expand_variable (name, length);
restore_file_context (savev, savef);
return result;
return o;
}
/* Scan STRING for variable references and expansion-function calls. Only
LENGTH bytes of STRING are actually scanned.
If LENGTH is SIZE_MAX, scan until a null byte is found.
LENGTH bytes of STRING are actually scanned. If LENGTH is -1, scan until
a null byte is found.
Write the results to BUF, which must point into variable_buffer. If
BUF is NULL, start at the beginning of the current variable_buffer.
Return a pointer to BUF, or to the beginning of the new buffer if BUF is
Write the results to LINE, which must point into 'variable_buffer'. If
LINE is NULL, start at the beginning of the buffer.
Return a pointer to LINE, or to the beginning of the buffer if LINE is
NULL.
*/
char *
expand_string_buf (char *buf, const char *string, size_t length)
variable_expand_string (char *line, const char *string, long length)
{
struct variable *v;
const char *p, *p1;
char *save;
char *o;
size_t line_offset;
unsigned int line_offset;
if (!buf)
buf = initialize_variable_output ();
o = buf;
line_offset = buf - variable_buffer;
if (!line)
line = initialize_variable_output ();
o = line;
line_offset = line - variable_buffer;
if (length == 0)
return variable_buffer;
{
variable_buffer_output (o, "", 1);
return (variable_buffer);
}
/* We need a copy of STRING: due to eval, it's possible that it will get
freed as we process it (it might be the value of a variable that's reset
for example). Also having a nil-terminated string is handy. */
save = length == SIZE_MAX ? xstrdup (string) : xstrndup (string, length);
save = length < 0 ? xstrdup (string) : xstrndup (string, length);
p = save;
while (1)
@ -401,7 +224,7 @@ expand_string_buf (char *buf, const char *string, size_t length)
p1 = strchr (p, '$');
o = variable_buffer_output (o, p, p1 != 0 ? (size_t) (p1 - p) : strlen (p) + 1);
o = variable_buffer_output (o, p, p1 != 0 ? (unsigned int)(p1 - p) : strlen (p) + 1);
if (p1 == 0)
break;
@ -412,10 +235,8 @@ expand_string_buf (char *buf, const char *string, size_t length)
switch (*p)
{
case '$':
case '\0':
/* $$ or $ at the end of the string means output one $ to the
variable output buffer. */
o = variable_buffer_output (o, p1, 1);
/* $$ seen means output one $ to the variable output buffer. */
o = variable_buffer_output (o, p, 1);
break;
case '(':
@ -424,40 +245,47 @@ expand_string_buf (char *buf, const char *string, size_t length)
{
char openparen = *p;
char closeparen = (openparen == '(') ? ')' : '}';
const char *begp;
const char *beg = p + 1;
char *op;
char *abeg = NULL;
const char *end, *colon;
if (handle_function (&o, &p))
break;
op = o;
begp = p;
if (handle_function (&op, &begp))
{
o = op;
p = begp;
break;
}
/* Is there a variable reference inside the parens or braces?
If so, expand it before expanding the entire reference. */
end = strchr (beg, closeparen);
if (end == NULL)
if (end == 0)
/* Unterminated variable reference. */
O (fatal, *expanding_var, _("unterminated variable reference"));
fatal (*expanding_var, _("unterminated variable reference"));
p1 = lindex (beg, end, '$');
if (p1 != NULL)
if (p1 != 0)
{
/* BEG now points past the opening paren or brace.
Count parens or braces until it is matched. */
int count = 1;
int count = 0;
for (p = beg; *p != '\0'; ++p)
{
if (*p == openparen)
++count;
else if (*p == closeparen && --count == 0)
else if (*p == closeparen && --count < 0)
break;
}
/* If COUNT is > 0, there were unmatched opening parens
/* 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)
if (count < 0)
{
/* Expand the name. */
abeg = expand_argument (beg, p);
abeg = expand_argument (beg, p); /* Expand the name. */
beg = abeg;
end = strchr (beg, '\0');
}
@ -547,19 +375,23 @@ expand_string_buf (char *buf, const char *string, size_t length)
if (colon == 0)
/* This is an ordinary variable reference.
Look up the value of the variable. */
o = expand_variable_output (o, beg, end - beg);
o = reference_variable (o, beg, end - beg);
if (abeg)
free (abeg);
}
break;
case '\0':
break;
default:
if (ISSPACE (p[-1]))
if (isblank ((unsigned char)p[-1]))
break;
/* A $ followed by a random char is a variable reference:
$a is equivalent to $(a). */
o = expand_variable_output (o, p, 1);
o = reference_variable (o, p, 1);
break;
}
@ -572,10 +404,21 @@ expand_string_buf (char *buf, const char *string, size_t length)
free (save);
variable_buffer_output (o, "", 1);
return (variable_buffer + line_offset);
}
/* Scan LINE for variable references and expansion-function calls.
Build in 'variable_buffer' the result of expanding the references and calls.
Return the address of the resulting string, which is null-terminated
and is valid only until the next time this function is called. */
char *
variable_expand (const char *line)
{
return variable_expand_string (NULL, line, (long)-1);
}
/* Expand an argument for an expansion function.
The text starting at STR and ending at END is variable-expanded
into a null-terminated string that is returned as the value.
@ -592,7 +435,7 @@ expand_argument (const char *str, const char *end)
return xstrdup ("");
if (!end || *end == '\0')
return allocated_expand_string (str);
return allocated_variable_expand (str);
if (end - str + 1 > 1000)
tmp = alloc = xmalloc (end - str + 1);
@ -602,71 +445,61 @@ expand_argument (const char *str, const char *end)
memcpy (tmp, str, end - str);
tmp[end - str] = '\0';
r = allocated_expand_string (tmp);
r = allocated_variable_expand (tmp);
free (alloc);
if (alloc)
free (alloc);
return r;
}
/* Expand STRING for FILE, into the current variable_buffer.
Error messages refer to the file and line where FILE's commands were found.
Expansion uses FILE's variable set list. */
/* Expand LINE for FILE. Error messages refer to the file and line where
FILE's commands were found. Expansion uses FILE's variable set list. */
char *
expand_string_for_file (const char *string, struct file *file)
variable_expand_for_file (const char *line, struct file *file)
{
char *result;
struct variable_set_list *savev;
const floc *savef;
const gmk_floc *savef;
if (!file)
return expand_string (string);
if (file == 0)
return variable_expand (line);
install_file_context (file, &savev, &savef);
savev = current_variable_set_list;
current_variable_set_list = file->variables;
result = expand_string (string);
savef = reading_file;
if (file->cmds && file->cmds->fileinfo.filenm)
reading_file = &file->cmds->fileinfo;
else
reading_file = 0;
restore_file_context (savev, savef);
result = variable_expand (line);
current_variable_set_list = savev;
reading_file = savef;
return result;
}
/* Like expand_string_for_file, but the returned string is malloc'd. */
char *
allocated_expand_string_for_file (const char *string, struct file *file)
{
char *obuf;
size_t olen;
install_variable_buffer (&obuf, &olen);
expand_string_for_file (string, file);
return swap_variable_buffer (obuf, olen);
}
/* Like allocated_expand_string, but for += target-specific variables.
/* Like allocated_variable_expand, but for += target-specific variables.
First recursively construct the variable value from its appended parts in
any upper variable sets. Then expand the resulting value. */
static char *
variable_append (const char *name, size_t length,
variable_append (const char *name, unsigned int length,
const struct variable_set_list *set, int local)
{
const struct variable *v;
char *buf = 0;
int nextlocal;
/* If this set is local and the next is not a parent, then next is local. */
int nextlocal = local && set->next_is_parent == 0;
/* If there's nothing left to check, return the empty buffer. */
if (!set)
return initialize_variable_output ();
/* If this set is local and the next is not a parent, then next is local. */
nextlocal = local && set->next_is_parent == 0;
/* Try to find the variable in this variable set. */
v = lookup_variable_in_set (name, length, set->set);
@ -690,7 +523,7 @@ variable_append (const char *name, size_t length,
if (! v->recursive)
return variable_buffer_output (buf, v->value, strlen (v->value));
buf = expand_string_buf (buf, v->value, strlen (v->value));
buf = variable_expand_string (buf, v->value, strlen (v->value));
return (buf + strlen (buf));
}
@ -698,13 +531,68 @@ variable_append (const char *name, size_t length,
static char *
allocated_variable_append (const struct variable *v)
{
char *val;
/* Construct the appended variable value. */
char *obuf;
size_t olen;
install_variable_buffer (&obuf, &olen);
char *obuf = variable_buffer;
unsigned int olen = variable_buffer_length;
variable_append (v->name, strlen (v->name), current_variable_set_list, 1);
variable_buffer = 0;
return swap_variable_buffer (obuf, olen);
val = variable_append (v->name, strlen (v->name),
current_variable_set_list, 1);
variable_buffer_output (val, "", 1);
val = variable_buffer;
variable_buffer = obuf;
variable_buffer_length = olen;
return val;
}
/* Like variable_expand_for_file, but the returned string is malloc'd.
This function is called a lot. It wants to be efficient. */
char *
allocated_variable_expand_for_file (const char *line, struct file *file)
{
char *value;
char *obuf = variable_buffer;
unsigned int olen = variable_buffer_length;
variable_buffer = 0;
value = variable_expand_for_file (line, file);
variable_buffer = obuf;
variable_buffer_length = olen;
return value;
}
/* Install a new variable_buffer context, returning the current one for
safe-keeping. */
void
install_variable_buffer (char **bufp, unsigned int *lenp)
{
*bufp = variable_buffer;
*lenp = variable_buffer_length;
variable_buffer = 0;
initialize_variable_output ();
}
/* Restore a previously-saved variable_buffer setting (free the current one).
*/
void
restore_variable_buffer (char *buf, unsigned int len)
{
free (variable_buffer);
variable_buffer = buf;
variable_buffer_length = len;
}

View File

@ -1,5 +1,5 @@
/* Target file management for GNU Make.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2013 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
@ -12,21 +12,19 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include <assert.h>
#include "filedef.h"
#include "dep.h"
#include "filedef.h"
#include "job.h"
#include "commands.h"
#include "variable.h"
#include "debug.h"
#include "hash.h"
#include "shuffle.h"
#include "rule.h"
/* Remember whether snap_deps has been invoked: we need this to be sure we
@ -59,16 +57,11 @@ file_hash_cmp (const void *x, const void *y)
((struct file const *) y)->hname);
}
#ifndef FILE_BUCKETS
#define FILE_BUCKETS 1007
#endif
static struct hash_table files;
/* We can't free files we take out of the hash table, because they are still
likely pointed to in various places. The check_renamed() will be used if
we come across these, to find the new correct file. This is mainly to
prevent leak checkers from complaining. */
static struct file **rehashed_files = NULL;
static size_t rehashed_files_len = 0;
#define REHASHED_FILES_INCR 5
/* Whether or not .SECONDARY with no prerequisites was given. */
static int all_secondary = 0;
@ -82,11 +75,8 @@ lookup_file (const char *name)
{
struct file *f;
struct file file_key;
#if MK_OS_VMS
int want_vmsify;
#ifndef WANT_CASE_SENSITIVE_TARGETS
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS)
char *lname;
#endif
#endif
assert (*name != '\0');
@ -94,8 +84,7 @@ lookup_file (const char *name)
/* This is also done in parse_file_seq, so this is redundant
for names read from makefiles. It is here for names passed
on the command line. */
#if MK_OS_VMS
want_vmsify = (strpbrk (name, "]>:^") != NULL);
#ifdef VMS
# ifndef WANT_CASE_SENSITIVE_TARGETS
if (*name != '.')
{
@ -111,30 +100,38 @@ lookup_file (const char *name)
while (name[0] == '[' && name[1] == ']' && name[2] != '\0')
name += 2;
while (name[0] == '<' && name[1] == '>' && name[2] != '\0')
name += 2;
#endif
while (name[0] == '.' && ISDIRSEP (name[1]) && name[2] != '\0')
while (name[0] == '.'
#ifdef HAVE_DOS_PATHS
&& (name[1] == '/' || name[1] == '\\')
#else
&& name[1] == '/'
#endif
&& name[2] != '\0')
{
name += 2;
while (ISDIRSEP (*name))
while (*name == '/'
#ifdef HAVE_DOS_PATHS
|| *name == '\\'
#endif
)
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
++name;
}
if (*name == '\0')
{
/* It was all slashes after a dot. */
name = "./";
#if MK_OS_VMS
/* TODO - This section is probably not needed. */
if (want_vmsify)
name = "[]";
/* It was all slashes after a dot. */
#if defined(VMS)
name = "[]";
#elif defined(_AMIGA)
name = "";
#else
name = "./";
#endif
}
file_key.hname = name;
f = hash_find_item (&files, &file_key);
#if MK_OS_VMS && !defined(WANT_CASE_SENSITIVE_TARGETS)
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS)
if (*name != '.')
free (lname);
#endif
@ -158,7 +155,7 @@ enter_file (const char *name)
assert (*name != '\0');
assert (! verify_flag || strcache_iscached (name));
#if MK_OS_VMS && !defined(WANT_CASE_SENSITIVE_TARGETS)
#if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS)
if (*name != '.')
{
const char *n;
@ -226,7 +223,8 @@ rehash_file (struct file *from_file, const char *to_hname)
/* Find the end of the renamed list for the "from" file. */
file_key.hname = from_file->hname;
check_renamed (from_file);
while (from_file->renamed != 0)
from_file = from_file->renamed;
if (file_hash_cmp (from_file, &file_key))
/* hname changed unexpectedly!! */
abort ();
@ -263,27 +261,24 @@ rehash_file (struct file *from_file, const char *to_hname)
to_file->cmds = from_file->cmds;
else if (from_file->cmds != to_file->cmds)
{
size_t l = strlen (from_file->name);
/* We have two sets of commands. We will go with the
one given in the rule found through directory search,
one given in the rule explicitly mentioning this name,
but give a message to let the user know what's going on. */
if (to_file->cmds->fileinfo.filenm != 0)
error (&from_file->cmds->fileinfo,
l + strlen (to_file->cmds->fileinfo.filenm) + INTSTR_LENGTH,
_("recipe was specified for file '%s' at %s:%lu,"),
from_file->name, from_file->cmds->fileinfo.filenm,
from_file->cmds->fileinfo.lineno);
_("Recipe was specified for file '%s' at %s:%lu,"),
from_file->name, to_file->cmds->fileinfo.filenm,
to_file->cmds->fileinfo.lineno);
else
error (&from_file->cmds->fileinfo, l,
_("recipe for file '%s' was found by implicit rule search,"),
error (&from_file->cmds->fileinfo,
_("Recipe for file '%s' was found by implicit rule search,"),
from_file->name);
l += strlen (to_hname);
error (&from_file->cmds->fileinfo, l,
_("but '%s' is now considered the same file as '%s'"),
from_file->name, to_hname);
error (&from_file->cmds->fileinfo, l,
_("recipe for '%s' will be ignored in favor of the one for '%s'"),
error (&from_file->cmds->fileinfo,
_("but '%s' is now considered the same file as '%s'."),
from_file->name, to_hname);
error (&from_file->cmds->fileinfo,
_("Recipe for '%s' will be ignored in favor of the one for '%s'."),
to_hname, from_file->name);
}
}
@ -302,14 +297,13 @@ rehash_file (struct file *from_file, const char *to_hname)
merge_variable_set_lists (&to_file->variables, from_file->variables);
if (to_file->double_colon && from_file->is_target && !from_file->double_colon)
OSS (fatal, NILF, _("can't rename single-colon '%s' to double-colon '%s'"),
from_file->name, to_hname);
fatal (NILF, _("can't rename single-colon '%s' to double-colon '%s'"),
from_file->name, to_hname);
if (!to_file->double_colon && from_file->double_colon)
{
if (to_file->is_target)
OSS (fatal, NILF,
_("can't rename double-colon '%s' to single-colon '%s'"),
from_file->name, to_hname);
fatal (NILF, _("can't rename double-colon '%s' to single-colon '%s'"),
from_file->name, to_hname);
else
to_file->double_colon = from_file->double_colon;
}
@ -322,30 +316,18 @@ rehash_file (struct file *from_file, const char *to_hname)
#define MERGE(field) to_file->field |= from_file->field
MERGE (precious);
MERGE (loaded);
MERGE (tried_implicit);
MERGE (updating);
MERGE (updated);
MERGE (is_target);
MERGE (cmd_target);
MERGE (phony);
/* Don't merge intermediate because this file might be pre-existing */
MERGE (is_explicit);
MERGE (secondary);
MERGE (notintermediate);
MERGE (loaded);
MERGE (ignore_vpath);
MERGE (snapped);
MERGE (suffix);
#undef MERGE
to_file->builtin = 0;
from_file->renamed = to_file;
if (rehashed_files_len % REHASHED_FILES_INCR == 0)
rehashed_files = xrealloc (rehashed_files,
sizeof (struct file *) * (rehashed_files_len + REHASHED_FILES_INCR));
rehashed_files[rehashed_files_len++] = from_file;
}
/* Rename FILE to NAME. This is not as simple as resetting
@ -376,7 +358,7 @@ remove_intermediates (int sig)
int doneany = 0;
/* If there's no way we will ever remove anything anyway, punt early. */
if (question_flag || touch_flag || all_secondary || no_intermediates)
if (question_flag || touch_flag || all_secondary)
return;
if (sig && just_print_flag)
@ -393,7 +375,7 @@ remove_intermediates (int sig)
given on the command line, and it's either a -include makefile or
it's not precious. */
if (f->intermediate && (f->dontcare || !f->precious)
&& !f->secondary && !f->notintermediate && !f->cmd_target)
&& !f->secondary && !f->cmd_target)
{
int status;
if (f->update_status == us_none)
@ -411,13 +393,12 @@ remove_intermediates (int sig)
if (!f->dontcare)
{
if (sig)
OS (error, NILF,
_("*** deleting intermediate file '%s'"), f->name);
error (NILF, _("*** Deleting intermediate file '%s'"), f->name);
else
{
if (! doneany)
DB (DB_BASIC, (_("Removing intermediate files...\n")));
if (!run_silent)
if (!silent_flag)
{
if (! doneany)
{
@ -431,14 +412,7 @@ remove_intermediates (int sig)
}
}
if (status < 0)
{
if (doneany)
fputs ("\n", stdout);
fflush (stdout);
perror_with_name ("unlink: ", f->name);
/* Start printing over. */
doneany = 0;
}
perror_with_name ("unlink: ", f->name);
}
}
}
@ -456,7 +430,8 @@ remove_intermediates (int sig)
struct dep *
split_prereqs (char *p)
{
struct dep *new = PARSE_FILE_SEQ (&p, struct dep, MAP_PIPE, NULL, PARSEFS_WAIT);
struct dep *new = PARSE_FILE_SEQ (&p, struct dep, MAP_PIPE, NULL,
PARSEFS_NONE);
if (*p)
{
@ -465,7 +440,7 @@ split_prereqs (char *p)
struct dep *ood;
++p;
ood = PARSE_FILE_SEQ (&p, struct dep, MAP_NUL, NULL, PARSEFS_WAIT);
ood = PARSE_SIMPLE_SEQ (&p, struct dep);
if (! new)
new = ood;
@ -499,12 +474,13 @@ enter_prereqs (struct dep *deps, const char *stem)
if (stem)
{
const char *pattern = "%";
char *buffer = variable_expand ("");
struct dep *dp = deps, *dl = 0;
while (dp != 0)
{
char *percent;
size_t nl = strlen (dp->name) + 1;
int nl = strlen (dp->name) + 1;
char *nm = alloca (nl);
memcpy (nm, dp->name, nl);
percent = find_percent (nm);
@ -518,15 +494,14 @@ enter_prereqs (struct dep *deps, const char *stem)
if (stem[0] == '\0')
{
memmove (percent, percent+1, strlen (percent));
o = variable_buffer_output (variable_buffer, nm,
strlen (nm) + 1);
o = variable_buffer_output (buffer, nm, strlen (nm) + 1);
}
else
o = patsubst_expand_pat (variable_buffer, stem, pattern, nm,
o = patsubst_expand_pat (buffer, stem, pattern, nm,
pattern+1, percent+1);
/* If the name expanded to the empty string, ignore it. */
if (variable_buffer[0] == '\0')
if (buffer[0] == '\0')
{
struct dep *df = dp;
if (dp == deps)
@ -538,8 +513,7 @@ enter_prereqs (struct dep *deps, const char *stem)
}
/* Save the name. */
dp->name = strcache_add_len (variable_buffer,
o - variable_buffer);
dp->name = strcache_add_len (buffer, o - buffer);
}
dp->stem = stem;
dp->staticpattern = 1;
@ -559,29 +533,30 @@ enter_prereqs (struct dep *deps, const char *stem)
d1->file = enter_file (d1->name);
d1->staticpattern = 0;
d1->name = 0;
if (!stem)
/* This file is explicitly mentioned as a prereq. */
d1->file->is_explicit = 1;
}
return deps;
}
/* Expand and parse each dependency line.
For each dependency of the file, make the 'struct dep' point
at the appropriate 'struct file' (which may have to be created). */
void
/* Set the intermediate flag. */
static void
set_intermediate (const void *item)
{
struct file *f = (struct file *) item;
f->intermediate = 1;
}
/* Expand and parse each dependency line. */
static void
expand_deps (struct file *f)
{
struct dep *d;
struct dep **dp;
const char *fstem;
const char *file_stem = f->stem;
int initialized = 0;
int changed_dep = 0;
if (f->snapped)
return;
f->snapped = 1;
f->updating = 0;
/* Walk through the dependencies. For any dependency that needs 2nd
expansion, expand it then insert the result into the list. */
@ -591,6 +566,7 @@ expand_deps (struct file *f)
{
char *p;
struct dep *new, *next;
char *name = (char *)d->name;
if (! d->name || ! d->need_2nd_expansion)
{
@ -600,46 +576,16 @@ expand_deps (struct file *f)
continue;
}
/* If it's from a static pattern rule, convert the initial pattern in
each word to "$*" so they'll expand properly. */
/* If it's from a static pattern rule, convert the patterns into
"$*" so they'll expand properly. */
if (d->staticpattern)
{
const char *cs = d->name;
size_t nperc = 0;
/* Count the number of % in the string. */
while ((cs = strchr (cs, '%')) != NULL)
{
++nperc;
++cs;
}
if (nperc)
{
/* Allocate enough space to replace all % with $*. */
size_t slen = strlen (d->name) + nperc + 1;
const char *pcs = d->name;
char *name = xmalloc (slen);
char *s = name;
/* Substitute the first % in each word. */
cs = strchr (pcs, '%');
while (cs)
{
s = mempcpy (s, pcs, cs - pcs);
*(s++) = '$';
*(s++) = '*';
pcs = ++cs;
/* Find the first % after the next whitespace. */
cs = strchr (end_of_token (cs), '%');
}
strcpy (s, pcs);
free ((char*)d->name);
d->name = name;
}
char *o = variable_expand ("");
o = subst_expand (o, name, "%", "$*", 1, 2, 0);
*o = '\0';
free (name);
d->name = name = xstrdup (variable_buffer);
d->staticpattern = 0;
}
/* We're going to do second expansion so initialize file variables for
@ -651,139 +597,54 @@ expand_deps (struct file *f)
initialized = 1;
}
set_file_variables (f, d->stem ? d->stem : f->stem);
if (d->stem != 0)
f->stem = d->stem;
/* Perform second expansion. */
p = expand_string_for_file (d->name, f);
set_file_variables (f);
/* Free the un-expanded name. */
free ((char*)d->name);
p = variable_expand_for_file (d->name, f);
if (d->stem != 0)
f->stem = file_stem;
/* At this point we don't need the name anymore: free it. */
free (name);
/* Parse the prerequisites and enter them into the file database. */
new = split_prereqs (p);
new = enter_prereqs (split_prereqs (p), d->stem);
/* If there were no prereqs here (blank!) then throw this one out. */
if (new == 0)
{
*dp = d->next;
changed_dep = 1;
free_dep (d);
d = *dp;
continue;
}
/* Add newly parsed prerequisites. */
fstem = d->stem;
next = d->next;
changed_dep = 1;
free_dep (d);
*dp = new;
for (dp = &new, d = new; d != 0; dp = &d->next, d = d->next)
{
d->file = lookup_file (d->name);
if (d->file == 0)
d->file = enter_file (d->name);
d->name = 0;
d->stem = fstem;
if (!fstem)
/* This file is explicitly mentioned as a prereq. */
d->file->is_explicit = 1;
}
for (dp = &new->next, d = new->next; d != 0; dp = &d->next, d = d->next)
;
*dp = next;
d = *dp;
}
/* Shuffle mode assumes '->next' and '->shuf' links both traverse the same
dependencies (in different sequences). Regenerate '->shuf' so we don't
refer to stale data. */
if (changed_dep)
shuffle_deps_recursive (f->deps);
}
/* Add extra prereqs to the file in question. */
struct dep *
expand_extra_prereqs (const struct variable *extra)
{
struct dep *d;
struct dep *prereqs = extra ? split_prereqs (expand_string (extra->value)) : NULL;
for (d = prereqs; d; d = d->next)
{
d->file = lookup_file (d->name);
if (!d->file)
d->file = enter_file (d->name);
d->name = NULL;
d->ignore_automatic_vars = 1;
}
return prereqs;
}
/* Perform per-file snap operations. */
/* Reset the updating flag. */
static void
snap_file (const void *item, void *arg)
reset_updating (const void *item)
{
struct file *f = (struct file*)item;
struct dep *prereqs = NULL;
struct dep *d;
/* If we're not doing second expansion then reset updating. */
if (!second_expansion)
f->updating = 0;
/* More specific setting has priority. */
/* If .SECONDARY is set with no deps, mark all targets as intermediate,
unless the target is a prereq of .NOTINTERMEDIATE. */
if (all_secondary && !f->notintermediate)
f->intermediate = 1;
/* If .NOTINTERMEDIATE is set with no deps, mark all targets as
notintermediate, unless the target is a prereq of .INTERMEDIATE. */
if (no_intermediates && !f->intermediate && !f->secondary)
f->notintermediate = 1;
/* If .EXTRA_PREREQS is set, add them as ignored by automatic variables. */
if (f->variables)
{
prereqs = expand_extra_prereqs (lookup_variable_in_set (
STRING_SIZE_TUPLE(".EXTRA_PREREQS"), f->variables->set));
if (second_expansion)
for (d = prereqs; d; d = d->next)
{
if (!d->name)
d->name = xstrdup (d->file->name);
d->need_2nd_expansion = 1;
}
}
else if (f->is_target)
prereqs = copy_dep_chain (arg);
if (prereqs)
{
for (d = prereqs; d; d = d->next)
if (streq (f->name, dep_name (d)))
/* Skip circular dependencies. */
break;
if (d)
/* We broke early: must have found a circular dependency. */
free_dep_chain (prereqs);
else if (!f->deps)
f->deps = prereqs;
else
{
d = f->deps;
while (d->next)
d = d->next;
d->next = prereqs;
}
}
struct file *f = (struct file *) item;
f->updating = 0;
}
/* Mark the files depended on by .PRECIOUS, .PHONY, .SILENT,
/* For each dependency of each file, make the 'struct dep' point
at the appropriate 'struct file' (which may have to be created).
Also mark the files depended on by .PRECIOUS, .PHONY, .SILENT,
and various other special targets. */
void
@ -797,6 +658,40 @@ snap_deps (void)
longer define new targets. */
snapped_deps = 1;
/* Perform second expansion and enter each dependency name as a file. We
must use hash_dump() here because within these loops we likely add new
files to the table, possibly causing an in-situ table expansion.
We only need to do this if second_expansion has been defined; if it
hasn't then all deps were expanded as the makefile was read in. If we
ever change make to be able to unset .SECONDARY_EXPANSION this will have
to change. */
if (second_expansion)
{
struct file **file_slot_0 = (struct file **) hash_dump (&files, 0, 0);
struct file **file_end = file_slot_0 + files.ht_fill;
struct file **file_slot;
const char *suffixes;
/* Expand .SUFFIXES: its prerequisites are used for $$* calc. */
f = lookup_file (".SUFFIXES");
suffixes = f ? f->name : 0;
for (; f != 0; f = f->prev)
expand_deps (f);
/* For every target that's not .SUFFIXES, expand its prerequisites. */
for (file_slot = file_slot_0; file_slot < file_end; file_slot++)
for (f = *file_slot; f != 0; f = f->prev)
if (f->name != suffixes)
expand_deps (f);
free (file_slot_0);
}
else
/* We're not doing second expansion, so reset updating. */
hash_map (&files, reset_updating);
/* Now manage all the special targets. */
for (f = lookup_file (".PRECIOUS"); f != 0; f = f->prev)
@ -820,32 +715,11 @@ snap_deps (void)
f2->mtime_before_update = NONEXISTENT_MTIME;
}
for (f = lookup_file (".NOTINTERMEDIATE"); f != 0; f = f->prev)
/* Mark .NOTINTERMEDIATE deps as notintermediate files. */
if (f->deps)
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
f2->notintermediate = 1;
/* .NOTINTERMEDIATE with no deps marks all files as notintermediate. */
else
no_intermediates = 1;
/* The same file cannot be both .INTERMEDIATE and .NOTINTERMEDIATE.
However, it is possible for a file to be .INTERMEDIATE and also match a
.NOTINTERMEDIATE pattern. In that case, the intermediate file has
priority over the notintermediate pattern. This priority is enforced by
pattern_search. */
for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev)
/* Mark .INTERMEDIATE deps as intermediate files. */
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
if (f2->notintermediate)
OS (fatal, NILF,
_("%s cannot be both .NOTINTERMEDIATE and .INTERMEDIATE"),
f2->name);
else
f2->intermediate = 1;
f2->intermediate = 1;
/* .INTERMEDIATE with no deps does nothing.
Marking all files as intermediates is useless since the goal targets
would be deleted after they are built. */
@ -855,19 +729,13 @@ snap_deps (void)
if (f->deps)
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
if (f2->notintermediate)
OS (fatal, NILF,
_("%s cannot be both .NOTINTERMEDIATE and .SECONDARY"),
f2->name);
else
f2->intermediate = f2->secondary = 1;
/* .SECONDARY with no deps listed marks *all* files that way. */
else
all_secondary = 1;
if (no_intermediates && all_secondary)
O (fatal, NILF,
_(".NOTINTERMEDIATE and .SECONDARY are mutually exclusive"));
{
all_secondary = 1;
hash_map (&files, set_intermediate);
}
f = lookup_file (".EXPORT_ALL_VARIABLES");
if (f != 0 && f->is_target)
@ -888,7 +756,7 @@ snap_deps (void)
if (f != 0 && f->is_target)
{
if (f->deps == 0)
run_silent = 1;
silent_flag = 1;
else
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
@ -897,28 +765,7 @@ snap_deps (void)
f = lookup_file (".NOTPARALLEL");
if (f != 0 && f->is_target)
{
struct dep *d2;
if (!f->deps)
not_parallel = 1;
else
/* Set a wait point between every prerequisite of each target. */
for (d = f->deps; d != NULL; d = d->next)
for (f2 = d->file; f2 != NULL; f2 = f2->prev)
if (f2->deps)
for (d2 = f2->deps->next; d2 != NULL; d2 = d2->next)
d2->wait_here = 1;
}
{
struct dep *prereqs = expand_extra_prereqs (lookup_variable (STRING_SIZE_TUPLE(".EXTRA_PREREQS")));
/* Perform per-file snap operations. */
hash_map_arg(&files, snap_file, prereqs);
free_dep_chain (prereqs);
}
not_parallel = 1;
#ifndef NO_MINUS_C_MINUS_O
/* If .POSIX was defined, remove OUTPUT_OPTION to comply. */
@ -929,9 +776,7 @@ snap_deps (void)
#endif
}
/* Set the 'command_state' member of FILE and all its 'also_make's.
Don't decrease the state of also_make's (e.g., don't downgrade a 'running'
also_make to a 'deps_running' also_make). */
/* Set the 'command_state' member of FILE and all its 'also_make's. */
void
set_command_state (struct file *file, enum cmd_state state)
@ -941,8 +786,7 @@ set_command_state (struct file *file, enum cmd_state state)
file->command_state = state;
for (d = file->also_make; d != 0; d = d->next)
if (state > d->file->command_state)
d->file->command_state = state;
d->file->command_state = state;
}
/* Convert an external file timestamp to internal form. */
@ -959,11 +803,10 @@ file_timestamp_cons (const char *fname, time_t stamp, long int ns)
&& product <= ts && ts <= ORDINARY_MTIME_MAX))
{
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
const char *f = fname ? fname : _("Current time");
ts = s <= OLD_MTIME ? ORDINARY_MTIME_MIN : ORDINARY_MTIME_MAX;
file_timestamp_sprintf (buf, ts);
OSS (error, NILF,
_("%s: timestamp out of range: substituting %s"), f, buf);
error (NILF, _("%s: Timestamp out of range; substituting %s"),
fname ? fname : _("Current time"), buf);
}
return ts;
@ -1028,22 +871,21 @@ file_timestamp_sprintf (char *p, FILE_TIMESTAMP ts)
struct tm *tm = localtime (&t);
if (tm)
{
intmax_t year = tm->tm_year;
p += sprintf (p, "%04" PRIdMAX "-%02d-%02d %02d:%02d:%02d",
year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
}
sprintf (p, "%04d-%02d-%02d %02d:%02d:%02d",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
else if (t < 0)
p += sprintf (p, "%" PRIdMAX, (intmax_t) t);
sprintf (p, "%ld", (long) t);
else
p += sprintf (p, "%" PRIuMAX, (uintmax_t) t);
sprintf (p, "%lu", (unsigned long) t);
p += strlen (p);
/* Append nanoseconds as a fraction, but remove trailing zeros. We don't
know the actual timestamp resolution, since clock_getres applies only to
local times, whereas this timestamp might come from a remote filesystem.
So removing trailing zeros is the best guess that we can do. */
p += sprintf (p, ".%09d", FILE_TIMESTAMP_NS (ts)) - 1;
sprintf (p, ".%09d", FILE_TIMESTAMP_NS (ts));
p += strlen (p) - 1;
while (*p == '0')
p--;
p += *p != '.';
@ -1053,7 +895,7 @@ file_timestamp_sprintf (char *p, FILE_TIMESTAMP ts)
/* Print the data base of files. */
static void
void
print_prereqs (const struct dep *deps)
{
const struct dep *ood = 0;
@ -1061,17 +903,17 @@ print_prereqs (const struct dep *deps)
/* Print all normal dependencies; note any order-only deps. */
for (; deps != 0; deps = deps->next)
if (! deps->ignore_mtime)
printf (" %s%s", deps->wait_here ? ".WAIT " : "", dep_name (deps));
printf (" %s", dep_name (deps));
else if (! ood)
ood = deps;
/* Print order-only deps, if we have any. */
if (ood)
{
printf (" | %s%s", ood->wait_here ? ".WAIT " : "", dep_name (ood));
printf (" | %s", dep_name (ood));
for (ood = ood->next; ood != 0; ood = ood->next)
if (ood->ignore_mtime)
printf (" %s%s", ood->wait_here ? ".WAIT " : "", dep_name (ood));
printf (" %s", dep_name (ood));
}
putchar ('\n');
@ -1125,13 +967,6 @@ print_file (const void *item)
printf (_("# Implicit/static pattern stem: '%s'\n"), f->stem);
if (f->intermediate)
puts (_("# File is an intermediate prerequisite."));
if (f->notintermediate)
puts (_("# File is a prerequisite of .NOTINTERMEDIATE."));
if (f->secondary)
puts (_("# File is secondary (prerequisite of .SECONDARY)."));
if (f->is_explicit)
puts (_("# File is explicitly mentioned."));
if (f->also_make != 0)
{
const struct dep *d;
@ -1207,42 +1042,13 @@ print_file_data_base (void)
fputs (_("\n# files hash-table stats:\n# "), stdout);
hash_print_stats (&files, stdout);
}
static void
print_target (const void *item)
{
const struct file *f = item;
if (!f->is_target || f->suffix)
return;
/* Ignore any special targets, as defined by POSIX. */
if (f->name[0] == '.' && isupper ((unsigned char)f->name[1]))
{
const char *cp = f->name + 1;
while (*(++cp) != '\0')
if (!isupper ((unsigned char)*cp))
break;
if (*cp == '\0')
return;
}
puts (f->name);
}
void
print_targets (void)
{
hash_map (&files, print_target);
}
/* Verify the integrity of the data base of files. */
#define VERIFY_CACHED(_p,_n) \
do{ \
if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \
error (NULL, strlen (_p->name) + CSTRLEN (# _n) + strlen (_p->_n), \
_("%s: field '%s' not cached: %s"), _p->name, # _n, _p->_n); \
do{\
if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \
error (NULL, _("%s: Field '%s' not cached: %s"), _p->name, # _n, _p->_n); \
}while(0)
static void
@ -1280,8 +1086,8 @@ build_target_list (char *value)
if (files.ht_fill != last_targ_count)
{
size_t max = EXPANSION_INCREMENT (strlen (value));
size_t len;
unsigned long max = EXPANSION_INCREMENT (strlen (value));
unsigned long len;
char *p;
struct file **fp = (struct file **) files.ht_vec;
struct file **end = &fp[files.ht_size];
@ -1295,19 +1101,20 @@ build_target_list (char *value)
if (!HASH_VACANT (*fp) && (*fp)->is_target)
{
struct file *f = *fp;
size_t l = strlen (f->name);
int l = strlen (f->name);
len += l + 1;
if (len > max)
{
size_t off = p - value;
unsigned long off = p - value;
max += EXPANSION_INCREMENT (l + 1);
value = xrealloc (value, max);
p = &value[off];
}
p = mempcpy (p, f->name, l);
memcpy (p, f->name, l);
p += l;
*(p++) = ' ';
}
*(p-1) = '\0';

View File

@ -1,5 +1,5 @@
/* Definition of target file data structures for GNU Make.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
Copyright (C) 1988-2013 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
@ -12,7 +12,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
/* Structure that represents the info on one file
@ -21,11 +21,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "hash.h"
struct commands;
struct dep;
struct variable;
struct variable_set_list;
struct file
{
const char *name;
@ -63,8 +58,6 @@ struct file
FILE_TIMESTAMP last_mtime; /* File's modtime, if already known. */
FILE_TIMESTAMP mtime_before_update; /* File's modtime before any updating
has been performed. */
unsigned int considered; /* equal to 'considered' if file has been
considered on current scan of goal chain */
int command_flags; /* Flags OR'd in for cmds; see commands.h. */
enum update_status /* Status of the last attempt to update. */
{
@ -73,7 +66,7 @@ struct file
us_question, /* Needs to be updated (-q is is set). */
us_failed /* Update failed. */
} update_status ENUM_BITFIELD (2);
enum cmd_state /* State of commands. ORDER IS IMPORTANT! */
enum cmd_state /* State of the commands. */
{
cs_not_started = 0, /* Not yet started. Must be 0! */
cs_deps_running, /* Dep commands running. */
@ -84,7 +77,6 @@ struct file
unsigned int builtin:1; /* True if the file is a builtin rule. */
unsigned int precious:1; /* Non-0 means don't delete file on quit */
unsigned int loaded:1; /* True if the file is a loaded object. */
unsigned int unloaded:1; /* True if this loaded object was unloaded. */
unsigned int low_resolution_time:1; /* Nonzero if this file's time stamp
has only one-second resolution. */
unsigned int tried_implicit:1; /* Nonzero if have searched
@ -97,35 +89,27 @@ struct file
unsigned int phony:1; /* Nonzero if this is a phony file
i.e., a prerequisite of .PHONY. */
unsigned int intermediate:1;/* Nonzero if this is an intermediate file. */
unsigned int is_explicit:1; /* Nonzero if explicitly mentioned. */
unsigned int secondary:1; /* Nonzero means remove_intermediates should
not delete it. */
unsigned int notintermediate:1; /* Nonzero means a file is a prereq to
.NOTINTERMEDIATE. */
unsigned int dontcare:1; /* Nonzero if no complaint is to be made if
this target cannot be remade. */
unsigned int ignore_vpath:1;/* Nonzero if we threw out VPATH name. */
unsigned int pat_searched:1;/* Nonzero if we already searched for
pattern-specific variables. */
unsigned int considered:1; /* equal to 'considered' if file has been
considered on current scan of goal chain */
unsigned int no_diag:1; /* True if the file failed to update and no
diagnostics has been issued (dontcare). */
unsigned int was_shuffled:1; /* Did we already shuffle 'deps'? used when
--shuffle passes through the graph. */
unsigned int snapped:1; /* True if the deps of this file have been
secondary expanded. */
unsigned int suffix:1; /* True if this is a suffix rule. */
};
extern struct file *default_file;
extern struct file *suffix_file, *default_file;
struct file *lookup_file (const char *name);
struct file *enter_file (const char *name);
struct dep *split_prereqs (char *prereqstr);
struct dep *enter_prereqs (struct dep *prereqs, const char *stem);
void expand_deps (struct file *f);
struct dep *expand_extra_prereqs (const struct variable *extra);
void remove_intermediates (int sig);
void snap_deps (void);
void rename_file (struct file *file, const char *name);
@ -133,12 +117,9 @@ void rehash_file (struct file *file, const char *name);
void set_command_state (struct file *file, enum cmd_state state);
void notice_finished_file (struct file *file);
void init_hash_files (void);
void verify_file_data_base (void);
char *build_target_list (char *old_list);
void print_prereqs (const struct dep *deps);
void print_file_data_base (void);
void print_targets (void);
int try_implicit_rule (struct file *file, unsigned int depth);
int stemlen_compare (const void *v1, const void *v2);
#if FILE_TIMESTAMP_HI_RES
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
@ -162,7 +143,7 @@ int stemlen_compare (const void *v1, const void *v2);
& ((1 << FILE_TIMESTAMP_LO_BITS) - 1)))
/* Upper bound on length of string "YYYY-MM-DD HH:MM:SS.NNNNNNNNN"
representing a file timestamp. The upper bound is not necessarily 29,
representing a file timestamp. The upper bound is not necessarily 19,
since the year might be less than -999 or greater than 9999.
Subtract one for the sign bit if in case file timestamps can be negative;
@ -213,8 +194,6 @@ FILE_TIMESTAMP f_mtime (struct file *file, int search);
<< FILE_TIMESTAMP_LO_BITS) \
+ ORDINARY_MTIME_MIN + FILE_TIMESTAMPS_PER_S - 1)
#define is_ordinary_mtime(_t) ((_t) >= ORDINARY_MTIME_MIN && (_t) <= ORDINARY_MTIME_MAX)
/* Modtime value to use for 'infinitely new'. We used to get the current time
from the system and use that whenever we wanted 'new'. But that causes
trouble when the machine running make and the machine holding a file have

File diff suppressed because it is too large Load Diff

1026
getloadavg.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987-2024 Free Software Foundation, Inc.
Copyright (C) 1987-2013 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
@ -18,7 +18,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
@ -68,7 +68,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
# include <unistd.h>
#endif /* GNU C library. */
#if MK_OS_VMS
#ifdef VMS
# include <unixlib.h>
# if HAVE_STRING_H - 0
# include <string.h>
@ -436,10 +436,6 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring)
nonoption_flags_len = 0;
#endif
/* Make the compiler happy. */
(void)argc;
(void)argv;
return optstring;
}
@ -681,18 +677,17 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
else
{
if (opterr)
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option '--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option '%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
}
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option '--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option '%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
nextchar += strlen (nextchar);
optopt = pfound->val;

View File

@ -1,5 +1,5 @@
/* Declarations for getopt.
Copyright (C) 1989-2024 Free Software Foundation, Inc.
Copyright (C) 1989-2013 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
@ -14,7 +14,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GETOPT_H
#define _GETOPT_H 1

View File

@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987-1994, 1996-2024 Free Software Foundation, Inc.
Copyright (C) 1987-1994, 1996-2013 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
@ -14,7 +14,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include <config.h>

View File

@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-2024 Free Software Foundation, Inc.
Copyright (C) 1995-2013 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
@ -12,7 +12,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1

10
gl/.gitignore vendored
View File

@ -1,10 +0,0 @@
*~
#*
.#*
.*cache
*.diff
*.patch
*.orig
*.rej
*.out
*.log

View File

@ -1,65 +0,0 @@
04 July 2022 -*-text-*-
The gnulib project provides a fantastic array of modules that can support both
POSIX and also extended features for GNU software.
Unfortunately using it in GNU make is problematic: GNU make is a foundational
utility (if you don't have a "make" program you pretty much can't build any
software), one of our goals in GNU make is to provide scripts (e.g.,
"build.sh") that will build GNU make without needing an instance of make.
Instead of running "./configure && make", you should be able to run
"./configure && ./build.sh" and get a build of GNU make as a result.
However, more and more gnulib modules are relying not on M4 macros and
the configure script to manage their configuration, but in addition special
makefile recipes that perform various post-configure operations. Since we
don't have an instance of "make", we cannot use these modules as-is.
There are various options we could choose for solving this:
- Avoid gnulib modules and write our own portability interfaces.
I really am not too excited about this.
- Give up on "build.sh" and require users to already have "make".
The argument here is that you must already have a compiler, and it couldn't
have been built without "make", and/or if you build it with a cross-compiler
then you should be able to use that cross-development environment to build
GNU make as well.
- Provide a "mini-make" with just enough functionality to support the gnulib
makefiles but no extra features, that didn't need any complex gnulib
modules. As with the first option, I'm not too excited about this.
Although arguably the second option is the sane one, I'm not really excited
about any of them for the time being. So I elected to try something between
the first and second options:
The gnulib-port Git branch will contain unmodified copies of gnulib modules
that we want to use with GNU make. From there, we merge them into the main
Git branch then modify / simplify them to avoid unnecessary extra modules and
allow "build.sh" to be used.
By keeping the unmodified versions on the gnulib-port branch, we enable Git
merge facilities to merge in new versions as follows:
* Check out the gnulib-port branch
* Update its content with any updates to gnulib modules. Something like:
(
cd gl \
&& find */. -type f \
| while read fn; do
test -f "$GNULIB_SRCDIR/$fn" && cp "$GNULIB_SRCDIR/$fn" "$fn"
done
)
* Commit the changes _without modification_
* Check out the main branch
* Run "git merge --no-ff gnulib-port" to merge in the changes
* Resolve any conflicts and commit the merge.
-- pds

View File

@ -1,216 +0,0 @@
# Check for getloadavg.
# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 Free
# Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 10
# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
# New applications should use gl_GETLOADAVG instead.
# gl_GETLOADAVG
# -------------
AC_DEFUN([gl_GETLOADAVG],
[AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
# Persuade glibc <stdlib.h> to declare getloadavg().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
gl_save_LIBS=$LIBS
# getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
HAVE_GETLOADAVG=1
AC_CHECK_FUNC([getloadavg], [],
[gl_func_getloadavg_done=no
# Some systems with -lutil have (and need) -lkvm as well, some do not.
# On Solaris, -lkvm requires nlist from -lelf, so check that first
# to get the right answer into the cache.
# For kstat on solaris, we need to test for libelf and libkvm to force the
# definition of SVR4 below.
if test $gl_func_getloadavg_done = no; then
AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
AC_CHECK_LIB([kvm], [kvm_open], [LIBS="-lkvm $LIBS"])
# Check for the 4.4BSD definition of getloadavg.
AC_CHECK_LIB([util], [getloadavg],
[LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes])
fi
if test $gl_func_getloadavg_done = no; then
# There is a commonly available library for RS/6000 AIX.
# Since it is not a standard part of AIX, it might be installed locally.
gl_getloadavg_LIBS=$LIBS
if test $cross_compiling != yes; then
LIBS="-L/usr/local/lib $LIBS"
fi
AC_CHECK_LIB([getloadavg], [getloadavg],
[LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
[LIBS=$gl_getloadavg_LIBS])
fi
# Set up the replacement function if necessary.
if test $gl_func_getloadavg_done = no; then
HAVE_GETLOADAVG=0
# Solaris has libkstat which does not require root.
AC_CHECK_LIB([kstat], [kstat_open])
test $ac_cv_lib_kstat_kstat_open = yes && gl_func_getloadavg_done=yes
# AIX has libperfstat which does not require root
if test $gl_func_getloadavg_done = no; then
AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_func_getloadavg_done=yes
fi
if test $gl_func_getloadavg_done = no; then
AC_CHECK_HEADER([sys/dg_sys_info.h],
[gl_func_getloadavg_done=yes
AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
AC_CHECK_LIB([dgc], [dg_sys_info])])
fi
fi])
if test "x$gl_save_LIBS" = x; then
GETLOADAVG_LIBS=$LIBS
else
GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
fi
LIBS=$gl_save_LIBS
AC_SUBST([GETLOADAVG_LIBS])dnl
# Test whether the system declares getloadavg. Solaris has the function
# but declares it in <sys/loadavg.h>, not <stdlib.h>.
AC_CHECK_HEADERS([sys/loadavg.h])
if test $ac_cv_header_sys_loadavg_h = yes; then
HAVE_SYS_LOADAVG_H=1
else
HAVE_SYS_LOADAVG_H=0
fi
AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
[[#if HAVE_SYS_LOADAVG_H
/* OpenIndiana has a bug: <sys/time.h> must be included before
<sys/loadavg.h>. */
# include <sys/time.h>
# include <sys/loadavg.h>
#endif
#include <stdlib.h>]])
])# gl_GETLOADAVG
# gl_PREREQ_GETLOADAVG
# --------------------
# Set up the AC_LIBOBJ replacement of 'getloadavg'.
AC_DEFUN([gl_PREREQ_GETLOADAVG],
[
# Figure out what our getloadavg.c needs.
AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h])
# On HPUX9, an unprivileged user can get load averages this way.
if test $gl_func_getloadavg_done = no; then
AC_CHECK_FUNCS([pstat_getdynamic], [gl_func_getloadavg_done=yes])
fi
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
# Irix 4.0.5F has the header but not the library.
if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \
&& test "$ac_cv_lib_kvm_kvm_open" = yes; then
gl_func_getloadavg_done=yes
AC_DEFINE([SVR4], [1], [Define to 1 on System V Release 4.])
fi
if test $gl_func_getloadavg_done = no; then
AC_CHECK_HEADER([inq_stats/cpustats.h],
[gl_func_getloadavg_done=yes
AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.])
AC_DEFINE([UMAX4_3], [1],
[Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>.])])
fi
if test $gl_func_getloadavg_done = no; then
AC_CHECK_HEADER([sys/cpustats.h],
[gl_func_getloadavg_done=yes; AC_DEFINE([UMAX])])
fi
if test $gl_func_getloadavg_done = no; then
AC_CHECK_HEADERS([mach/mach.h])
fi
AC_CHECK_HEADERS([nlist.h],
[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
[], [],
[#include <nlist.h>])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
[[struct nlist x;
#ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
x.n_un.n_name = "";
#else
x.n_name = "";
#endif]])],
[AC_DEFINE([N_NAME_POINTER], [1],
[Define to 1 if the nlist n_name member is a pointer])])
])dnl
])# gl_PREREQ_GETLOADAVG
# ---- GNU Make
# These macros are imported from stdlib which we don't want to include
# Only the getloadavg content is imported.
AC_DEFUN_ONCE([gl_STDLIB_H],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use, and which is not
dnl guaranteed by C89.
gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
#if HAVE_SYS_LOADAVG_H
/* OpenIndiana has a bug: <sys/time.h> must be included before
<sys/loadavg.h>. */
# include <sys/time.h>
# include <sys/loadavg.h>
#endif
#if HAVE_RANDOM_H
# include <random.h>
#endif
]], [getloadavg])
])
# gl_STDLIB_MODULE_INDICATOR([modulename])
# sets the shell variable that indicates the presence of the given module
# to a C preprocessor expression that will evaluate to 1.
# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
[
dnl Ensure to expand the default settings once only.
gl_STDLIB_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
# Initializes the default values for AC_SUBSTed shell variables.
# This macro must not be AC_REQUIREd. It must only be invoked, and only
# outside of macros or in macros that are not AC_REQUIREd.
AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
[
m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG])
])
m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS])
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
])
AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
])

View File

@ -1,24 +0,0 @@
Description:
Construct a full filename by concatenating a directory name, a relative
filename, and a suffix.
Files:
lib/concat-filename.h
lib/concat-filename.c
Depends-on:
filename
configure.ac:
Makefile.am:
lib_SOURCES += concat-filename.c
Include:
"concat-filename.h"
License:
LGPLv2+
Maintainer:
all

View File

@ -1,28 +0,0 @@
Description:
Locating a program in a given path.
Files:
lib/findprog.h
lib/findprog-in.c
m4/findprog-in.m4
m4/eaccess.m4
Depends-on:
stdbool
filename
concat-filename
configure.ac:
gl_FINDPROG_IN
Makefile.am:
lib_SOURCES += findprog.h findprog-in.c
Include:
"findprog.h"
License:
LGPLv2+
Maintainer:
all

View File

@ -1,40 +0,0 @@
Description:
Return the current system load averages.
Files:
lib/getloadavg.c
m4/getloadavg.m4
Depends-on:
snippet/warn-on-use
extensions
intprops [test $HAVE_GETLOADAVG = 0]
stdbool [test $HAVE_GETLOADAVG = 0]
configure.ac:
gl_STDLIB_H
gl_STDLIB_H_REQUIRE_DEFAULTS
AC_REQUIRE([AC_CANONICAL_HOST])
gl_GETLOADAVG
gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], [test $HAVE_GETLOADAVG = 0])
AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [
gl_PREREQ_GETLOADAVG
])
gl_STDLIB_MODULE_INDICATOR([getloadavg])
Makefile.am:
if GL_COND_OBJ_GETLOADAVG
lib_SOURCES += getloadavg.c
endif
Include:
<stdlib.h>
Link:
$(GETLOADAVG_LIBS)
License:
GPL
Maintainer:
Jim Meyering

View File

@ -1,112 +0,0 @@
Description:
GNU Make version of fnmatch()/glob() functions. This is a holdover from
a very old version of the globbing library.
Files:
lib/fnmatch.c
lib/fnmatch.in.h
lib/glob.c
lib/glob.in.h
configure.ac:
# Check the system to see if it provides GNU glob. If not, use our
# local version. Also avoid versions of glibc which have symlink bug
# https://sourceware.org/bugzilla/show_bug.cgi?id=866 (test from gnulib)
AC_CACHE_CHECK([if system libc has working GNU glob], [make_cv_sys_gnu_glob],[
if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
make_check_symlink=yes
else
make_check_symlink=no
fi
if test $cross_compiling = yes || test $make_check_symlink = no; then
# When cross-compiling or without symlink support, check the version
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <features.h>
#include <gnu-versions.h>
#include <glob.h>
#include <fnmatch.h>
]],
[[
#if _GNU_GLOB_INTERFACE_VERSION == 0
GNU glob not available in libc
#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 27)
GNU glob in libc has dangling symlink bug
#endif
]])],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no])
else
# Check for GNU glob, and that it handles dangling symlinks properly
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <features.h>
#include <gnu-versions.h>
#include <glob.h>
#include <fnmatch.h>
]],
[[
#if _GNU_GLOB_INTERFACE_VERSION == 0
return 1;
#else
glob_t found;
if (glob ("conf*-globtest", 0, 0, &found) == GLOB_NOMATCH)
return 1;
globfree (&found);
#endif
]])],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no],
[dnl We don't get here.
:
])
fi
test $make_check_symlink = no || rm -f conf$$-globtest
])
# Tell automake about this, so it can build the right .c files.
AM_CONDITIONAL([USE_SYSTEM_GLOB], [test "$make_cv_sys_gnu_glob" = yes])
# Tell build.sh which to use
USE_SYSTEM_GLOB="$make_cv_sys_gnu_glob"
AC_SUBST([USE_SYSTEM_GLOB])
Makefile.am:
if !USE_SYSTEM_GLOB
libgnu_a_SOURCES += fnmatch.c
BUILT_SOURCES += fnmatch.h
fnmatch.h: fnmatch.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
cat $(srcdir)/fnmatch.in.h; \
} > $@-t && \
mv -f $@-t $@
MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
libgnu_a_SOURCES += glob.c
BUILT_SOURCES += glob.h
glob.h: glob.in.h $(top_builddir)/config.status
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
cat $(srcdir)/glob.in.h; \
} > $@-t && \
mv -f $@-t $@
MOSTLYCLEANFILES += glob.h glob.h-t
endif
EXTRA_DIST += fnmatch.in.h glob.in.h
Include:
<glob.h>
License:
LGPLv2+
Maintainer:
all, glibc

View File

@ -1,16 +0,0 @@
Description:
Install m4 macros for GNU Make.
Files:
m4/acinclude.m4
m4/dospaths.m4
configure.ac:
# Check for DOS-style pathnames.
pds_AC_DOS_PATHS
License:
GPLv3+
Maintainer:
gnumake

481
glob/COPYING.LIB Normal file
View File

@ -0,0 +1,481 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

185
glob/ChangeLog Normal file
View File

@ -0,0 +1,185 @@
2008-09-28 Juan Manuel Guerrero <juan.guerrero@gmx.de>
* glob.c (my_realloc) [__DJGPP__]: Don't define, and don't
redefine realloc to call it, since the DJGPP's realloc handles
NULL pointers correctly.
2007-12-22 Juan Manuel Guerrero <juan.guerrero@gmx.de> (tiny change)
* glob.c [__GNU_LIBRARY__ && __DJGPP__]: Add a realloc
declaration that matches the one in the DJGPP libc.
2006-02-24 Eli Zaretskii <eliz@gnu.org>
* glob.c (my_malloc) [WINDOWS32]: Provide a full ISO C prototype,
to avoid compiler warnings.
2005-06-25 Paul D. Smith <psmith@gnu.org>
* fnmatch.h, glob.h [WINDOWS32]: Fix ifdefs in headers.
Fixes Savannah bug #13477.
2005-03-11 Paul D. Smith <psmith@gnu.org>
* glob.c (glob_in_dir): Change FNM_CASEFOLD to be enabled if
HAVE_CASE_INSENSITIVE_FS is defined.
2003-01-30 Paul D. Smith <psmith@gnu.org>
* glob.h: Patch for FreeBSD by Mike Barcroft <mike@freebsd.org>
Reported by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>. On
FreeBSD, declare __size_t to simply size_t.
2002-04-22 Paul D. Smith <psmith@gnu.org>
* Makefile.am: Use automake 1.6.
Use new automake condition USE_LOCAL_GLOB to decide whether or not
to build the local GNU glob library or use the system one.
1999-09-12 Paul D. Smith <psmith@gnu.org>
* fnmatch.c: Last GLIBC version wouldn't compile outside of GLIBC
(undefined reference to internal_function). Update to the latest
version
1999-09-11 Paul Eggert <eggert@twinsun.com>
* glob.h (glob): If #defining to glob64, do this before
declaring it, so that all declarations and uses match, and
do not declare glob64, to avoid a declaration clash.
(globfree): Likewise with globfree64.
1999-09-08 Eli Zaretskii <eliz@is.elta.co.il>
* glob.c (prefix_array) [__MSDOS__,WINDOWS32]: Keep the trailing
slash unless DIRNAME is just "x:/".
1999-09-06 Paul D. Smith <psmith@gnu.org>
* fnmatch.c: Update to latest version from GLIBC.
1999-07-21 Paul D. Smith <psmith@gnu.org>
* glob.c, glob.h, fnmatch.c, fnmatch.h: Update to latest version
from GLIBC.
* fnmatch.c (internal_fnmatch): Use K&R definition syntax, not ANSI.
(__strchrnul): This won't exist outside GLIBC, so create one.
* glob.c: Move getlogin{,_r} prototypes below glob.h to get __P()
macro.
1998-08-05 Paul D. Smith <psmith@gnu.org>
* configure.in: Remove; configuration for glob is handled by the
make configure.in.
1998-07-29 Paul D. Smith <psmith@gnu.org>
* glob.c, fnmatch.c: New versions from the GLIBC folks (Ulrich
Drepper). Fixes a bug reported by Eli Zaretski. Integrates
DOS/Windows32 support.
1998-07-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* glob.c (glob): Cast away const on assignment of pattern to dirname.
Cast the return type of __alloca() for traditional C compilers.
1998-07-23 Paul D. Smith <psmith@gnu.org>
* glob.c, fnmatch.c: New versions of these files from the GLIBC
folks (Ulrich Drepper). Had to re-integrate some DOS/Windows
code.
1998-07-10 Paul D. Smith <psmith@gnu.org>
* glob.c (glob_in_dir): If no meta chars exist in PATTERN and
GLOB_NOCHECK is present, don't look for the file--whether it's
found or not, we'll always return it, so why bother searching?
Also, if we are searching and there are no meta chars, don't
bother trying fnmatch() if the strcmp() fails.
1998-05-30 Eli Zaretskii <eliz@is.elta.co.il>
* glob.c (glob) [__MSDOS__, WINDOWS32]: Compute the directory and
filename parts of the pattern correctly when it includes a drive
spec. Disallow wildcards in the drive spec. Prevent recursion
when dirname is of the form "d:/" or "d:".
(prefix_array) [__MSDOS__, WINDOWS32]: Don't append a slash to
"d:/" and "d:".
1998-05-13 Paul D. Smith <psmith@gnu.org>
* SMakefile, Makefile.ami, glob.c, glob.h, fnmatch.c: Updated from
the latest glibc version.
1998-04-17 Paul D. Smith <psmith@gnu.org>
* configure.in: Create a config.h file instead of setting things
on the compile line. This is because when build.sh runs it merely
passes -DHAVE_CONFIG_H to the glob files, just as it does to the
make files.
* config.h.in: Created by autoheader.
Tue Aug 12 10:52:34 1997 Paul D. Smith <psmith@baynetworks.com>
* configure.in: Require autoconf 2.12.
* glob: Updates from latest GNU libc glob code.
* glob.c,glob.h,fnmatch.h: Change all WIN32 references to WINDOWS32.
* glob.h: OSF4 defines macros in such a way that GLOB_ALTDIRFUNC
is not defined. Added a test to the #if which defines it if
_GNU_SOURCE is defined; that's set by both glob.c and GNU make.
* glob.c: SunOS4 w/ cc needs #include <stdio.h>, since assert.h
requires stderr but doesn't include stdio.h :-/.
(next_brace_sub): De-protoize function definition.
(glob): Cast __alloca(); on SunOS4 it uses the default return type
of int.
(glob): Irix defines getlogin_r() to return a char*; move the
extern for that into the _LIBC area since it isn't used except in
LIBC anyway. Likewise, move extern getlogin() into the "else".
Sat Jul 20 21:55:31 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
Win32 hacks from <Rob_Tulloh@tivoli.com>.
* posix/glob.c [WIN32]: Don't include <pwd.h>; don't use d_ino;
use void * for my_realloc; include <malloc.h> for alloca.
(glob) [WIN32]: Use "c:/users/default" for ~ if no HOME variable.
* posix/fnmatch.h [WIN32]: Use prototypes even if [!__STDC__].
* posix/glob.h: Likewise.
Fri Jul 19 16:56:41 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* posix/glob.h [!_AMIGA && !VMS]: Check this instead of just [!_AMIGA]
for `struct stat;' forward decl.
Sat Jun 22 10:44:09 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* posix/glob.c: Include <alloca.h> only [HAVE_ALLOCA_H], not [sparc].
Fri Jun 21 00:27:51 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* posix/fnmatch.c (fnmatch): Fix \*[*?]+ case to increment name ptr
only for ?s, not for *s. Fix from Chet Ramey.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>.

30
glob/Makefile.am Normal file
View File

@ -0,0 +1,30 @@
# -*-Makefile-*-, or close enough
# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = foreign
# Only build the library when the system doesn't already have GNU glob.
if USE_LOCAL_GLOB
noinst_LIBRARIES = libglob.a
endif
libglob_a_SOURCES = glob.c glob.h fnmatch.c fnmatch.h
EXTRA_DIST = COPYING.LIB Makefile.ami SCOPTIONS SMakefile \
configure.bat

67
glob/Makefile.ami Normal file
View File

@ -0,0 +1,67 @@
# Makefile for standalone libglob.a (fnmatch, glob). -*-Makefile-*-
# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
# Ultrix 2.2 make doesn't expand the value of VPATH.
VPATH = /glob/
# This must repeat the value, because configure will remove `VPATH = .'.
srcdir = /glob/
CC = sc
RM = delete
CPPFLAGS =
CFLAGS =
# Information determined by configure.
DEFS = Define HAVE_HEADER_STDC Define HAVE_UNISTD_H Define HAVE_STRING_H \
Define HAVE_DIRENT_H
# How to invoke ar.
AR = join
ARFLAGS = as
# How to invoke ranlib.
RANLIB = ;
.PHONY: all
all: glob.lib
glob.lib : glob.o fnmatch.o
$(AR) $(ARFLAGS) $@ glob.o fnmatch.o
$(RANLIB) $@
# For some reason, Unix make wants the dependencies on the source files.
# Otherwise it refuses to use an implicit rule!
# And, get this: it doesn't work to use $(srcdir)foo.c!!
glob.o: $(srcdir)glob.h $(srcdir)fnmatch.h glob.c
fnmatch.o: $(srcdir)fnmatch.h fnmatch.c
OUTPUT_OPTION =
.c.o:
$(CC) IDir "" \
$(DEFS) $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
.PHONY: clean realclean glob-clean glob-realclean distclean
clean glob-clean:
-$(RM) glob.lib "#?.o" core
distclean glob-realclean: clean
-$(RM) TAGS tags Makefile config.status config.h config.log
realcean: distclean
# For inside the C library.
glob.tar glob.tar.Z:
$(MAKE) -C .. $@

13
glob/SCOPTIONS Normal file
View File

@ -0,0 +1,13 @@
ERRORREXX
OPTIMIZE
NOVERSION
OPTIMIZERTIME
OPTIMIZERALIAS
DEFINE INCLUDEDIR="include:"
DEFINE LIBDIR="lib:"
DEFINE NO_ALLOCA
DEFINE NO_FLOAT
DEFINE NO_ARCHIVES
IGNORE=161
IGNORE=100
STARTUP=cres

67
glob/SMakefile Normal file
View File

@ -0,0 +1,67 @@
# Makefile for standalone distribution of libglob.a (fnmatch, glob).
# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007 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 3 of the License, 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
# this program. If not, see <http://www.gnu.org/licenses/>.
# Ultrix 2.2 make doesn't expand the value of VPATH.
VPATH = /glob/
# This must repeat the value, because configure will remove `VPATH = .'.
srcdir = /glob/
CC = sc
CPPFLAGS =
CFLAGS =
MAKE = smake
RM = delete
# Information determined by configure.
DEFS = Define HAVE_HEADER_STDC Define HAVE_UNISTD_H Define HAVE_STRING_H \
Define HAVE_DIRENT_H
# How to invoke ar.
AR = join
ARFLAGS = as
# How to invoke ranlib.
RANLIB = ;
.PHONY: all
all: glob.lib
glob.lib : glob.o fnmatch.o
$(AR) $(ARFLAGS) $@ glob.o fnmatch.o
$(RANLIB) $@
# For some reason, Unix make wants the dependencies on the source files.
# Otherwise it refuses to use an implicit rule!
# And, get this: it doesn't work to use $(srcdir)foo.c!!
glob.o: $(srcdir)glob.h $(srcdir)fnmatch.h glob.c
fnmatch.o: $(srcdir)fnmatch.h fnmatch.c
.c.o:
$(CC) IDir "" \
$(DEFS) $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
.PHONY: clean realclean glob-clean glob-realclean distclean
clean glob-clean:
-$(RM) -f glob.lib *.o core
distclean glob-realclean: clean
-$(RM) -f TAGS tags Makefile config.status config.h config.log
realcean: distclean
# For inside the C library.
glob.tar glob.tar.Z:
$(MAKE) -C .. $@

43
glob/configure.bat Normal file
View File

@ -0,0 +1,43 @@
@echo off
rem Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
rem 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
rem This file is part of GNU Make.
rem
rem GNU Make is free software; you can redistribute it and/or modify it under
rem the terms of the GNU General Public License as published by the Free
rem Software Foundation; either version 3 of the License, or (at your option)
rem any later version.
rem
rem GNU Make is distributed in the hope that it will be useful, but WITHOUT
rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
rem more details.
rem
rem You should have received a copy of the GNU General Public License along
rem with this program. If not, see <http://www.gnu.org/licenses/>.
echo Configuring glob for DJGPP
rem This batch file assumes a unix-type "sed" program
echo # Makefile generated by "configure.bat"> Makefile
if exist config.sed del config.sed
echo "s/@srcdir@/./ ">> config.sed
echo "s/@CC@/gcc/ ">> config.sed
echo "s/@CFLAGS@/-O2 -g/ ">> config.sed
echo "s/@CPPFLAGS@/-DHAVE_CONFIG_H -I../ ">> config.sed
echo "s/@AR@/ar/ ">> config.sed
echo "s/@RANLIB@/ranlib/ ">> config.sed
echo "s/@LDFLAGS@// ">> config.sed
echo "s/@DEFS@// ">> config.sed
echo "s/@ALLOCA@// ">> config.sed
echo "s/@LIBS@// ">> config.sed
echo "s/@LIBOBJS@// ">> config.sed
echo "s/^Makefile *:/_Makefile:/ ">> config.sed
echo "s/^config.h *:/_config.h:/ ">> config.sed
sed -e "s/^\"//" -e "s/\"$//" -e "s/[ ]*$//" config.sed > config2.sed
sed -f config2.sed Makefile.in >> Makefile
del config.sed
del config2.sed

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2023 Free Software
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@ -13,8 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB.
If not, see <https://www.gnu.org/licenses/>. */
along with this library; see the file COPYING.LIB. If not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA. */
#if HAVE_CONFIG_H
# include <config.h>
@ -127,20 +128,48 @@ extern char *getenv ();
extern int errno;
# endif
/* This function doesn't exist on most systems. */
# if !defined HAVE___STRCHRNUL && !defined _LIBC
static char *
__strchrnul (s, c)
const char *s;
int c;
{
char *result = strchr (s, c);
if (result == NULL)
result = strchr (s, '\0');
return result;
}
# endif
# ifndef internal_function
/* Inside GNU libc we mark some function in a special way. In other
environments simply ignore the marking. */
# define internal_function
# endif
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
static int internal_fnmatch __P ((const char *pattern, const char *string,
int no_leading_period, int flags))
internal_function;
static int
internal_fnmatch (const char *pattern, const char *string,
int no_leading_period, int flags)
internal_function
internal_fnmatch (pattern, string, no_leading_period, flags)
const char *pattern;
const char *string;
int no_leading_period;
int flags;
{
const char *p = pattern, *n = string;
unsigned char c;
register const char *p = pattern, *n = string;
register unsigned char c;
/* Note that this evaluates C many times. */
# ifdef _LIBC
# define FOLD(c) (unsigned char)((flags & FNM_CASEFOLD) ? tolower (c) : (c))
# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
# else
# define FOLD(c) (unsigned char)((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
# endif
while ((c = *p++) != '\0')
@ -208,9 +237,7 @@ internal_fnmatch (const char *pattern, const char *string,
{
const char *endp;
endp = strchr (n, (flags & FNM_FILE_NAME) ? '/' : '\0');
if (endp == NULL)
endp = n + strlen (n);
endp = __strchrnul (n, (flags & FNM_FILE_NAME) ? '/' : '\0');
if (c == '[')
{
@ -265,7 +292,7 @@ internal_fnmatch (const char *pattern, const char *string,
{
/* Nonzero if the sense of the character class is inverted. */
static int posixly_correct;
int not;
register int not;
char cold;
if (posixly_correct == 0)
@ -451,7 +478,10 @@ internal_fnmatch (const char *pattern, const char *string,
int
fnmatch (const char *pattern, const char *string, int flags)
fnmatch (pattern, string, flags)
const char *pattern;
const char *string;
int flags;
{
return internal_fnmatch (pattern, string, flags & FNM_PERIOD, flags);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2023 Free Software
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@ -13,8 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB.
If not, see <https://www.gnu.org/licenses/>. */
along with this library; see the file COPYING.LIB. If not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA. */
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
@ -23,6 +24,27 @@ If not, see <https://www.gnu.org/licenses/>. */
extern "C" {
#endif
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
# if !defined __GLIBC__
# undef __P
# define __P(protos) protos
# endif
#else /* Not C++ or ANSI C. */
# undef __P
# define __P(protos) ()
/* We can get away without defining `const' here only because in this file
it is used only inside the prototype for `fnmatch', which is elided in
non-ANSI C where `const' is problematical. */
#endif /* C++ or ANSI C. */
#ifndef const
# if (defined __STDC__ && __STDC__) || defined __cplusplus || defined WINDOWS32
# define __const const
# else
# define __const
# endif
#endif
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
@ -53,7 +75,8 @@ extern "C" {
/* Match NAME against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch (const char *pattern, const char *name, int flags);
extern int fnmatch __P ((__const char *__pattern, __const char *__name,
int __flags));
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
/* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2023 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 Free
Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@ -12,8 +12,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB.
If not, see <https://www.gnu.org/licenses/>. */
along with this library; see the file COPYING.LIB. If not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA. */
/* AIX requires this to be the first thing in the file. */
#if defined _AIX && !defined __GNUC__
@ -37,6 +38,9 @@ If not, see <https://www.gnu.org/licenses/>. */
/* #define NDEBUG 1 */
#include <assert.h>
#include <stdio.h> /* Needed on stupid SunOS for assert. */
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
@ -46,9 +50,7 @@ If not, see <https://www.gnu.org/licenses/>. */
it is simpler to just do this in the source for each such file. */
#define GLOB_INTERFACE_VERSION 1
#if defined _LIBC
# define ELIDE_CODE
#elif defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
# include <gnu-versions.h>
# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
# define ELIDE_CODE
@ -61,7 +63,7 @@ If not, see <https://www.gnu.org/licenses/>. */
# include <stddef.h>
#endif
#if defined HAVE_UNISTD_H
#if defined HAVE_UNISTD_H || defined _LIBC
# include <unistd.h>
# ifndef POSIX
# ifdef _POSIX_VERSION
@ -70,7 +72,7 @@ If not, see <https://www.gnu.org/licenses/>. */
# endif
#endif
#if !defined _AMIGA && !MK_OS_VMS && !MK_OS_W32
#if !defined _AMIGA && !defined VMS && !defined WINDOWS32
# include <pwd.h>
#endif
@ -81,6 +83,11 @@ extern int errno;
# define __set_errno(val) errno = (val)
#endif
#ifndef NULL
# define NULL 0
#endif
#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
@ -101,6 +108,7 @@ extern int errno;
# endif /* HAVE_VMSDIR_H */
#endif
/* In GNU systems, <dirent.h> defines this macro for us. */
#ifdef _D_NAMLEN
# undef NAMLEN
@ -109,12 +117,12 @@ extern int errno;
/* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
if the `d_type' member for `struct dirent' is available. */
#if defined(_DIRENT_HAVE_D_TYPE) || defined(HAVE_STRUCT_DIRENT_D_TYPE)
#ifdef _DIRENT_HAVE_D_TYPE
# define HAVE_D_TYPE 1
#endif
#if (defined POSIX || MK_OS_W32) && !defined __GNU_LIBRARY__
#if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
/* Posix does not require that the d_ino field be present, and some
systems do not provide it. */
# define REAL_DIR_ENTRY(dp) 1
@ -122,10 +130,49 @@ extern int errno;
# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
#endif /* POSIX */
#include <stdlib.h>
#include <string.h>
#if defined STDC_HEADERS || defined __GNU_LIBRARY__
# include <stdlib.h>
# include <string.h>
# define ANSI_STRING
#else /* No standard headers. */
#if !defined HAVE_STRCOLL
extern char *getenv ();
# ifdef HAVE_STRING_H
# include <string.h>
# define ANSI_STRING
# else
# include <strings.h>
# endif
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
extern char *malloc (), *realloc ();
extern void free ();
extern void qsort ();
extern void abort (), exit ();
#endif /* Standard headers. */
#ifndef ANSI_STRING
# ifndef bzero
extern void bzero ();
# endif
# ifndef bcopy
extern void bcopy ();
# endif
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# define strrchr rindex
/* memset is only used for zero here, but let's be paranoid. */
# define memset(s, better_be_zero, n) \
((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
#endif /* Not ANSI_STRING. */
#if !defined HAVE_STRCOLL && !defined _LIBC
# define strcoll strcmp
#endif
@ -135,6 +182,32 @@ extern int errno;
# define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
#endif
#if !defined __GNU_LIBRARY__ && !defined __DJGPP__
# ifdef __GNUC__
__inline
# endif
# ifndef __SASC
# ifdef WINDOWS32
static void *
my_realloc (void *p, unsigned int n)
# else
static char *
my_realloc (p, n)
char *p;
unsigned int n;
# endif
{
/* These casts are the for sake of the broken Ultrix compiler,
which warns of illegal pointer combinations otherwise. */
if (p == NULL)
return (char *) malloc (n);
return (char *) realloc (p, n);
}
# define realloc my_realloc
# endif /* __SASC */
#endif /* __GNU_LIBRARY__ || __DJGPP__ */
#if !defined __alloca && !defined __GNU_LIBRARY__
# ifdef __GNUC__
@ -145,17 +218,21 @@ extern int errno;
# include <alloca.h>
# else /* Not HAVE_ALLOCA_H. */
# ifndef _AIX
# if MK_OS_W32
# ifdef WINDOWS32
# include <malloc.h>
# else
extern char *alloca ();
# endif /* MK_OS_W32 */
# endif /* WINDOWS32 */
# endif /* Not _AIX. */
# endif /* sparc or HAVE_ALLOCA_H. */
# endif /* GCC. */
# define __alloca alloca
#endif
#ifndef __GNU_LIBRARY__
# define __stat stat
# ifdef STAT_MACROS_BROKEN
# undef S_ISDIR
# endif
@ -164,6 +241,25 @@ extern char *alloca ();
# endif
#endif
#ifdef _LIBC
# undef strdup
# define strdup(str) __strdup (str)
# define sysconf(id) __sysconf (id)
# define closedir(dir) __closedir (dir)
# define opendir(name) __opendir (name)
# define readdir(str) __readdir (str)
# define getpwnam_r(name, bufp, buf, len, res) \
__getpwnam_r (name, bufp, buf, len, res)
# ifndef __stat
# define __stat(fname, buf) __xstat (_STAT_VER, fname, buf)
# endif
#endif
#if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
# undef size_t
# define size_t unsigned int
#endif
/* Some system header files erroneously define these.
We want our own definitions from <fnmatch.h> to take precedence. */
#ifndef __GNU_LIBRARY__
@ -187,30 +283,26 @@ extern char *alloca ();
#endif
#include <glob.h>
#if !defined __alloca
# define __alloca alloca
#endif
#ifdef HAVE_GETLOGIN_R
extern int getlogin_r (char *, size_t);
extern int getlogin_r __P ((char *, size_t));
#else
extern char *getlogin (void);
extern char *getlogin __P ((void));
#endif
static
#if __GNUC__ - 0 >= 2
inline
#endif
const char *next_brace_sub (const char *begin);
static int glob_in_dir (const char *pattern, const char *directory,
int flags,
int (*errfunc) (const char *, int),
glob_t *pglob);
static int prefix_array (const char *prefix, char **array, size_t n);
static int collated_compare (const void *, const void *);
const char *next_brace_sub __P ((const char *begin));
static int glob_in_dir __P ((const char *pattern, const char *directory,
int flags,
int (*errfunc) (const char *, int),
glob_t *pglob));
static int prefix_array __P ((const char *prefix, char **array, size_t n));
static int collated_compare __P ((const __ptr_t, const __ptr_t));
#if !defined NO_GLOB_PATTERN_P
int __glob_pattern_p (const char *pattern, int quote);
#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
int __glob_pattern_p __P ((const char *pattern, int quote));
#endif
/* Find the end of the sub-pattern in a brace expression. We define
@ -220,7 +312,8 @@ static
inline
#endif
const char *
next_brace_sub (const char *begin)
next_brace_sub (begin)
const char *begin;
{
unsigned int depth = 0;
const char *cp = begin;
@ -266,14 +359,17 @@ next_brace_sub (const char *begin)
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
int
glob (const char *pattern, int flags,
int (*errfunc) (const char *, int), glob_t *pglob)
glob (pattern, flags, errfunc, pglob)
const char *pattern;
int flags;
int (*errfunc) __P ((const char *, int));
glob_t *pglob;
{
const char *filename;
const char *dirname;
size_t dirlen;
int status;
size_t oldcount;
int oldcount;
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
{
@ -281,11 +377,6 @@ glob (const char *pattern, int flags,
return -1;
}
/* POSIX requires all slashes to be matched. This means that with
a trailing slash we must match only directories. */
if (pattern[0] && pattern[strlen (pattern) - 1] == '/')
flags |= GLOB_ONLYDIR;
if (flags & GLOB_BRACE)
{
const char *begin = strchr (pattern, '{');
@ -293,7 +384,7 @@ glob (const char *pattern, int flags,
{
/* Allocate working buffer large enough for our work. Note that
we have at least an opening and closing brace. */
size_t firstc;
int firstc;
char *alt_start;
const char *p;
const char *next;
@ -415,14 +506,14 @@ glob (const char *pattern, int flags,
/* Find the filename. */
filename = strrchr (pattern, '/');
#if MK_OS_DOS || MK_OS_W32
#if defined __MSDOS__ || defined WINDOWS32
/* The case of "d:pattern". Since `:' is not allowed in
file names, we can safely assume that wherever it
happens in pattern, it signals the filename part. This
is so we could some day support patterns like "[a-z]:foo". */
if (filename == NULL)
filename = strchr (pattern, ':');
#endif /* MK_OS_DOS || MK_OS_W32 */
#endif /* __MSDOS__ || WINDOWS32 */
if (filename == NULL)
{
/* This can mean two things: a simple name or "~name". The later
@ -459,7 +550,7 @@ glob (const char *pattern, int flags,
{
char *newp;
dirlen = filename - pattern;
#if MK_OS_DOS || MK_OS_W32
#if defined __MSDOS__ || defined WINDOWS32
if (*filename == ':'
|| (filename > pattern + 1 && filename[-1] == ':'))
{
@ -493,7 +584,7 @@ glob (const char *pattern, int flags,
++filename;
if (filename[0] == '\0'
#if MK_OS_DOS || MK_OS_W32
#if defined __MSDOS__ || defined WINDOWS32
&& dirname[dirlen - 1] != ':'
&& (dirlen < 3 || dirname[dirlen - 2] != ':'
|| dirname[dirlen - 1] != '/')
@ -517,13 +608,13 @@ glob (const char *pattern, int flags,
oldcount = pglob->gl_pathc;
#if !MK_OS_VMS
#ifndef VMS
if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~')
{
if (dirname[1] == '\0' || dirname[1] == '/')
{
/* Look up home directory. */
#if MK_OS_VMS
#ifdef VMS
/* This isn't obvious, RTLs of DECC and VAXC know about "HOME" */
const char *home_dir = getenv ("SYS$LOGIN");
#else
@ -533,11 +624,11 @@ glob (const char *pattern, int flags,
if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "SYS:";
# else
# if MK_OS_W32
# ifdef WINDOWS32
if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "c:/users/default"; /* poor default */
# else
# if MK_OS_VMS
# ifdef VMS
/* Again, this isn't obvious, if "HOME" isn't known "SYS$LOGIN" should be set */
if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "SYS$DISK:[]";
@ -546,7 +637,7 @@ glob (const char *pattern, int flags,
{
int success;
char *name;
# if defined HAVE_GETLOGIN_R
# if defined HAVE_GETLOGIN_R || defined _LIBC
size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
if (buflen == 0)
@ -562,7 +653,7 @@ glob (const char *pattern, int flags,
if (success)
{
struct passwd *p;
# if defined HAVE_GETPWNAM_R
# if defined HAVE_GETPWNAM_R || defined _LIBC
size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
char *pwtmpbuf;
struct passwd pwbuf;
@ -600,8 +691,8 @@ glob (const char *pattern, int flags,
else
home_dir = "~"; /* No luck. */
}
# endif /* MK_OS_VMS */
# endif /* MK_OS_W32 */
# endif /* VMS */
# endif /* WINDOWS32 */
# endif
/* Now construct the full directory. */
if (dirname[1] == '\0')
@ -621,7 +712,7 @@ glob (const char *pattern, int flags,
dirname = newp;
}
}
# if !defined _AMIGA && !MK_OS_W32 && !MK_OS_VMS
# if !defined _AMIGA && !defined WINDOWS32 && !defined VMS
else
{
char *end_name = strchr (dirname, '/');
@ -647,7 +738,7 @@ glob (const char *pattern, int flags,
/* Look up specific user's home directory. */
{
struct passwd *p;
# if defined HAVE_GETPWNAM_R
# if defined HAVE_GETPWNAM_R || defined _LIBC
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
char *pwtmpbuf;
struct passwd pwbuf;
@ -701,9 +792,9 @@ glob (const char *pattern, int flags,
home directory. */
return GLOB_NOMATCH;
}
# endif /* Not Amiga && not MK_OS_W32 && not MK_OS_VMS. */
# endif /* Not Amiga && not WINDOWS32 && not VMS. */
}
#endif /* Not MK_OS_VMS. */
#endif /* Not VMS. */
/* Now test whether we looked for "~" or "~NAME". In this case we
can give the answer now. */
@ -715,7 +806,7 @@ glob (const char *pattern, int flags,
if ((flags & GLOB_NOCHECK)
|| (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (dirname, &st)
: stat (dirname, &st)) == 0
: __stat (dirname, &st)) == 0
&& S_ISDIR (st.st_mode)))
{
pglob->gl_pathv
@ -732,7 +823,7 @@ glob (const char *pattern, int flags,
while (pglob->gl_pathc < pglob->gl_offs)
pglob->gl_pathv[pglob->gl_pathc++] = NULL;
#if defined HAVE_STRDUP
#if defined HAVE_STRDUP || defined _LIBC
pglob->gl_pathv[pglob->gl_pathc] = strdup (dirname);
#else
{
@ -764,7 +855,7 @@ glob (const char *pattern, int flags,
have to glob for the directory, and then glob for
the pattern in each directory found. */
glob_t dirs;
size_t i;
register int i;
status = glob (dirname,
((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE))
@ -778,7 +869,7 @@ glob (const char *pattern, int flags,
appending the results to PGLOB. */
for (i = 0; i < dirs.gl_pathc; ++i)
{
size_t old_pathc;
int old_pathc;
#ifdef SHELL
{
@ -861,7 +952,7 @@ glob (const char *pattern, int flags,
/* First check whether this really is a directory. */
if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (dir, &st) : stat (dir, &st)) != 0
? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0
|| !S_ISDIR (st.st_mode))
/* No directory, ignore this entry. */
continue;
@ -914,7 +1005,7 @@ glob (const char *pattern, int flags,
if (dirlen > 0)
{
/* Stick the directory on the front of each name. */
size_t ignore = oldcount;
int ignore = oldcount;
if ((flags & GLOB_DOOFFS) && ignore < pglob->gl_offs)
ignore = pglob->gl_offs;
@ -932,12 +1023,12 @@ glob (const char *pattern, int flags,
if (flags & GLOB_MARK)
{
/* Append slashes to directory names. */
size_t i;
int i;
struct stat st;
for (i = oldcount; i < pglob->gl_pathc; ++i)
if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (pglob->gl_pathv[i], &st)
: stat (pglob->gl_pathv[i], &st)) == 0
: __stat (pglob->gl_pathv[i], &st)) == 0
&& S_ISDIR (st.st_mode))
{
size_t len = strlen (pglob->gl_pathv[i]) + 2;
@ -955,12 +1046,12 @@ glob (const char *pattern, int flags,
if (!(flags & GLOB_NOSORT))
{
/* Sort the vector. */
size_t non_sort = oldcount;
int non_sort = oldcount;
if ((flags & GLOB_DOOFFS) && pglob->gl_offs > oldcount)
non_sort = pglob->gl_offs;
qsort ((void *) &pglob->gl_pathv[non_sort],
qsort ((__ptr_t) &pglob->gl_pathv[non_sort],
pglob->gl_pathc - non_sort,
sizeof (char *), collated_compare);
}
@ -971,22 +1062,25 @@ glob (const char *pattern, int flags,
/* Free storage allocated in PGLOB by a previous `glob' call. */
void
globfree (glob_t *pglob)
globfree (pglob)
register glob_t *pglob;
{
if (pglob->gl_pathv != NULL)
{
size_t i;
register int i;
for (i = 0; i < pglob->gl_pathc; ++i)
if (pglob->gl_pathv[i] != NULL)
free (pglob->gl_pathv[i]);
free (pglob->gl_pathv);
free ((__ptr_t) pglob->gl_pathv[i]);
free ((__ptr_t) pglob->gl_pathv);
}
}
/* Do a collated comparison of A and B. */
static int
collated_compare (const void *a, const void *b)
collated_compare (a, b)
const __ptr_t a;
const __ptr_t b;
{
const char *const s1 = *(const char *const * const) a;
const char *const s2 = *(const char *const * const) b;
@ -1006,12 +1100,15 @@ collated_compare (const void *a, const void *b)
A slash is inserted between DIRNAME and each elt of ARRAY,
unless DIRNAME is just "/". Each old element of ARRAY is freed. */
static int
prefix_array (const char *dirname, char **array, size_t n)
prefix_array (dirname, array, n)
const char *dirname;
char **array;
size_t n;
{
size_t i;
register size_t i;
size_t dirlen = strlen (dirname);
#if MK_OS_DOS || MK_OS_W32
char sep_char = '/';
#if defined __MSDOS__ || defined WINDOWS32
int sep_char = '/';
# define DIRSEP_CHAR sep_char
#else
# define DIRSEP_CHAR '/'
@ -1021,7 +1118,7 @@ prefix_array (const char *dirname, char **array, size_t n)
/* DIRNAME is just "/", so normal prepending would get us "//foo".
We want "/foo" instead, so don't prepend any chars from DIRNAME. */
dirlen = 0;
#if MK_OS_DOS || MK_OS_W32
#if defined __MSDOS__ || defined WINDOWS32
else if (dirlen > 1)
{
if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
@ -1043,7 +1140,7 @@ prefix_array (const char *dirname, char **array, size_t n)
if (new == NULL)
{
while (i > 0)
free (array[--i]);
free ((__ptr_t) array[--i]);
return 1;
}
@ -1058,7 +1155,7 @@ prefix_array (const char *dirname, char **array, size_t n)
new[dirlen] = DIRSEP_CHAR;
memcpy (&new[dirlen + 1], array[i], eltlen);
#endif
free (array[i]);
free ((__ptr_t) array[i]);
array[i] = new;
}
@ -1067,13 +1164,15 @@ prefix_array (const char *dirname, char **array, size_t n)
/* We must not compile this function twice. */
#if !defined NO_GLOB_PATTERN_P
#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
/* Return nonzero if PATTERN contains any metacharacters.
Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
int
__glob_pattern_p (const char *pattern, int quote)
__glob_pattern_p (pattern, quote)
const char *pattern;
int quote;
{
const char *p;
register const char *p;
int open = 0;
for (p = pattern; *p != '\0'; ++p)
@ -1100,6 +1199,9 @@ __glob_pattern_p (const char *pattern, int quote)
return 0;
}
# ifdef _LIBC
weak_alias (__glob_pattern_p, glob_pattern_p)
# endif
#endif
@ -1108,10 +1210,14 @@ __glob_pattern_p (const char *pattern, int quote)
The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
The GLOB_APPEND flag is assumed to be set (always appends). */
static int
glob_in_dir (const char *pattern, const char *directory, int flags,
int (*errfunc) (const char *, int), glob_t *pglob)
glob_in_dir (pattern, directory, flags, errfunc, pglob)
const char *pattern;
const char *directory;
int flags;
int (*errfunc) __P ((const char *, int));
glob_t *pglob;
{
void *stream = NULL;
__ptr_t stream = NULL;
struct globlink
{
@ -1123,7 +1229,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
int meta;
int save;
#if MK_OS_VMS
#ifdef VMS
if (*directory == 0)
directory = "[]";
#endif
@ -1155,7 +1261,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
# endif
if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (fullname, &st)
: stat (fullname, &st)) == 0)
: __stat (fullname, &st)) == 0)
/* We found this file to be existing. Now tell the rest
of the function to copy this name into the result. */
flags |= GLOB_NOCHECK;
@ -1182,7 +1288,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
{
stream = ((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_opendir) (directory)
: (void *) opendir (directory));
: (__ptr_t) opendir (directory));
if (stream == NULL)
{
if (errno != ENOTDIR
@ -1219,7 +1325,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
/* If we shall match only directories use the information
provided by the dirent call if possible. */
if ((flags & GLOB_ONLYDIR)
&& d->d_type != DT_UNKNOWN && d->d_type != DT_DIR && d->d_type != DT_LNK)
&& d->d_type != DT_UNKNOWN && d->d_type != DT_DIR)
continue;
#endif
@ -1234,9 +1340,10 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
if (new->name == NULL)
goto memory_error;
#ifdef HAVE_MEMPCPY
*((char *) mempcpy (new->name, name, len)) = '\0';
*((char *) mempcpy ((__ptr_t) new->name, name, len))
= '\0';
#else
memcpy (new->name, name, len);
memcpy ((__ptr_t) new->name, name, len);
new->name[len] = '\0';
#endif
new->next = names;
@ -1301,7 +1408,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
memory_error:
{
save = errno;
int save = errno;
if (flags & GLOB_ALTDIRFUNC)
(*pglob->gl_closedir) (stream);
else
@ -1311,7 +1418,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
while (names != NULL)
{
if (names->name != NULL)
free (names->name);
free ((__ptr_t) names->name);
names = names->next;
}
return GLOB_NOSPACE;

View File

@ -1,5 +1,5 @@
/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2023 Free Software
Foundation, Inc.
/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998 Free Software Foundation,
Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@ -12,18 +12,67 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB.
If not, see <https://www.gnu.org/licenses/>. */
along with this library; see the file COPYING.LIB. If not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA. */
#ifndef _GLOB_H
#define _GLOB_H 1
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#undef __ptr_t
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
# if !defined __GLIBC__
# undef __P
# undef __PMT
# define __P(protos) protos
# define __PMT(protos) protos
# if !defined __GNUC__ || __GNUC__ < 2
# undef __const
# define __const const
# endif
# endif
# define __ptr_t void *
#else /* Not C++ or ANSI C. */
# undef __P
# undef __PMT
# define __P(protos) ()
# define __PMT(protos) ()
# undef __const
# define __const
# define __ptr_t char *
#endif /* C++ or ANSI C. */
/* We need `size_t' for the following definitions. */
#ifndef __size_t
# if defined __FreeBSD__
# define __size_t size_t
# else
# if defined __GNUC__ && __GNUC__ >= 2
typedef __SIZE_TYPE__ __size_t;
# else
/* This is a guess. */
/*hb
* Conflicts with DECCs already defined type __size_t.
* Defining an own type with a name beginning with '__' is no good.
* Anyway if DECC is used and __SIZE_T is defined then __size_t is
* already defined (and I hope it's exactly the one we need here).
*/
# if !(defined __DECC && defined __SIZE_T)
typedef unsigned long int __size_t;
# endif
# endif
# endif
#else
/* The GNU CC stddef.h version defines __size_t as empty. We need a real
definition. */
# undef __size_t
# define __size_t size_t
#endif
/* Bits set in the FLAGS argument to `glob'. */
#define GLOB_ERR (1 << 0)/* Return on read errors. */
#define GLOB_MARK (1 << 1)/* Append a slash to each name. */
@ -66,26 +115,26 @@ extern "C" {
#endif
/* Structure describing a globbing run. */
#if !defined _AMIGA && !MK_OS_VMS /* Buggy compiler. */
#if !defined _AMIGA && !defined VMS /* Buggy compiler. */
struct stat;
#endif
typedef struct
{
size_t gl_pathc; /* Count of paths matched by the pattern. */
__size_t gl_pathc; /* Count of paths matched by the pattern. */
char **gl_pathv; /* List of matched pathnames. */
size_t gl_offs; /* Slots to reserve in `gl_pathv'. */
__size_t gl_offs; /* Slots to reserve in `gl_pathv'. */
int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
are used instead of the normal file access functions. */
void (*gl_closedir) (void *);
struct dirent *(*gl_readdir) (void *);
void * (*gl_opendir) (const char *);
int (*gl_lstat) (const char *, struct stat *);
#if MK_OS_VMS && defined(__DECC) && !defined(_POSIX_C_SOURCE)
int (*gl_stat) (const char *, struct stat *, ...);
void (*gl_closedir) __PMT ((void *));
struct dirent *(*gl_readdir) __PMT ((void *));
__ptr_t (*gl_opendir) __PMT ((__const char *));
int (*gl_lstat) __PMT ((__const char *, struct stat *));
#if defined(VMS) && defined(__DECC) && !defined(_POSIX_C_SOURCE)
int (*gl_stat) __PMT ((__const char *, struct stat *, ...));
#else
int (*gl_stat) (const char *, struct stat *);
int (*gl_stat) __PMT ((__const char *, struct stat *));
#endif
} glob_t;
@ -93,18 +142,18 @@ typedef struct
struct stat64;
typedef struct
{
size_t gl_pathc;
__size_t gl_pathc;
char **gl_pathv;
size_t gl_offs;
__size_t gl_offs;
int gl_flags;
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
are used instead of the normal file access functions. */
void (*gl_closedir) (void *);
struct dirent64 *(*gl_readdir) (void *);
void * (*gl_opendir) (const char *);
int (*gl_lstat) (const char *, struct stat64 *);
int (*gl_stat) (const char *, struct stat64 *);
void (*gl_closedir) __PMT ((void *));
struct dirent64 *(*gl_readdir) __PMT ((void *));
__ptr_t (*gl_opendir) __PMT ((__const char *));
int (*gl_lstat) __PMT ((__const char *, struct stat64 *));
int (*gl_stat) __PMT ((__const char *, struct stat64 *));
} glob64_t;
#endif
@ -113,11 +162,11 @@ typedef struct
# define globfree globfree64
#else
# ifdef _LARGEFILE64_SOURCE
extern int glob64 (const char *pattern, int flags,
int (*errfunc) (const char *, int),
glob64_t *pglob);
extern int glob64 __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob64_t *__pglob));
extern void globfree64 (glob64_t *pglob);
extern void globfree64 __P ((glob64_t *__pglob));
# endif
#endif
@ -130,18 +179,18 @@ extern void globfree64 (glob64_t *pglob);
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
#if _FILE_OFFSET_BITS != 64 || __GNUC__ < 2
extern int glob (const char *pattern, int flags,
int (*errfunc) (const char *, int),
glob_t *pglob);
extern int glob __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob_t *__pglob));
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree (glob_t *pglob);
extern void globfree __P ((glob_t *__pglob));
#else
extern int glob (const char *pattern, int flags,
int (*errfunc) (const char *, int),
glob_t *pglob) __asm__ ("glob64");
extern int glob __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob_t *__pglob)) __asm__ ("glob64");
extern void globfree (glob_t *pglob) __asm__ ("globfree64");
extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64");
#endif
@ -151,7 +200,7 @@ extern void globfree (glob_t *pglob) __asm__ ("globfree64");
This function is not part of the interface specified by POSIX.2
but several programs want to use it. */
extern int glob_pattern_p (const char *pattern, int quote);
extern int glob_pattern_p __P ((__const char *__pattern, int __quote));
#endif
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
;; Contents of the (GNU Make) Guile module
;; Copyright (C) 2011-2024 Free Software Foundation, Inc.
;; Contents of the (gnu make) Guile module
;; Copyright (C) 2011-2013 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
@ -13,11 +13,11 @@
;; details.
;;
;; You should have received a copy of the GNU General Public License along
;; with this program. If not, see <https://www.gnu.org/licenses/>.
;; with this program. If not, see <http://www.gnu.org/licenses/>.
(define (to-string-maybe x)
(cond
;; In GNU Make, "false" is the empty string
;; In GNU make, "false" is the empty string
((or (not x)
(unspecified? x)
(variable? x)
@ -45,7 +45,7 @@
(walk x)
(string-join (reverse! acc))))
;; Return the value of the GNU Make variable V
;; Return the value of the GNU make variable V
(define (gmk-var v)
(gmk-expand (format #f "$(~a)" (obj-to-str v))))

73
gnumake.h Normal file
View File

@ -0,0 +1,73 @@
/* External interfaces usable by dynamic objects loaded into GNU Make.
--THIS API IS A "TECHNOLOGY PREVIEW" ONLY. IT IS NOT A STABLE INTERFACE--
Copyright (C) 2013 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 3 of the License, 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
this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GNUMAKE_H_
#define _GNUMAKE_H_
/* Specify the location of elements read from makefiles. */
typedef struct
{
const char *filenm;
unsigned long lineno;
} gmk_floc;
#ifdef _WIN32
# ifdef GMK_BUILDING_MAKE
# define GMK_EXPORT __declspec(dllexport)
# else
# define GMK_EXPORT __declspec(dllimport)
# endif
#else
# define GMK_EXPORT
#endif
/* Free memory returned by the gmk_expand() function. */
void GMK_EXPORT gmk_free (char *str);
/* Allocate memory in GNU make's context. */
char * GMK_EXPORT gmk_alloc (unsigned int len);
/* Run $(eval ...) on the provided string BUFFER. */
void GMK_EXPORT gmk_eval (const char *buffer, const gmk_floc *floc);
/* Run GNU make expansion on the provided string STR.
Returns an allocated buffer that the caller must free with gmk_free(). */
char * GMK_EXPORT gmk_expand (const char *str);
/* Register a new GNU make function NAME (maximum of 255 chars long).
When the function is expanded in the makefile, FUNC will be invoked with
the appropriate arguments.
The return value of FUNC must be either NULL, in which case it expands to
the empty string, or a pointer to the result of the expansion in a string
created by gmk_alloc(). GNU make will free the memory when it's done.
MIN_ARGS is the minimum number of arguments the function requires.
MAX_ARGS is the maximum number of arguments (or 0 if there's no maximum).
MIN_ARGS and MAX_ARGS must be >= 0 and <= 255.
If EXPAND_ARGS is 0, the arguments to the function will not be expanded
before FUNC is called. If EXPAND_ARGS is non-0, they will be expanded.
*/
void GMK_EXPORT gmk_add_function (const char *name,
char *(*func)(const char *nm,
int argc, char **argv),
int min_args, int max_args, int expand_args);
#endif /* _GNUMAKE_H_ */

View File

@ -1,5 +1,5 @@
/* GNU Guile interface for GNU Make.
Copyright (C) 2011-2024 Free Software Foundation, Inc.
Copyright (C) 2011-2013 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
@ -12,31 +12,17 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#ifdef HAVE_GUILE
#include "gnumake.h"
#include "debug.h"
#include "filedef.h"
#include "dep.h"
#include "variable.h"
#include <libguile.h>
/* Pre-2.0 versions of Guile don't have a typedef for gsubr function types. */
#if SCM_MAJOR_VERSION < 2
# define GSUBR_TYPE SCM (*) ()
/* Guile 1.x doesn't really support i18n. */
# define EVAL_STRING(_s) scm_c_eval_string (_s)
#else
# define GSUBR_TYPE scm_t_subr
# define EVAL_STRING(_s) scm_eval_string (scm_from_utf8_string (_s))
#endif
static SCM make_mod = SCM_EOL;
static SCM obj_to_str = SCM_EOL;
@ -47,7 +33,7 @@ cvt_scm_to_str (SCM obj)
return scm_to_locale_string (scm_call_1 (obj_to_str, obj));
}
/* Perform the GNU Make expansion function. */
/* Perform the GNU make expansion function. */
static SCM
guile_expand_wrapper (SCM obj)
{
@ -65,7 +51,7 @@ guile_expand_wrapper (SCM obj)
return ret;
}
/* Perform the GNU Make eval function. */
/* Perform the GNU make eval function. */
static SCM
guile_eval_wrapper (SCM obj)
{
@ -77,24 +63,24 @@ guile_eval_wrapper (SCM obj)
return SCM_BOOL_F;
}
/* Invoked by scm_c_define_module(), in the context of the GNU Make module. */
/* Invoked by scm_c_define_module(), in the context of the GNU make module. */
static void
guile_define_module (void *data UNUSED)
{
/* Ingest the predefined Guile module for GNU Make. */
/* Ingest the predefined Guile module for GNU make. */
#include "gmk-default.h"
/* Register a subr for GNU Make's eval capability. */
scm_c_define_gsubr ("gmk-expand", 1, 0, 0, (GSUBR_TYPE) guile_expand_wrapper);
/* Register a subr for GNU make's eval capability. */
scm_c_define_gsubr ("gmk-expand", 1, 0, 0, guile_expand_wrapper);
/* Register a subr for GNU Make's eval capability. */
scm_c_define_gsubr ("gmk-eval", 1, 0, 0, (GSUBR_TYPE) guile_eval_wrapper);
/* Register a subr for GNU make's eval capability. */
scm_c_define_gsubr ("gmk-eval", 1, 0, 0, guile_eval_wrapper);
/* Define the rest of the module. */
scm_c_eval_string (GUILE_module_defn);
}
/* Initialize the GNU Make Guile module. */
/* Initialize the GNU make Guile module. */
static void *
guile_init (void *arg UNUSED)
{
@ -104,7 +90,7 @@ guile_init (void *arg UNUSED)
/* Get a reference to the object-to-string translator, for later. */
obj_to_str = scm_variable_ref (scm_c_module_lookup (make_mod, "obj-to-str"));
/* Import the GNU Make module exports into the generic space. */
/* Import the GNU make module exports into the generic space. */
scm_c_eval_string ("(use-modules (gnu make))");
return NULL;
@ -113,22 +99,13 @@ guile_init (void *arg UNUSED)
static void *
internal_guile_eval (void *arg)
{
return cvt_scm_to_str (EVAL_STRING (arg));
return cvt_scm_to_str (scm_c_eval_string (arg));
}
/* This is the function registered with make */
static char *
func_guile (const char *funcname UNUSED, unsigned int argc UNUSED, char **argv)
func_guile (const char *funcname UNUSED, int argc UNUSED, char **argv)
{
static int init = 0;
if (! init)
{
/* Initialize the Guile interpreter. */
scm_with_guile (guile_init, NULL);
init = 1;
}
if (argv[0] && argv[0][0] != '\0')
return scm_with_guile (internal_guile_eval, argv[0]);
@ -140,20 +117,13 @@ func_guile (const char *funcname UNUSED, unsigned int argc UNUSED, char **argv)
/* We could send the flocp to define_new_function(), but since guile is
"kind of" built-in, that didn't seem so useful. */
int
guile_gmake_setup (const floc *flocp UNUSED)
guile_gmake_setup (const gmk_floc *flocp UNUSED)
{
/* Initialize the Guile interpreter. */
scm_with_guile (guile_init, NULL);
/* Create a make function "guile". */
gmk_add_function ("guile", func_guile, 0, 1, GMK_FUNC_DEFAULT);
gmk_add_function ("guile", func_guile, 0, 1, 1);
return 1;
}
#else
int
guile_gmake_setup (const floc *flocp UNUSED)
{
return 1;
}
#endif

View File

@ -12,13 +12,12 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "hash.h"
#include <assert.h>
#define CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n)))
#define CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n)))
#define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n)))
#define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n)))
#define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n)))
@ -33,7 +32,7 @@ static unsigned long round_up_2 __P((unsigned long rough));
potentially hit every slot in the table during collision
resolution. */
const void *hash_deleted_item = &hash_deleted_item;
void *hash_deleted_item = &hash_deleted_item;
/* Force the table size to be a power of two, possibly rounding up the
given size. */
@ -44,12 +43,12 @@ hash_init (struct hash_table *ht, unsigned long size,
{
ht->ht_size = round_up_2 (size);
ht->ht_empty_slots = ht->ht_size;
ht->ht_vec = CALLOC (void *, ht->ht_size);
ht->ht_vec = (void**) CALLOC (struct token *, ht->ht_size);
if (ht->ht_vec == 0)
{
fprintf (stderr, _("can't allocate %lu bytes for hash table: memory exhausted"),
ht->ht_size * (unsigned long) sizeof (void *));
exit (MAKE_TROUBLE);
ht->ht_size * (unsigned long) sizeof (struct token *));
exit (1);
}
ht->ht_capacity = ht->ht_size - (ht->ht_size / 16); /* 93.75% loading factor */
@ -65,10 +64,10 @@ hash_init (struct hash_table *ht, unsigned long size,
/* Load an array of items into 'ht'. */
void
hash_load (struct hash_table *ht, const void *item_table,
hash_load (struct hash_table *ht, void *item_table,
unsigned long cardinality, unsigned long size)
{
const char *items = (const char *) item_table;
char *items = (char *) item_table;
while (cardinality--)
{
hash_insert (ht, items);
@ -96,22 +95,22 @@ hash_find_slot (struct hash_table *ht, const void *key)
slot = &ht->ht_vec[hash_1];
if (*slot == 0)
return (deleted_slot ? deleted_slot : slot);
return (deleted_slot ? deleted_slot : slot);
if (*slot == hash_deleted_item)
{
if (deleted_slot == 0)
deleted_slot = slot;
}
{
if (deleted_slot == 0)
deleted_slot = slot;
}
else
{
if (key == *slot)
return slot;
if ((*ht->ht_compare) (key, *slot) == 0)
return slot;
ht->ht_collisions++;
}
{
if (key == *slot)
return slot;
if ((*ht->ht_compare) (key, *slot) == 0)
return slot;
ht->ht_collisions++;
}
if (!hash_2)
hash_2 = (*ht->ht_hash_2) (key) | 1;
hash_2 = (*ht->ht_hash_2) (key) | 1;
hash_1 += hash_2;
}
}
@ -140,7 +139,7 @@ hash_insert_at (struct hash_table *ht, const void *item, const void *slot)
{
ht->ht_fill++;
if (old_item == 0)
ht->ht_empty_slots--;
ht->ht_empty_slots--;
old_item = item;
}
*(void const **) slot = item;
@ -183,7 +182,7 @@ hash_free_items (struct hash_table *ht)
{
void *item = *vec;
if (!HASH_VACANT (item))
free (item);
free (item);
*vec = 0;
}
ht->ht_fill = 0;
@ -228,7 +227,7 @@ hash_map (struct hash_table *ht, hash_map_func_t map)
for (slot = ht->ht_vec; slot < end; slot++)
{
if (!HASH_VACANT (*slot))
(*map) (*slot);
(*map) (*slot);
}
}
@ -241,7 +240,7 @@ hash_map_arg (struct hash_table *ht, hash_map_arg_func_t map, void *arg)
for (slot = ht->ht_vec; slot < end; slot++)
{
if (!HASH_VACANT (*slot))
(*map) (*slot, arg);
(*map) (*slot, arg);
}
}
@ -260,15 +259,15 @@ hash_rehash (struct hash_table *ht)
ht->ht_capacity = ht->ht_size - (ht->ht_size >> 4);
}
ht->ht_rehashes++;
ht->ht_vec = CALLOC (void *, ht->ht_size);
ht->ht_vec = (void **) CALLOC (struct token *, ht->ht_size);
for (ovp = old_vec; ovp < &old_vec[old_ht_size]; ovp++)
{
if (! HASH_VACANT (*ovp))
{
void **slot = hash_find_slot (ht, *ovp);
*slot = *ovp;
}
{
void **slot = hash_find_slot (ht, *ovp);
*slot = *ovp;
}
}
ht->ht_empty_slots = ht->ht_size - ht->ht_fill;
free (old_vec);
@ -277,13 +276,14 @@ hash_rehash (struct hash_table *ht)
void
hash_print_stats (struct hash_table *ht, FILE *out_FILE)
{
fprintf (out_FILE, _("Load=%lu/%lu=%.0f%%, "), ht->ht_fill, ht->ht_size,
100.0 * (double) ht->ht_fill / (double) ht->ht_size);
fprintf (out_FILE, _("Rehash=%u, "), ht->ht_rehashes);
fprintf (out_FILE, _("Collisions=%lu/%lu=%.0f%%"), ht->ht_collisions, ht->ht_lookups,
(ht->ht_lookups
? (100.0 * (double) ht->ht_collisions / (double) ht->ht_lookups)
: 0));
/* GKM FIXME: honor NO_FLOAT */
fprintf (out_FILE, _("Load=%ld/%ld=%.0f%%, "), ht->ht_fill, ht->ht_size,
100.0 * (double) ht->ht_fill / (double) ht->ht_size);
fprintf (out_FILE, _("Rehash=%d, "), ht->ht_rehashes);
fprintf (out_FILE, _("Collisions=%ld/%ld=%.0f%%"), ht->ht_collisions, ht->ht_lookups,
(ht->ht_lookups
? (100.0 * (double) ht->ht_collisions / (double) ht->ht_lookups)
: 0));
}
/* Dump all items into a NULL-terminated vector. Use the
@ -328,174 +328,3 @@ round_up_2 (unsigned long n)
return n + 1;
}
#define rol32(v, n) \
((v) << (n) | ((v) >> (32 - (n))))
/* jhash_mix -- mix 3 32-bit values reversibly. */
#define jhash_mix(a, b, c) \
{ \
a -= c; a ^= rol32(c, 4); c += b; \
b -= a; b ^= rol32(a, 6); a += c; \
c -= b; c ^= rol32(b, 8); b += a; \
a -= c; a ^= rol32(c, 16); c += b; \
b -= a; b ^= rol32(a, 19); a += c; \
c -= b; c ^= rol32(b, 4); b += a; \
}
/* jhash_final - final mixing of 3 32-bit values (a,b,c) into c */
#define jhash_final(a, b, c) \
{ \
c ^= b; c -= rol32(b, 14); \
a ^= c; a -= rol32(c, 11); \
b ^= a; b -= rol32(a, 25); \
c ^= b; c -= rol32(b, 16); \
a ^= c; a -= rol32(c, 4); \
b ^= a; b -= rol32(a, 14); \
c ^= b; c -= rol32(b, 24); \
}
/* An arbitrary initial parameter */
#define JHASH_INITVAL 0xdeadbeef
#define sum_get_unaligned_32(r, p) \
do { \
unsigned int val; \
memcpy (&val, (p), 4); \
r += val; \
} while(0);
unsigned int
jhash(unsigned const char *k, int length)
{
unsigned int a, b, c;
/* Set up the internal state */
a = b = c = JHASH_INITVAL + length;
/* All but the last block: affect some 32 bits of (a,b,c) */
while (length > 12) {
sum_get_unaligned_32(a, k);
sum_get_unaligned_32(b, k + 4);
sum_get_unaligned_32(c, k + 8);
jhash_mix(a, b, c);
length -= 12;
k += 12;
}
if (!length)
return c;
if (length > 8)
{
sum_get_unaligned_32(a, k);
length -= 4;
k += 4;
}
if (length > 4)
{
sum_get_unaligned_32(b, k);
length -= 4;
k += 4;
}
if (length == 4)
c += (unsigned)k[3]<<24;
if (length >= 3)
c += (unsigned)k[2]<<16;
if (length >= 2)
c += (unsigned)k[1]<<8;
c += k[0];
jhash_final(a, b, c);
return c;
}
#define UINTSZ sizeof (unsigned int)
#ifdef WORDS_BIGENDIAN
/* The ifs are ordered from the first byte in memory to the last.
Help the compiler optimize by using static memcpy length. */
#define sum_up_to_nul(r, p, plen, flag) \
do { \
unsigned int val = 0; \
size_t pn = (plen); \
if (pn >= UINTSZ) \
memcpy (&val, (p), UINTSZ); \
else \
memcpy (&val, (p), pn); \
if ((val & 0xFF000000) == 0) \
flag = 1; \
else if ((val & 0xFF0000) == 0) \
r += val & ~0xFFFF, flag = 1; \
else if ((val & 0xFF00) == 0) \
r += val & ~0xFF, flag = 1; \
else \
r += val, flag = (val & 0xFF) == 0; \
} while (0)
#else
/* First detect the presence of zeroes. If there is none, we can
sum the 4 bytes directly. Otherwise, the ifs are ordered as in the
big endian case, from the first byte in memory to the last.
Help the compiler optimize by using static memcpy length. */
#define sum_up_to_nul(r, p, plen, flag) \
do { \
unsigned int val = 0; \
size_t pn = (plen); \
if (pn >= UINTSZ) \
memcpy (&val, (p), UINTSZ); \
else \
memcpy (&val, (p), pn); \
flag = ((val - 0x01010101) & ~val) & 0x80808080; \
if (!flag) \
r += val; \
else if (val & 0xFF) \
{ \
if ((val & 0xFF00) == 0) \
r += val & 0xFF; \
else if ((val & 0xFF0000) == 0) \
r += val & 0xFFFF; \
else \
r += val; \
} \
} while (0)
#endif
unsigned int
jhash_string(unsigned const char *k)
{
unsigned int a, b, c;
unsigned int have_nul = 0;
unsigned const char *start = k;
size_t klen = strlen ((const char*)k);
/* Set up the internal state */
a = b = c = JHASH_INITVAL;
/* All but the last block: affect some 32 bits of (a,b,c) */
for (;;) {
sum_up_to_nul(a, k, klen, have_nul);
if (have_nul)
break;
k += UINTSZ;
assert (klen >= UINTSZ);
klen -= UINTSZ;
sum_up_to_nul(b, k, klen, have_nul);
if (have_nul)
break;
k += UINTSZ;
assert (klen >= UINTSZ);
klen -= UINTSZ;
sum_up_to_nul(c, k, klen, have_nul);
if (have_nul)
break;
k += UINTSZ;
assert (klen >= UINTSZ);
klen -= UINTSZ;
jhash_mix(a, b, c);
}
jhash_final(a, b, c);
return c + (unsigned) (k - start);
}

View File

@ -12,7 +12,7 @@ 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
this program. If not, see <https://www.gnu.org/licenses/>. */
this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _hash_h_
#define _hash_h_
@ -20,7 +20,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <ctype.h>
#if defined __cplusplus || (defined __STDC__ && __STDC__) || MK_OS_W32
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
# if !defined __GLIBC__ || !defined __P
# undef __P
# define __P(protos) protos
@ -56,9 +56,9 @@ struct hash_table
typedef int (*qsort_cmp_t) __P((void const *, void const *));
void hash_init __P((struct hash_table *ht, unsigned long size,
hash_func_t hash_1, hash_func_t hash_2, hash_cmp_func_t hash_cmp));
void hash_load __P((struct hash_table *ht, const void *item_table,
unsigned long cardinality, unsigned long size));
hash_func_t hash_1, hash_func_t hash_2, hash_cmp_func_t hash_cmp));
void hash_load __P((struct hash_table *ht, void *item_table,
unsigned long cardinality, unsigned long size));
void **hash_find_slot __P((struct hash_table *ht, void const *key));
void *hash_find_item __P((struct hash_table *ht, void const *key));
void *hash_insert __P((struct hash_table *ht, const void *item));
@ -73,10 +73,7 @@ void hash_map_arg __P((struct hash_table *ht, hash_map_arg_func_t map, void *arg
void hash_print_stats __P((struct hash_table *ht, FILE *out_FILE));
void **hash_dump __P((struct hash_table *ht, void **vector_0, qsort_cmp_t compare));
extern unsigned jhash(unsigned char const *key, int n);
extern unsigned jhash_string(unsigned char const *key);
extern const void *hash_deleted_item;
extern void *hash_deleted_item;
#define HASH_VACANT(item) ((item) == 0 || (void *) (item) == hash_deleted_item)
@ -86,8 +83,9 @@ extern const void *hash_deleted_item;
be identical. Take advantage of that to short-circuit string compares. */
#define STRING_HASH_1(KEY, RESULT) do { \
unsigned char const *_key_ = (unsigned char const *) (KEY); \
(RESULT) += jhash_string(_key_); \
unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
while (*++_key_) \
(RESULT) += (*_key_ << (_key_[1] & 0xf)); \
} while (0)
#define return_STRING_HASH_1(KEY) do { \
unsigned long _result_ = 0; \
@ -95,11 +93,10 @@ extern const void *hash_deleted_item;
return _result_; \
} while (0)
/* No need for a second hash because jhash already provides
pretty good results. However, do evaluate the arguments
to avoid warnings. */
#define STRING_HASH_2(KEY, RESULT) do { \
(void)(KEY); \
unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
while (*++_key_) \
(RESULT) += (*_key_ << (_key_[1] & 0x7)); \
} while (0)
#define return_STRING_HASH_2(KEY) do { \
unsigned long _result_ = 0; \
@ -116,24 +113,27 @@ extern const void *hash_deleted_item;
#define STRING_N_HASH_1(KEY, N, RESULT) do { \
unsigned char const *_key_ = (unsigned char const *) (KEY); \
(RESULT) += jhash(_key_, N); \
unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
int _n_ = (N); \
if (_n_) \
while (--_n_ && *++_key_) \
(RESULT) += (*_key_ << (_key_[1] & 0xf)); \
(RESULT) += *++_key_; \
} while (0)
#define return_STRING_N_HASH_1(KEY, N) do { \
unsigned long _result_ = 0; \
STRING_N_HASH_1 ((KEY), (N), _result_); \
return _result_; \
} while (0)
/* No need for a second hash because jhash already provides
pretty good results. However, do evaluate the arguments
to avoid warnings. */
#define STRING_N_HASH_2(KEY, N, RESULT) do { \
(void)(KEY); \
(void)(N); \
unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
int _n_ = (N); \
if (_n_) \
while (--_n_ && *++_key_) \
(RESULT) += (*_key_ << (_key_[1] & 0x7)); \
(RESULT) += *++_key_; \
} while (0)
#define return_STRING_N_HASH_2(KEY, N) do { \
unsigned long _result_ = 0; \
STRING_N_HASH_2 ((KEY), (N), _result_); \
@ -141,10 +141,10 @@ extern const void *hash_deleted_item;
} while (0)
#define STRING_N_COMPARE(X, Y, N, RESULT) do { \
RESULT = (X) == (Y) ? 0 : memcmp ((X), (Y), (N)); \
RESULT = (X) == (Y) ? 0 : strncmp ((X), (Y), (N)); \
} while (0)
#define return_STRING_N_COMPARE(X, Y, N) do { \
return (X) == (Y) ? 0 : memcmp ((X), (Y), (N)); \
return (X) == (Y) ? 0 : strncmp ((X), (Y), (N)); \
} while (0)
#ifdef HAVE_CASE_INSENSITIVE_FS
@ -154,7 +154,7 @@ extern const void *hash_deleted_item;
#define ISTRING_HASH_1(KEY, RESULT) do { \
unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
while (*++_key_) \
(RESULT) += (tolower (*_key_) << (_key_[1] & 0xf)); \
(RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0xf)); \
} while (0)
#define return_ISTRING_HASH_1(KEY) do { \
unsigned long _result_ = 0; \
@ -165,7 +165,7 @@ extern const void *hash_deleted_item;
#define ISTRING_HASH_2(KEY, RESULT) do { \
unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
while (*++_key_) \
(RESULT) += (tolower (*_key_) << (_key_[1] & 0x7)); \
(RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0x7)); \
} while (0)
#define return_ISTRING_HASH_2(KEY) do { \
unsigned long _result_ = 0; \

Some files were not shown because too many files have changed in this diff Show More