Change make license
[platform/upstream/make.git] / README.W32
1 This version of GNU make has been tested on:
2   Microsoft Windows 2000/XP/2003/Vista/7/8/10
3 It has also been used on Windows 95/98/NT, and on OS/2.
4
5 It builds with the MinGW port of GCC (tested with GCC 3.4.2, 4.8.1,
6 and 4.9.3).
7
8 It also builds with MSVC 2.x, 4.x, 5.x, 6.x, 2005, 2008, 2010, 2012,
9 2013, and 2015 as well as with .NET 7.x and .NET 2003.
10
11 Building with Guile is supported (tested with Guile 2.0.x).  To build
12 with Guile, you will need, in addition to Guile itself, its dependency
13 libraries and the pkg-config program.  The latter is used to figure out
14 which compilation and link switches and libraries need to be mentioned
15 on the compiler command lines to correctly link with Guile.  A Windows
16 port of pkg-config can be found on ezwinports site:
17
18   http://sourceforge.net/projects/ezwinports/
19
20 The libraries on which Guile depends can vary depending on your
21 version and build of Guile.  At the very least, the Boehm's GC library
22 will be needed, and typically also GNU MP, libffi, libunistring, and
23 libtool's libltdl.  Whoever built the port of Guile you have should
24 also provide you with these dependencies or a URL where to download
25 them.  A precompiled 32-bit Windows build of Guile is available from
26 the ezwinports site mentioned above.
27
28 The Windows port of GNU make is maintained jointly by various people.
29 It was originally made by Rob Tulloh.
30 It is currently maintained by Eli Zaretskii.
31
32
33 Do this first, regardless of the build method you choose:
34 ---------------------------------------------------------
35
36  1. Edit config.h.W32 to your liking (especially the few shell-related
37     defines near the end, or HAVE_CASE_INSENSITIVE_FS which corresponds
38     to './configure --enable-case-insensitive-file-system').  (We don't
39     recommend to define HAVE_CASE_INSENSITIVE_FS, but you may wish to
40     consider that if you have a lot of files whose names are in upper
41     case, while Makefile rules are written for lower-case versions.)
42
43
44 Building with (MinGW-)GCC using build_w32.bat
45 ---------------------------------------------
46
47  2. Open a W32 command prompt for your installed (MinGW-)GCC, setup a
48     correct PATH and other environment variables for it, then execute ...
49
50         .\build_w32.bat gcc
51
52     This produces gnumake.exe in the GccRel directory.
53
54     If you want a version of GNU make built with debugging enabled,
55     add the --debug option.  Output goes into the GccDebug directory.
56
57     The batch file will probe for Guile installation, and will build
58     gnumake.exe with Guile if it finds it.  If you have Guile
59     installed, but want to build Make without Guile support, type
60
61         .\build_w32.bat --without-guile gcc
62
63
64 Building with (MSVC++-)cl using build_w32.bat
65 ---------------------------------------------
66
67  2. Open a command shell, then execute ...
68
69         .\build_w32.bat
70
71     This produces a 64bit Release build of gnumake.exe in .\WinRel, using
72     the compiler found on the %Path%.  If no compiler is found, the batch
73     file will probe your system and choose the newest MSVC version it can
74     find.
75
76     If you want a 32bit version of GNU make, add the --x86 option.
77
78     If you want a Debug build of GNU make, add the --debug option.  Output
79     will go into the .\WinDebug directory.
80
81     The batch file will probe for Guile installation, and will build
82     gnumake.exe with Guile if it finds it.  If Guile is installed,
83     but you prefer to build GNU make without Guile support, add the
84     --without-guile option.
85
86
87 Building with (MinGW-)GCC using GNU make
88 ----------------------------------------
89
90  2. If you already have a version of GNU make available you can use it
91     to build this version.  Open a W32 command prompt for your installed
92     (MinGW-)GCC, setup a correct PATH and other environment variables
93     for it, then execute ...
94
95         make -f Basic.mk TOOLCHAIN=gcc
96
97     This produces GccRel\gnumake.exe.
98     If you want a version of GNU make built with debugging enabled,
99     add the TARGET_TYPE=debug option:
100
101         make -f Basic.mk TOOLCHAIN=gcc TARGET_TYPE=debug
102
103     The makefile doesn't support Guile integration.  Use build_w32.bat
104     if you want to build with Guile support.
105
106
107 Building with (MSVC++-)cl using GNU make
108 ----------------------------------------
109
110  2. If you already have a version of GNU make available you can use it
111     to build this version.  Open a W32 command prompt for your installed
112     (MSVC++-)cl, setup a correct PATH and other environment variables
113     for it (usually via executing vcvars32.bat or vsvars32.bat from the
114     cl-installation, or using a corresponding start menu entry from the
115     cl-installation), then execute ...
116
117         make -f Basic.mk
118
119     This produces an optimized WinRel/gnumake.exe.
120     If you want a version of GNU make built with debugging enabled,
121     add the TARGET_TYPE=debug option:
122
123         make -f Basic.mk TARGET_TYPE=debug
124
125     The makefile doesn't support Guile integration.  Use build_w32.bat
126     if you want to build with Guile support.
127
128
129 Running the test suite
130 ----------------------
131
132  3. You will need an installation of Perl.  Be sure to use a relatively
133     modern version: older versions will sometimes throw spurious errors.
134
135     To run the suite after building using GNU make, use:
136
137         make -f Basic.mk check
138
139     Alternatively if you'd like to run tests by hand, use:
140
141         cd tests
142         .\run_make_tests.bat -make <path-to-make>
143
144     I've found <path-to-make> seems to want forward-slashes in the path.
145     For example if building with .\build_w32.bat non-debug, use:
146
147         cd tests
148         .\run_make_tests.bat -make ../WinRel/gnumake.exe
149
150     I've tested this with the MSYS2 shell and POSIX tools installation
151     that you get by installing Git for Windows.
152
153
154
155 -------------------
156 -- Notes/Caveats --
157 -------------------
158
159 GNU make on Windows 32-bit platforms:
160
161         This version of make is ported natively to Windows32 platforms
162         (Windows NT 3.51, Windows NT 4.0, Windows 2000, Windows XP,
163         Windows 95, and Windows 98). It does not rely on any 3rd party
164         software or add-on packages for building. The only thing
165         needed is a Windows compiler.  Two compilers supported
166         officially are the MinGW port of GNU GCC, and the various
167         versions of the Microsoft C compiler.
168
169         Do not confuse this port of GNU make with other Windows32 projects
170         which provide a GNU make binary. These are separate projects
171         and are not connected to this port effort.
172
173 GNU make and sh.exe:
174
175         This port prefers if you have a working sh.exe somewhere on
176         your system. If you don't have sh.exe, the port falls back to
177         MSDOS mode for launching programs (via a batch file).  The
178         MSDOS mode style execution has not been tested that carefully
179         though (The author uses GNU bash as sh.exe).
180
181         There are very few true ports of Bourne shell for NT right now.
182         There is a version of GNU bash available from Cygnus "Cygwin"
183         porting effort (http://www.cygwin.com/).
184         Other possibilities are the MKS version of sh.exe, or building
185         your own with a package like NutCracker (DataFocus) or Portage
186         (Consensys).  Also MinGW includes sh (http://mingw.org/).
187
188 GNU make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
189
190         Some versions of Bourne shell do not behave well when invoked
191         as 'sh -c' from CreateProcess().  The main problem is they seem
192         to have a hard time handling quoted strings correctly. This can
193         be circumvented by writing commands to be executed to a batch
194         file and then executing the command by calling 'sh file'.
195
196         To work around this difficulty, this version of make supports
197         a batch mode.  When BATCH_MODE_ONLY_SHELL is defined at compile
198         time, make forces all command lines to be executed via script
199         files instead of by command line.  In this mode you must have a
200         working sh.exe in order to use parallel builds (-j).
201
202         A native Windows32 system with no Bourne shell will also run
203         in batch mode.  All command lines will be put into batch files
204         and executed via $(COMSPEC) (%COMSPEC%).  However, parallel
205         builds ARE supported with Windows shells (cmd.exe and
206         command.com).  See the next section about some peculiarities
207         of parallel builds on Windows.
208
209 Support for parallel builds
210
211         Parallel builds (-jN) are supported in this port.  The number of
212         concurrent processes has a hard limit of 4095.
213
214 GNU make and Cygnus GNU Windows32 tools:
215
216         Good news! Make now has native support for Cygwin sh. To enable,
217         define the HAVE_CYGWIN_SHELL in config.h and rebuild make
218         from scratch. This version of make tested with B20.1 of Cygwin.
219         Do not define BATCH_MODE_ONLY_SHELL if you use HAVE_CYGWIN_SHELL.
220
221 GNU make and the MKS shell:
222
223         There is now semi-official support for the MKS shell. To turn this
224         support on, define HAVE_MKS_SHELL in the config.h.W32 before you
225         build make.  Do not define BATCH_MODE_ONLY_SHELL if you turn
226         on HAVE_MKS_SHELL.
227
228 GNU make handling of drive letters in pathnames (PATH, vpath, VPATH):
229
230         There is a caveat that should be noted with respect to handling
231         single character pathnames on Windows systems.  When colon is
232         used in PATH variables, make tries to be smart about knowing when
233         you are using colon as a separator versus colon as a drive
234         letter.  Unfortunately, something as simple as the string 'x:/'
235         could be interpreted 2 ways: (x and /) or (x:/).
236
237         Make chooses to interpret a letter plus colon (e.g. x:/) as a
238         drive letter pathname.  If it is necessary to use single
239         character directories in paths (VPATH, vpath, Path, PATH), the
240         user must do one of two things:
241
242          a. Use semicolon as the separator to disambiguate colon. For
243             example use 'x;/' if you want to say 'x' and '/' are
244             separate components.
245
246          b. Qualify the directory name so that there is more than
247             one character in the path(s) used. For example, none
248             of these settings are ambiguous:
249
250               ./x:./y
251               /some/path/x:/some/path/y
252               x:/some/path/x:x:/some/path/y
253
254         Please note that you are free to mix colon and semi-colon in the
255         specification of paths.  Make is able to figure out the intended
256         result and convert the paths internally to the format needed
257         when interacting with the operating system, providing the path
258         is not within quotes, e.g. "x:/test/test.c".
259
260         You are encouraged to use colon as the separator character.
261         This should ease the pain of deciding how to handle various path
262         problems which exist between platforms.  If colon is used on
263         both Unix and Windows systems, then no ifdef'ing will be
264         necessary in the makefile source.
265
266 Pathnames and white space:
267
268         Unlike Unix, Windows 95/NT systems encourage pathnames which
269         contain white space (e.g. C:\Program Files\). These sorts of
270         pathnames are valid on Unix too, but are never encouraged.
271         There is at least one place in make (VPATH/vpath handling) where
272         paths containing white space will simply not work. There may be
273         others too. I chose to not try and port make in such a way so
274         that these sorts of paths could be handled. I offer these
275         suggestions as workarounds:
276
277                 1. Use 8.3 notation. i.e. "x:/long~1/", which is actually
278                    "x:\longpathtest".  Type "dir /x" to view these filenames
279                    within the cmd.exe shell.
280                 2. Rename the directory so it does not contain white space.
281
282         If you are unhappy with this choice, this is free software
283         and you are free to take a crack at making this work. The code
284         in w32/pathstuff.c and vpath.c would be the places to start.
285
286 Pathnames and Case insensitivity:
287
288         Unlike Unix, Windows 95/NT systems are case insensitive but case
289         preserving.  For example if you tell the file system to create a
290         file named "Target", it will preserve the case.  Subsequent access to
291         the file with other case permutations will succeed (i.e. opening a
292         file named "target" or "TARGET" will open the file "Target").
293
294         By default, GNU make retains its case sensitivity when comparing
295         target names and existing files or directories.  It can be
296         configured, however, into a case preserving and case insensitive
297         mode by adding a define for HAVE_CASE_INSENSITIVE_FS to
298         config.h.W32.
299
300         For example, the following makefile will create a file named
301         Target in the directory subdir which will subsequently be used
302         to satisfy the dependency of SUBDIR/DepTarget on SubDir/TARGET.
303         Without HAVE_CASE_INSENSITIVE_FS configured, the dependency link
304         will not be made:
305
306         subdir/Target:
307                 touch $@
308
309         SUBDIR/DepTarget: SubDir/TARGET
310                 cp $^ $@
311
312         Reliance on this behavior also eliminates the ability of GNU make
313         to use case in comparison of matching rules.  For example, it is
314         not possible to set up a C++ rule using %.C that is different
315         than a C rule using %.c.  GNU make will consider these to be the
316         same rule and will issue a warning.
317
318 SAMBA/NTFS/VFAT:
319
320         I have not had any success building the debug version of this
321         package using SAMBA as my file server. The reason seems to be
322         related to the way VC++ 4.0 changes the case name of the pdb
323         filename it is passed on the command line. It seems to change
324         the name always to to lower case. I contend that the VC++
325         compiler should not change the casename of files that are passed
326         as arguments on the command line. I don't think this was a
327         problem in MSVC 2.x, but I know it is a problem in MSVC 4.x.
328
329         The package builds fine on VFAT and NTFS filesystems.
330
331         Most all of the development I have done to date has been using
332         NTFS and long file names. I have not done any considerable work
333         under VFAT. VFAT users may wish to be aware that this port of
334         make does respect case sensitivity.
335
336 FAT:
337
338         Version 3.76 added support for FAT filesystems. Make works
339         around some difficulties with stat'ing of files and caching of
340         filenames and directories internally.
341
342 Bug reports:
343
344         Please submit bugs via the normal bug reporting mechanism which
345         is described in the GNU make manual and the base README.
346 \f
347 -------------------------------------------------------------------------------
348 Copyright (C) 1996-2020 Free Software Foundation, Inc.
349 This file is part of GNU Make.
350
351 GNU Make is free software; you can redistribute it and/or modify it under the
352 terms of the GNU General Public License as published by the Free Software
353 Foundation; either version 3 of the License, or (at your option) any later
354 version.
355
356 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
357 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
358 A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
359
360 You should have received a copy of the GNU General Public License along with
361 this program.  If not, see <http://www.gnu.org/licenses/>.