Commit Graph

3084 Commits

Author SHA1 Message Date
Dmitry Goncharov
9b6fedef1c * src/main.c (main): Install suffix rules near pattern updates 2023-02-21 00:04:13 -05:00
Paul Smith
8ddb628927 * Makefile.am: Add mkconfig.h to the test error file 2023-02-20 23:29:26 -05:00
Dmitry Goncharov
e9dd614d73 [SV 63821] Don't set up default suffix rules if makefile sets -r
When built-in rules are disabled by adding -r to MAKEFLAGS in the
makefile, don't add suffix rules at all so that if suffixes are
added back via .SUFFIXES, the rules are still not there.

* src/main.c (main): Set default suffix rules after parsing makefiles.
* src/default.c (install_default_suffix_rules): Install a default
suffix rule only if there is no user defined rule.
* tests/scripts/features/suffixrules: Add tests.
2023-02-20 15:17:24 -05:00
Paul Smith
f5dc17ac2d * tests/scripts/misc/general4: Only test empty PATH on UNIX 2023-02-20 11:11:59 -05:00
Paul Smith
ac159491da * gl/modules/make-glob: Avoid glibc glob if bug #866 is present 2023-02-19 17:43:12 -05:00
Paul Smith
4436655568 * tests/scripts/features/include [AIX]: Set explicit timestamps 2023-02-19 15:35:22 -05:00
Paul Smith
549fc56102 * tests/scripts/features/archives: Set CC properly 2023-02-19 14:49:56 -05:00
Paul Smith
37e0010743 Prerelease GNU Make 4.4.0.91
* NEWS: Update the date.
* configure.ac: Change the release.
2023-02-19 09:53:26 -05:00
Paul Smith
536c3e2b37 * src/makeint.h [CYGWIN]: Use pipe mode for the jobserver 2023-02-19 08:52:02 -05:00
Paul Smith
4c9b922560 Don't block for child exit if other commands have completed
Running regression tests on a single CPU system shows that if a child
exits while we're checking prerequisites we might not notice it, and
then we might block waiting for the next child to exit before we try
to do more work even though we could.

* src/remake.c (update_goal_chain): Remember the command_count before
we start checking prerequisites and if it is different when we restart
at the top of the goal chain then don't block.
2023-02-19 01:27:22 -05:00
Paul Smith
2449ef3c88 Clean up depth handling in debug output
The indentation shown in debug output was misleading.  Increment the
depth when we are working on a prerequisite, not for the current
target.

* src/remake.c (check_dep): Increment depth only on recursion.
(update_file_1): Ditto.  Don't show "Finished..." if prereqs are
still running.
* src/implicit.c (pattern_search): Increment depth for the entire
search.
* tests/scripts/features/output-sync: Support debug output when run
by hand.
2023-02-19 01:25:57 -05:00
Paul Smith
fbf8c940e5 * src/makeint.h (WIN32_LEAN_AND_MEAN) [Windows]: Don't redefine.
Suggested for tcc builds by Christian Jullien <eligis@orange.fr>.
2023-02-19 01:02:16 -05:00
KO Myung-Hun
62194015fa * src/misc.c (ttyname) [OS/2]: Add an implementation for OS/2 kLIBC 2023-02-19 01:02:16 -05:00
Paul Smith
c85f68c4e9 Allow jobserver style to be forced to "pipe"
Some systems that support mkfifo() don't support the usage that GNU
make wants.  Provide a way to force using "pipe" jobserver mode even
when mkfifo() is available.

* src/makeint.h (MK_OS_HURD): Define if we're on Hurd.
(JOBSERVER_USE_FIFO): Define if we have mkfifo() and we're NOT on
Hurd.
* src/main.c (main): Test JOBSERVER_USE_FIFO not HAVE_MKFIFO.
* src/posixos.c (jobserver_setup): Ditto.
* maintMakefile: Create a config check test for forcing "pipe" mode.
* tests/run_make_tests.pl: Show discovered FEATURES in verbose mode.
2023-02-19 01:02:16 -05:00
Paul Smith
ffa28f3914 [SV 63668] Use autoconf to detect the default C++ compiler
* configure.ac: Add AC_PROG_CXX to search for a C++ compiler.
(MAKE_CXX): Add the discovered compiler to config.h.
* src/default.c (default_variables): Use MAKE_CXX as the C++ compiler.
2023-02-05 10:22:13 -05:00
Paul Smith
8f03e69af0 * doc/make.texi: Fix typo (reported by <mao492479407@163.com>) 2023-02-05 09:42:49 -05:00
Paul Smith
e819fc2022 * tests/scripts/variables/MAKEFLAGS: Fix some Perl warnings 2023-02-04 13:12:32 -05:00
Dmitry Goncharov
f21cd822a3 * doc/make.texi: [SV 63689] Fix typos in examples 2023-01-28 13:09:36 -05:00
Paul Smith
2f336608d8 * src/job.c: Switch from bit operators to flags macros
* src/remake.c: Ditto.
2023-01-28 13:05:08 -05:00
Paul Smith
faedfdb0af [SV 63667] In .POSIX, use shell flags -c when ignoring errors
* src/variable.c (lookup_variable_for_file): New function to retrieve
a variable assignment in a file context.
* src/variable.h (lookup_variable_for_file): Declare it.
* src/job.c (construct_command_argv): Look up .SHELLFLAGS.  If .POSIX
is set and we're using the default value, choose -c if we're ignoring
errors else choose -ec.
(construct_command_argv_internal): Ditto.
* tests/scripts/targets/POSIX: Add tests.
2023-01-28 13:04:47 -05:00
Dmitry Goncharov
9709d273b2 * tests/scripts/features/archives: [SV 63688] Quote cmd line vars 2023-01-28 09:46:23 -05:00
Paul Smith
eb0bd1aaec * README.in: Mention README.z/OS 2023-01-28 09:28:18 -05:00
Paul Smith
d2bf740e77 * tests/test_driver.pl: Convert z/OS answers for regex output
Allow z/OS customizations to apply to regex output matching.
* tests/scripts/features/output-sync: Use a regex for Terminated.
* tests/scripts/features/temp_stdin: Ditto.
2023-01-15 16:35:57 -05:00
Paul Smith
a8890796a4 * tests/scripts/features/archives: Use the configured compiler for CC 2023-01-15 16:35:57 -05:00
Paul Smith
be6bb0fd68 * configure.ac: Delay setting HAVE_GUILE until we're sure 2023-01-15 10:27:34 -05:00
Paul Smith
db351fe85b Prerelease GNU Make 4.4.0.90
* NEWS: Update the date.
* README.git: Fix a typo.
* maintMakefile (check-alt-config): Report success.
(upload-*): Use the gnulib gnupload script for uploads.
2023-01-14 17:07:04 -05:00
Paul Smith
8a0d7fd4ef * tests/scripts/features/reinvoke: Warn about closing STDIN.
* tests/scripts/features/temp_stdin: Ditto.
* tests/scripts/options/dash-f: Ditto.
2023-01-11 20:35:11 -05:00
Eli Zaretskii
f51fc130cc [SV 63638] Fix processing PATH on MS-Windows
* src/variable.c (sync_Path_environment): Pass only the value of
PATH to convert_Path_to_windows32, excluding the "PATH=" part.
2023-01-11 15:44:56 +02:00
Paul Smith
b99b6cdf3c Update support for OS/2
Patches provided by KO Myung-Hun <komh78@gmail.com>

* NEWS: Add a note.
* AUTHORS: Add a new author.
* README.OS2: Updates to build instructions.
* src/dir.c (dir_contents_file_exists_p): Use a stack copy when
modifying a const string.
* src/job.c (construct_command_argv_internal): Ditto.
Reuse variables rather than re-defining them.
(exec_command): Cast a const string (we don't change it anyway).
* src/getopt.c (_getopt_initialize): Reference unused variables.
(_getopt_internal): Add block braces to quiet the compiler.
* src/main.c (main): Cast argument to child_execute_job().
* src/posixos.c (set_blocking): Reference unused variables.
* src/remake.c (f_mtime): Delete useless code.
2023-01-08 18:44:25 -05:00
Paul Smith
36f955b0e8 [SV 17448] Ignore whitespace around $(file ...) names
The other issues related to whitespace reported in this bug are
not addressed by this change.

* src/functions.c (func_file): Strip whitespace from the start and
end of the filename provided to the $(file ...) function.
* tests/scripts/functions/file: Add tests for this.
* tests/test_driver.pl: Use 3-arg version of open().
2023-01-08 18:06:54 -05:00
Paul Smith
a275f4e9ab [SV 61218] Ensure MAKEFLAGS is expanded even with -e
If -e was given we weren't expanding MAKEFLAGS before passing it
through the environment to jobs: we don't expand variables we
receive from the environment and when -e is given we set the
origin of MAKEFLAGS to "environment override".  Check for MAKEFLAGS
specifically, which seems like a hack but I don't have a better
idea offhand.

* src/main.c (main): Drive-by: use o_default for MAKEOVERRIDES.
* src/variable.c (target_environment): Always expand MAKEFLAGS
regardless of the origin type.
* tests/scripts/options/dash-e: Create a test.
2023-01-08 16:40:55 -05:00
Paul Smith
11444fb001 [SV 62654] Support GNU Make on z/OS
Original patches provided by Igor Todorovski <itodorov@ca.ibm.com>
Reworked by Paul Smith <psmith@gnu.org>.
Thanks to IBM for providing a test system.

* NEWS: Announce support.
* AUTHORS: Ditto.
* README.zOS: Provide details on building GNU Make on z/OS.
* build.sh (get_mk_var): z/OS sh has a strange bug which causes it to
generate extra lines of output: rework the function to print output
as we compute it instead of collecting it into a variable, which
works around this bug.
* src/makeint.h: Declare MK_OS_ZOS if we're building for z/OS.
* src/arscan.c: Don't include <ar.h> on z/OS.
* src/job.c: We can't change environ in ASCII mode on z/OS.
* src/main.c: Ditto.  Also we can't use pselect() on z/OS.
* src/posixos.c: pselect() seems to hang on z/OS: don't use it.
* tests/run_make_tests.pl: Handle different exit codes on z/OS.
* tests/test_driver.pl: Preserve some special z/OS env.vars.
Add special checks to output comparisons when on z/OS.
* tests/scripts/features/archives: Don't validate names.  Don't
try to compile empty files as IBM compilers complain.
* tests/scripts/features/shell_assignment: Fix octal value of #.
* tests/scripts/features/temp_stdin: Don't print "term".
* tests/scripts/functions/shell: Handle shell exit codes.
* tests/scripts/targets/ONESHELL: Ditto.
* tests/scripts/targets/POSIX: sh -x prints differently.
* tests/scripts/variables/SHELL: Ditto.
2023-01-08 10:45:38 -05:00
Paul Smith
0de7a0d3bf Create src/mkcustom.h which is included by config.h
Put declarations for missing functions which we create in src/misc.c
into a file which is included by config.h via AH_BOTTOM().  This
ensures those prototypes are available, even in files added to
lib/... from gnulib.

* src/mkcustom.h: Add a new file with function declarations.
* configure.ac: Include src/mkcustom.h in config.h with AH_BOTTOM()
* Makefile.am: Add the header to the SRCS list.
* src/makeint.h: Remove content that we added to src/mkcustom.h.
* src/config.ami: Add #include "mkcustom.h" to specialized config.h.
* src/config.h-vms: Ditto.
* src/config.h.W32: Ditto.
* src/configh.dos: Ditto.
2023-01-08 10:45:24 -05:00
Paul Smith
1656cd051c Include <strings.h> globally
Various code uses str{,n}casecmp() so include <strings.h>, if it
exists, everywhere.

* configure.ac: Check for <strings.h> explicitly.
* src/makeint.h: Include it if HAVE_STRINGS_H, for str{,n}casecmp().
* src/job.c: Remove include of <strings.h>.
* src/main.c: Ditto.
2023-01-08 10:24:09 -05:00
Paul Smith
31a1337c23 * gl/lib/glob.c: Don't try to support _LIBC, don't use __stat() 2023-01-07 22:02:06 -05:00
Paul Smith
5ae02ff8c1 [SV 63609] Avoid buffer overrun in --warn-undefined-variables
Reported by Dmitry Goncharov <dgoncharov@users.sf.net>

* src/variable.c (struct defined_vars): Create a struct that holds the
name and length of each variable name.
(warn_undefined): Check the lengths before comparing the contents.
* tests/scripts/options/warn-undefined-variables: Add a test.
2023-01-03 02:14:24 -05:00
Paul Smith
1ceeb8c64b [SV 14927] Allow parallel builds for archives
Compare the timestamp of the object file (if it exists) with the
archived object and if the object file is newer, ensure it's updated
in the archive.

* NEWS: Announce the new capability.
* doc/make.texi (Dangers When Using Archives): Explain how to enable
parallel builds with archives.
* src/remake.c (f_mtime): For archive element files check the mod
time of the object file (if it exists) against the archive object
(if it exists).
* tests/scripts/features/archives: Add tests for this capability.
2023-01-03 01:57:35 -05:00
Paul Smith
8791d2b38e [SV 61463] Don't export inherited private variables
If a parent target has an exported variable that is private, don't
export it in child targets.

* NEWS: Mention this change.
* src/variable.c (target_environment): Ignore private inherited
variables.
* tests/thelp.pl: Add a new "env" operation to show env.var. values.
* tests/scripts/variables/private: Verify this new behavior.
2023-01-02 23:02:33 -05:00
Paul Smith
f91b8bbb34 Update ancient glob/fnmatch implementations
I looked again at trying to use the latest gnulib implemenentations
of GNU glob and fnmatch, and the effort required to extract them
from gnulib and make them portable to systems which don't support
configure is simply far too daunting for me.  However it's clear
that the previous implementations are growing too long on the tooth
to continue to be used without some maintenance, so perform some
upkeep on them.

- Remove support for pre-ANSI function definitions.
- Remove the obsolete "register" keyword.
- Assume standard ISO C90/C99 header file support.
- Assume standard ISO C "void" and "const" support.
- Avoid symbols prefixed with "__" as they're reserved.

* maintMakefile: Add a rule to verify lib has the latest content.
* src/dir.c: Use void* not __ptr_t which was removed.
* gl/lib/glob.c: See above.
* gl/lib/fnmatch.in.h: See above.
* gl/lib/glob.in.h: See above.
* gl/lib/fnmatch.c: See above.  Remove __strchrnul(): it is not
checked anywhere and is only used in one place anyway.
2023-01-02 22:53:05 -05:00
Paul Smith
8dc66b6c31 * doc/make.texi (Special Targets): Fix minor typo
Reported by Andrey Melnikov <vafilor@gmail.com>.
2023-01-02 00:13:28 -05:00
Paul Smith
ccbaf3861d Don't free uninitialized hash_table
* src/dir.c (clear_directory_contents): We use ht_vec to mark when
we have initialized the hash_table: don't free if it's NULL.
(everywhere): Use NULL instead of 0 when working with pointers.
2023-01-01 17:05:12 -05:00
Paul Smith
c4fbfe8b5e * maintMakefile: Add missing quote 2023-01-01 17:05:12 -05:00
Paul Smith
e7ce3a655e Convert references from "GNU make" to "GNU Make" 2023-01-01 17:05:12 -05:00
Paul Smith
c580ebae8d Update to the latest gnulib stable branch
* bootstrap.conf: Request the latest gnulib stable branch.
* README.git: Recommend the argument form of autogen/autopull.
* bootstrap: Import the latest version of bootstrap.
* bootstrap-funclib.sh: Ditto.
* autogen.sh: Ditto.
* autopull.sh: Ditto.
2023-01-01 17:05:12 -05:00
Paul Smith
56d2978141 Update the copyright year on all files 2023-01-01 10:06:01 -05:00
Paul Smith
c91b269f66 Apply spelling fixes discovered by Codespell
* maintMakefile: Apply spelling fixes.
* src/file.c: Ditto.
* src/misc.c: Ditto.
* src/remake.c: Ditto.
* src/vmsjobs.c: Ditto.
* src/w32/pathstuff.c: Ditto.
* tests/test_driver.pl: Ditto.
* tests/run_make_tests.com: Ditto
* tests/scripts/features/implicit_search: Ditto
* tests/scripts/features/output-sync: Ditto
* tests/scripts/features/patternrules: Ditto
* tests/scripts/features/se_explicit: Ditto
* tests/scripts/features/statipattrules: Ditto
* tests/scripts/functions/foreach: Ditto
* tests/scripts/variables/MAKEFLAGS: Ditto
2022-12-31 13:21:09 -05:00
Paul Smith
29f453739f Avoid using false(1) in regression tests
The POSIX standard only requires false(1) to return a "non-zero" exit
code; almost all systems return 1 but some (Solaris!!!) return 255 or
possibly even other values.  Use our helper "fail" instead.

* tests/thelp.pl: Have the "fail" command obey -q.
* tests/scripts/features/parallelism: Helper -q no longer prints fail.
* tests/scripts/targets/POSIX: Replace false with #HELPER# -q fail 1.
* tests/scripts/variables/MAKEFLAGS: Ditto.
* tests/scripts/variables/SHELL: Ditto.
2022-12-31 10:51:24 -05:00
Paul Smith
937e9aa32d Make bootstrap.bat more portable
Using backslashes in a sed command line is tricky as different programs
use them differently as escape sequences.  Eli Zaretskii points out
that Windows "echo" doesn't do any processing, so rework all our sed
invocations to use script files created by echo.

* bootstrap.bat: Use echo to create sed script files instead of -e.
* Basic.mk.template: Fix typo in the comments.
* .gitignore: Ignore any .sed scripts.
2022-12-26 13:10:26 -05:00
Paul Smith
8e9c7db1e1 * NEWS: Add a section for the next release
Add a note for the MAKEFLAGS enhancements.
2022-12-24 15:48:48 -05:00
Paul Smith
15dfad96d7 [SV 63439, SV 63452] Don't warn on undefined internal variables
Don't generate undefined variable warnings for variables that are
internal / special to make and where the empty string is valid.
Rather than defining them to empty, which could introduce unwanted
behavior, keep a list of variable names which we should never warn
about.

* src/variable.h (warn_undefined): Convert the macro to a function.
* src/variable.c (defined_vars): Always "defined" variable names.
(warn_undefined): Implement as a function and check against the
defined_vars before generating a warning.
* src/read.c (read_all_makefiles): No need to reset warning flag.
* src/vpath.c (build_vpath_lists): Ditto.
* tests/scripts/options/warn-undefined-variables: Expand all the
pre-defined variables to ensure warnings are not generated.
2022-12-24 10:52:49 -05:00