Commit graph

58 commits

Author SHA1 Message Date
Paul Smith
d9fc1ac5d2 Update URLs to use https rather than http
* (all): Change http:// to https://
* README.W32: Remove invalid link to mingw.org.
2022-10-18 14:37:47 -04:00
Paul Smith
b79791533b Add preprocessor macros for different platforms
* configure.ac: MK_CONFIGURE shows config.h was generated by configure.
* src/config.ami: Define MK_AMIGAOS.
* src/config.h-vms: Define MK_VMS.
* src/configh.dos: Define MK_DJGPP.
* src/config.h.W32: Define MK_W32 and WINDOWS32.
* src/build_w32.bat: Let WINDOWS32 be defined by config.h.  Remove
unused setting of WIN32.
* src/job.c: Clean up use of WIN32.
* src/main.c: Ditto.
* tests/scripts/features/default_names: Ditto.
2022-10-18 14:20:44 -04:00
Paul Smith
896908180e Sanitize tar file ownership, mode, and order
For reproducibility ensure all files in the dist tar file are owned by
root, and sorted by name.  Force the mode on all files to be writable
by the owner and not writable by group or user, by default.

Remove unnecessary execute permissions from build_w32.bat.

Recommended by Tzvetelin Katchov <katchov@gnu.org>.
2022-09-08 03:04:15 -04:00
Paul Smith
62da1c45e5 Fix bootstrap.bat for bootstrapping on Windows
* README.git: Clarify that these methods are lightly tested.
* build_w32.bat: Don't support any config step: fail if not completed.
Move the config steps into bootstrap.bat.  Don't print compile lines
by default and add a --verbose option to show them.
* bootstrap.bat: Ensure we have curl and sed before we do anything.
Pull the latest necessary files from gnulib.  Create a convert.sed
script that can update the various template files, and update
Basic.mk, config.h.W32, and gmk-default.h.
* tests/run_make_tests.pl: Remove CRLF rather than using chop.  If we
run perl in Git for Bash it seems to handle newlines differently.
* tests/scripts/features/temp_stdin: Remove the make copy and close
STDIN so we can delete the temp file on Windows.
* .gitignore: Ignore the convert.sed script.
2022-08-22 21:19:18 -04:00
Paul Smith
08c964b4ac * build_w32.bat [WIN]: Use call for all invocations 2022-06-18 16:42:11 -04:00
Sergei Trofimovich
621d3196fa [SV 62100] Add '--shuffle' option support
Introduce non-deterministic ordering into goal and prerequisite
traversal to help tease out inconsistent failures that may happen
when running in parallel build mode.

Introduce second order into each dependency chain:
1. Existing order is syntactic order reachable via 'dep->next'
2. New order is shuffled order stored as 'dep->shuf' in each 'dep'

When updating goals and prerequisites and '--shuffle' is provided,
use the shuffled order to walk the graph.  When automatic variable
are set always use the syntactic order of parameters.

* Makefile.am: Add new src/shuffle.c and src/shuffle.h file.
* build_w32.bat: Ditto.
* builddos.bat: Ditto.
* makefile.com: Ditto.
* po/POTFILES.in: Ditto.
* doc/make.texi: Add documentation for --shuffle.
* doc/make.1: Ditto.
* src/dep.h (DEP): Add the shuf pointer.
* src/filedef.h (struct file): Add was_shuffled flag.
* src/main.c: (shuffle_mode): Global flag for the shuffle mode.
(usage): Add the --shuffle option.
(switches): Ditto.
(main): Set shuffle_mode based on the command line parameter.
Reshuffle prerequisites if requested.
* src/remake.c (update_goal_chain): Walk the shuffled list if enabled.
(update_file_1): Ditto.
* src/shuffle.h: Provide an interface for shuffling prerequisites.
* src/shuffle.c: Implement option parsing and prerequisite shuffling.
* tests/scripts/options/shuffle: Test shuffle option and modes.
2022-06-04 19:04:37 -04:00
Paul Smith
ec09ec775a * <all>: Update copyright notices. 2022-02-10 14:48:26 -05:00
Paul Smith
0d367bbe6e Clean up a few Windows build warnings (not all!)
* build_w32.bat: Quote uses of %VSWHERE% so it can contain spaces
* src/hash.c (hash_init): Avoid use of an undefined struct.
(hash_rehash): Ditto.
* src/vpath.c (construct_vpath_list): Cast explicitly to void*.
2021-09-05 21:09:27 -04:00
Christian Jullien
6ba5ea022a Add support for building with Tiny C for MS-Windows
* src/config.h.W32.template (HAVE_DIRECT_H, HAVE_STRCASECMP)
(HAVE_STRNCASECMP, HAVE_UMASK): Add __TINYC__ to MinGW condition.
(BATCH_MODE_ONLY_SHELL): Make this the default for Tiny C.

* build_w32.bat: Support building with Tiny C's tcc compiler.
2020-02-29 11:14:46 +02:00
Paul Smith
12b14f0484 Update copyright statements for 2020 2020-01-03 02:08:59 -05:00
Paul Smith
393d2a2d4a tests: Convert %CONFIG_FLAGS to get_config()
* tests/config-flags.pm.W32: Create a predefined Windows file.
* Makefile.am (test_FILES): Add it to the distribution.
* build_w32.bat: Install tests/config-flags.pm if not existing.
* tests/run_make_tests.pl (get_config): Create new function.
* tests/scripts/features/archives: Call get_config() rather than
using %CONFIG_FLAGS directly.
* tests/scripts/features/load: Ditto.
* tests/scripts/features/loadapi: Ditto.
* tests/scripts/functions/wildcard: Ditto.
2019-10-05 17:47:52 -04:00
Eli Zaretskii
715c787dc6 Fix MS-Windows MinGW build
* src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects):
Fix format specifier for GetLastError's value.

* src/job.c (reap_children): Define the 'remote_status_lose' label
only for Posix platforms, to avoid compiler warning.

* build_w32.bat (LNKOUT): New variable, using forward slashes.
Use forward slashes in calls to :Compile, so that linking with GNU
ld works.

* src/makeint.h [!HAVE_UMASK]: Prototype for 'umask'.
(UMASK, MODE_T): Don't define.

* src/misc.c (get_tmpfile): Don't call UMASK, call umask, to
avoid compilation warning on !HAVE_UMASK platforms.
* src/output.c (output_tmpfd): Likewise.

* src/misc.c (umask) [!HAVE_UMASK]: New no-op function.

* src/config.h.W32.template (__USE_MINGW_ANSI_STDIO)
[__MINGW32__]: Define to 1, to force Make use ANSI-compatible
stdio functions, which also support the non-standard 'Id' and 'Ix'
specifiers.
(HAVE_UMASK) [__MINGW32__]: Define to 1.

* src/arscan.c (ar_member_touch): Type-cast argument of strlen to
avoid compiler warnings.
2019-08-28 17:45:49 +03:00
Paul Smith
2273ab7069 Update maintainer mode to support debug wait points.
Make a spin() method available when compiled in maintainer mode.
If a file exists in the working directory with a specific name,
make will sleep until the file is deleted.

Ensure that maintainer mode is enabled on Windows, using the same
algorithm we use on POSIX / autoconf systems.

* build_w32.bat: If maintMakefile exists, enable maintainer mode.
* src/main.c (main): Replace Windows-only suspend flag with spin().
* src/makeint.h: A SPIN() macro calls spin() in maintainer mode.
* src/misc.c (spin): If a spin file exists sleep until it's deleted.
2019-08-26 07:54:09 -04:00
Paul Smith
389dcb608f Update copyright statements for 2019 2019-05-19 15:27:26 -04:00
Paul Smith
63b42fa235 Convert GNU make to use the gnulib portability library
Move content from glob/* and config/* into standard GNU directory
locations lib/* and m4/*.

Install the gnulib bootstrap script and its configuration file, and
create a bootstrap.bat file for Windows.  Update the README.git file
with new requirements and instructions for building from Git.

At this point we only install the alloca, getloadavg, and FDL modules
from gnulib.  We keep our old glob/fnmatch implementation since the
gnulib versions require significant amounts of infrastructure which
doesn't exist on Windows yet.  Further work is required here.

Due to a problem with gnulib's version of getloadavg, we need to bump
the minimum required version of automake to 1.16.1 unfortunately.

* README.git: Update instructions
* NEWS: Move developer news to a separate section
* configure.ac: Update for use with gnulib modules

* bootstrap: Bootstrap from Git workspace (import from gnulib)
* bootstrap.conf: Bootstrap configuration for GNU make
* bootstrap.bat: Bootstrap from Git workspace for Windows
* gl/modules/make-glob: Support our local fnmatch/glob implementation

* config/acinclude.m4: Move to m4/
* config/dospaths.m4: Move to m4/
* glob/fnmatch.c: Move to lib/
* glob/fnmatch.h.in: Move to lib/
* glob/glob.c: Move to lib/
* glob/glob.h.in: Move to lib/

* Makefile.am: Update for new directories
* build.template: Update for new directories
* build_w32.bat: Update for new directories
* builddos.bat: Update for new directories
* maintMakefile: Update for new directories
* makefile.com: Update for new directories
* mk/Amiga.mk: Update for new directories
* mk/Posix.mk.in: Update for new directories
* mk/VMS.mk: Update for new directories
* mk/Windows32.mk: Update for new directories
* mk/msdosdjgpp.mk: Update for new directories

* po/LINGUAS: One language per line (needed by gnulib)

* INSTALL: Remove (obtained from gnulib)
* src/alloca.c: Remove (obtained from gnulib)
* src/getloadavg.c: Remove (obtained from gnulib)
* po/Makevars: Remove (created by bootstrap)
* config/*: Remove leftover files
* glob/*: Remove leftover files
2018-07-02 07:54:07 -04:00
Paul Smith
afbecbd9dc * all: Update Copyright statements for 2018 2018-07-01 12:22:04 -04:00
Paul Smith
8a731d1b2c * build_w32.bat: Support Visual Studio 17. 2018-02-10 15:34:53 -05:00
Paul Smith
fb779d2f1e Rework directory structure to use GNU-recommended "src" directory.
Move the source code (other than glob) into the "src" subdirectory.
Update all scripting and recommendations to support this change.

* *.c, *.h, w32/*: Move to src/
* configure.ac, Makefile.am, maintMakefile: Locate new source files.
* Basic.mk.template, mk/*: Update for new source file locations.
* NEWS, README.DOS.template: Update for new locations.
* build.template, build_w32.bat, builddos.bat: Ditto.
* po/POTFILES.in: Ditto
* tests/run_make_tests.pl, tests/scripts/features/load*: Ditto.
* make.1: Move to doc.
* mk/VMS.mk: Add support for building on VMS (hopefully).
* makefile.vms, prepare_w32.bat: Remove.
* SCOPTIONS: Update to define HAVE_CONFIG_H
2017-11-19 14:07:22 -05:00
Paul Smith
aa44e66c8f Remove unsupported build facilities.
Over time the non-standard build and install systems (nmake files,
smake files, Visual Studio project files, etc.) have atrophied and
maintaining them is not worth the effort, for such a simple utility
as make.  Remove all the non-standard build tool support and unify
OS-specific build rules under a basic set of (GNU make) makefiles.

Preserve the existing bootstrapping scripts (for POSIX, Windows,
and MS-DOS).  Also the existing VMS build scripts are left unchanged:
I don't have enough experience with VMS to venture into this area.
Perhaps one of the VMS maintainers might like to determine whether
conversion would be appropriate.

Rather than create libraries for w32 and glob (non-POSIX), simply
link the object files directly to remove the complexity.

* NEWS: Update with user-facing notes.
* Makefile.am: Clean up to use the latest automake best practices.
Build Windows code directly from the root makefile to avoid recursion.
* README.Amiga, README.DOS.template, README.W32.template: Updated.
* INSTALL: Point readers at the README.git file.
* maintMakefile: Remove obsolete files.  Create Basic.mk file.
* Basic.mk.template, mk/*.mk: Create basic GNU make-based makefiles.
* build_w32.bat: Copy Basic.mk to Makefile
* configure.ac: We no longer need AM_PROG_AR.
* dosbuild.bat: Rename to builddos.bat.  Incorporate configure.bat.
* Makefile.DOS.template: Remove.
* NMakefile.template, w32/subproc/NMakefile: Remove.
* SMakefile.template, glob/SMakefile, glob/SCOPTIONS, make.lnk: Remove.
* configure.bat, glob/configure.bat: Remove.
* w32/Makefile.am: Remove.
* make_msvc_net2003.sln, make_msvc_net2003.vcproj: Remove.
2017-11-18 09:31:31 -05:00
Paul Smith
7ef56bc8dc Update copyright statements for 2017. 2017-07-09 21:52:28 -04:00
Paul Smith
6f339b22eb * README.W32.template: Update the build documentation.
* build_w32.bat: Fix issues with Visual Studio builds.  Fix an error
that always created Debug builds.  Support 32bit and 64bit builds.
2016-06-24 20:50:42 -04:00
Paul Smith
6f7fb050b4 Fix compile issues with Windows and VMS.
* main.c (initialize_stopchar_map): isblank() is not part of C89.
Install bits for space and tab directly.
* makeint.h: Don't define vfork; autoconf handles this for us.
* vmsjobs.c: Rename NEXT_TOKEN to V_NEXT_TOKEN to avoid conflicts.
* dir.c (print_dir_data_base): Visual Studio C doesn't have int64_t.
* w32/subproc/sub_proc.c (process_begin): Missing arg to memset().
* build_w32.bat: Don't use obsolete Visual Studio flags.
2016-05-21 16:21:31 -04:00
Eli Zaretskii
6e640321fd Fix the MS-Windows MinGW build
* build_w32.bat (GccCompile): Use -std=gnu99, as some code uses
C99 features ('for' loop initial declarations).

* dir.c (print_dir_data_base) [WINDOWS32]: Cast 'mtime' to
'int64_t', and use %I64d to print it, to avoid compile-time
warning about printing a 'time_t' value, which could be either
a 32-bit or a 64 bit integral type.
2016-04-24 09:53:38 +03:00
Paul Smith
fb7a7adc8a Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-08 23:40:46 -05:00
Paul Smith
798ebd241b Update Copyright statements for the new year. 2016-02-28 12:55:20 -05:00
Paul Smith
0a3a0756b9 Update Copyright statements for 2014. 2014-09-30 09:32:42 -04:00
Eli Zaretskii
309768aff1 Fix the MS-Windows build: now guile.c must always be compiled in.
* build_w32.bat: Always compile guile.c and link against guile.o.
  Reported by Alexey Pavlov <alexpux@gmail.com>.

* makeint.h (guile_gmake_setup): Define prototype unconditionally,
to avoid compiler warnings.
2013-10-23 19:28:38 +03:00
Paul Smith
deff9dacc9 Enhance the output sync mode.
Create a new file, output.c, and collect functions that generate output there.
We introduce a new global context specifying where output should go (to stdout
or to a sync file), and the lowest level output generator chooses where to
write output based on that context.

This allows us to set the context globally, and all operations that write
output (including functions like $(info ...) etc.) will use it.

Removed the "--trace=dir" capability.  It was too confusing.  If you have
directory tracking enabled then output sync will print the enter/leave message
for each synchronized block.  If you don't want that, disable directory
tracking.
2013-09-12 04:07:52 -04:00
Eli Zaretskii
5e7bf7c554 Minor fix in build_w32.bat.
build_w32.bat (LinkGCC): Prevent a comment from being displayed
 at build time.
2013-06-22 17:32:46 +03:00
Eli Zaretskii
9babfe49a5 Fix a bug in build_w32.bat when building a released tarball.
build_w32.bat: Copy config.h.W32 to config.h regardless of
 whether or not we are building from SCM.
2013-05-17 13:34:24 +03:00
Eli Zaretskii
a66469e003 Fix interfacing with and remaking dynamic objects on MS-Windows.
load.c (load_object, load_file): Accept an additional argument
 DLP and return in it a pointer that can be used to unload the
 dynamic object.
 read.c (eval): Call load_file with an additional argument, and
 record the pointer returned there in the 'struct file' object of
 dynamic objects in that object's 'struct file'.
 commands.c (execute_file_commands): Unload dynamic objects
 before remaking them, to avoid failure to remake if the OS doesn't
 allow overwriting objects that are in use.
 filedef.h (struct file): New member dlopen_ptr.
 gnumake.h (GMK_EXPORT): Define to dllexport/dllimport
 decorations for Windows and to nothing on other platforms.
 (gmk_eval, gmk_expand, gmk_add_function): Add GMK_EXPORT qualifier
 to prototypes.
 makeint.h (MAIN): Define before including gnumake.h, to give
 correct dllexport decorations to exported functions.
 (load_file): Adjust prototype.
 loadapi.c: Don't include gnumake.h, since makeint.h already
 includes it, and takes care of defining MAIN before doing so.
 build_w32.bat (LinkGCC): Produce an import library for functions
 exported by Make for loadable dynamic objects.

 w32/compat/posixfcn.c (dlclose): New function.
 w32/include/dlfcn.h (dlclose): Add prototype.

 scripts/features/load: Fix signatures of testload_gmk_setup and
 explicit_setup, to bring them in line with the documentation.
2013-05-03 16:09:12 +03:00
Eli Zaretskii
da7df54309 Support --output-sync on MS-Windows.
w32/compat/posixfcn.c: New file, with emulations of Posix
 functions and Posix functionality for MS-Windows.
 w32/subproc/sub_proc.c: Include io.h.
 (process_noinherit): New function, forces a file descriptor to not
 be inherited by child processes.
 (process_easy): Accept two additional arguments, and use them to
 set up the standard output and standard error handles of the child
 process.
 w32/include/sub_proc.h (process_easy): Adjust prototype.
 (process_noinherit): Add prototype.

 read.c [WINDOWS32]: Include windows.h and sub_proc.h.
 makeint.h (LOCALEDIR) [WINDOWS32}: Define to NULL if not
 defined.  This is needed because the MS-Windows build doesn't have
 a canonical place for LOCALEDIR.
 (WIN32_LEAN_AND_MEAN) [WINDOWS32]: Define, to avoid getting from
 windows.h header too much stuff that could conflict with the code.
 main.c <sync_mutex>: New static variable.
 <switches>: Add support for "--sync-mutex" switch.
 (decode_output_sync_flags): Decode the --sync-mutex= switch.
 (prepare_mutex_handle_string) [WINDOWS32]: New function.
 (main): Add "output-sync" to .FEATURES.
 job.h (CLOSE_ON_EXEC) [WINDOWS32]: Define to call
 process_noinherit.
 (F_GETFD, F_SETLKW, F_WRLCK, F_UNLCK, struct flock) [WINDOWS32]:
 New macros.
 (RECORD_SYNC_MUTEX): New macro, a no-op for Posix platforms.
 (sync_handle_t): New typedef.
 job.c <sync_handle>: Change type to sync_handle_t.
 (FD_NOT_EMPTY): Seek to the file's end.  Suggested by Frank
 Heckenbach <f.heckenbach@fh-soft.de>.
 (pump_from_tmp_fd) [WINDOWS32]: Switch to_fd to binary mode for
 the duration of this function, and then change back before
 returning.
 (start_job_command) [WINDOWS32]: Support output_sync mode on
 MS-Windows.  Use a system-wide mutex instead of locking
 stdout/stderr.  Call process_easy with two additional arguments:
 child->outfd and child->errfd.
 (exec_command) [WINDOWS32]: Pass two additional arguments, both
 -1, to process_easy, to adjust for the changed function signature.
 function.c (windows32_openpipe) [WINDOWS32]: This function now
 returns an int, which is -1 if it fails and zero otherwise.  It
 also calls 'error' instead of 'fatal', to avoid exiting
 prematurely.
 (func_shell_base) [WINDOWS32]: Call perror_with_name if
 windows32_openpipe fails, now that it always returns.  This avoids
 a compiler warning that error_prefix is not used in the MS-Windows
 build.
 config.h.W32.template (OUTPUT_SYNC): Define.
 build_w32.bat: Add w32/compat/posixfcn.c to compilation and
 linking commands.

 From Frank Heckenbach <f.heckenbach@fh-soft.de>:
 job.c (sync_output): Don't discard the output if
 acquire_semaphore fails; instead, dump the output unsynchronized.
2013-04-27 14:20:49 +03:00
Eli Zaretskii
f3a4b4ce6f Improve MS-Windows build scripts.
build_w32.bat: Improve.  Remove 'setlocal', as it isn't
 supported on Windows 9X.  Add --help and usage instructions.
 Support both debug and optimized builds with GCC under --debug.
 If building out of Git repo, always produce config.h, and edit
 gmk-default.scm into gmk-default.h.
 w32/subproc/build.bat: Support debug and optimized builds with
 GCC.
2013-04-25 20:41:53 +03:00
Paul Smith
50e2cb1b1a Some cleanups for Windows builds after the output-sync option.
Note currently output-sync is not supported on Windows.
2013-04-16 19:51:29 -04:00
Paul Smith
002702c89c Modify instructions, etc. for Git support. 2013-01-12 19:31:13 -05:00
Paul Smith
adb50bd4c9 Simplify copyrights using ranges of years.
The new GNU Maintainer's Manual allows the use of year ranges in certain
situations; take advantage of this simplification.
2012-03-05 14:10:39 +00:00
Paul Smith
fca11f6039 Create a new function $(file ...) 2012-01-29 18:12:22 +00:00
Eli Zaretskii
dc25e84754 Support a Windows build with Guile.
README.W32.template: Update with instructions for building with Guile.
 build_w32.bat: Support building with Guile.
 make.h [HAVE_STDINT_H]: Include stdint.h.
2012-01-28 20:28:31 +00:00
Paul Smith
3f6bb04e75 Update copyright notices. 2012-01-16 02:29:20 +00:00
Paul Smith
c992c4d80f Add GNU Guile as an optional embedded scripting language for make.
On configure-enabled systems, configure will detect Guile installed
(using pkg-config, which is how GNU Guile is distributed) and enable
it if so.

On all non-configure-enabled systems, currently, the default is for
Guile support to be disabled.
2012-01-15 22:41:53 +00:00
Paul Smith
9903cda2a7 Update copyrights for 2010. 2010-07-13 01:20:10 +00:00
Paul Smith
ded9121846 Fixes to build_w32.bat for building with MSVC 64bit. 2010-07-12 20:32:59 +00:00
Paul Smith
5f188b39a4 Update copyright years. 2009-10-25 18:56:44 +00:00
Eli Zaretskii
f8f3b9005b * build_w32.bat (GCCBuild): Use "-gdwarf-2 -g3" instead of
"-gstabs+ -ggdb3".

	* w32/subproc/build.bat (GCCBuild): Likewise.
2008-09-30 11:26:16 +00:00
Paul Smith
e54dfb4284 Some Windows fixes to allow builds to succeed. 2007-10-10 04:32:15 +00:00
Paul Smith
891ebd4d97 * Update to GPLv3
* Update copyright to 2007
* Fix download URL for translation files (thanks to Thiemo Seufer)
2007-07-04 19:35:15 +00:00
Paul Smith
a6bdc58385 Last of the copyright updates. 2006-02-11 22:16:04 +00:00
Paul Smith
586daef9bc Update copyright and license notices on all files.
Added new file strcache.c to various non-UNIX makefiles and build scripts.
2006-02-11 19:02:21 +00:00
Paul Smith
b237dff775 - Fixed a bug reported by Michael Matz regarding handling of parallel
jobs after a failed job.
- Enhancements to WINDOWS32 code from Eli Zaretskii.
- Add Microsoft Project files from J. Grant.
2005-08-08 05:08:00 +00:00
Paul Smith
0e30f46a62 Various fixes and updates from testers of the beta3 release (mostly Windows
and OS/2 changes).
2005-07-04 03:50:59 +00:00