| 1 | Port of GNU make to Windows NT and Windows 95
|
|---|
| 2 | Builds natively with MSVC 2.x or MSVC 4.x compilers.
|
|---|
| 3 | Should also build fine with MSVC 5.x and 6.x (though not confirmed).
|
|---|
| 4 |
|
|---|
| 5 | This Windows 32-bit port of GNU make is maintained primarily by Rob
|
|---|
| 6 | Tulloh, who is also the author of this README.
|
|---|
| 7 |
|
|---|
| 8 | To build with nmake on Windows NT, Windows 95, or Windows 98:
|
|---|
| 9 |
|
|---|
| 10 | 1. Make sure cl.exe is in your %Path%. Example:
|
|---|
| 11 |
|
|---|
| 12 | set Path=%Path%;c:/msdev/bin
|
|---|
| 13 |
|
|---|
| 14 | 2. Make sure %include% is set to msvc include directory. Example:
|
|---|
| 15 |
|
|---|
| 16 | set include=c:/msdev/include
|
|---|
| 17 |
|
|---|
| 18 | 3. Make sure %lib% is set to msvc lib directory. Example:
|
|---|
| 19 |
|
|---|
| 20 | set lib=c:/msdev/lib
|
|---|
| 21 |
|
|---|
| 22 | 4. nmake /f NMakefile
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | A short cut to steps 1, 2, and 3 is to run VCVARS32.bat before
|
|---|
| 26 | invoking namke. For example:
|
|---|
| 27 |
|
|---|
| 28 | c:
|
|---|
| 29 | cd \msdev\bin
|
|---|
| 30 | VCVARS32.bat
|
|---|
| 31 | cd \path\to\make-3.81beta1
|
|---|
| 32 | nmake /f NMakefile
|
|---|
| 33 |
|
|---|
| 34 | There is a bat file (build_w32.bat) for folks who have fear of nmake.
|
|---|
| 35 |
|
|---|
| 36 | Outputs:
|
|---|
| 37 |
|
|---|
| 38 | WinDebug/make.exe
|
|---|
| 39 | WinRel/make.exe
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 | -- Notes/Caveats --
|
|---|
| 43 |
|
|---|
| 44 | GNU make on Windows 32-bit platforms:
|
|---|
| 45 |
|
|---|
| 46 | This version of make is ported natively to Windows32 platforms
|
|---|
| 47 | (Windows NT 3.51, Windows NT 4.0, Windows 95, and Windows 98). It
|
|---|
| 48 | does not rely on any 3rd party software or add-on packages for
|
|---|
| 49 | building. The only thing needed is a version of Visual C++,
|
|---|
| 50 | which is the predominant compiler used on Windows32 platforms.
|
|---|
| 51 |
|
|---|
| 52 | Do not confuse this port of GNU make with other Windows32 projects
|
|---|
| 53 | which provide a GNU make binary. These are separate projects
|
|---|
| 54 | and are not connected to this port effort.
|
|---|
| 55 |
|
|---|
| 56 | GNU make and sh.exe:
|
|---|
| 57 |
|
|---|
| 58 | This port prefers you have a working sh.exe somewhere on your
|
|---|
| 59 | system. If you don't have sh.exe, the port falls back to
|
|---|
| 60 | MSDOS mode for launching programs (via a batch file).
|
|---|
| 61 | The MSDOS mode style execution has not been tested that
|
|---|
| 62 | carefully though (The author uses GNU bash as sh.exe).
|
|---|
| 63 |
|
|---|
| 64 | There are very few true ports of Bourne shell for NT right now.
|
|---|
| 65 | There is a version of GNU bash available from Cygnus "Cygwin"
|
|---|
| 66 | porting effort (http://sourceware.cygnus.com/cygwin).
|
|---|
| 67 | Other possibilities are the MKS version of sh.exe, or building
|
|---|
| 68 | your own with a package like NutCracker (DataFocus) or Portage
|
|---|
| 69 | (Consensys).
|
|---|
| 70 |
|
|---|
| 71 | GNU make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
|
|---|
| 72 |
|
|---|
| 73 | Some versions of Bourne shell do not behave well when invoked
|
|---|
| 74 | as 'sh -c' from CreateProcess(). The main problem is they seem
|
|---|
| 75 | to have a hard time handling quoted strings correctly. This can
|
|---|
| 76 | be circumvented by writing commands to be executed to a batch
|
|---|
| 77 | file and then executing the command by calling 'sh file'.
|
|---|
| 78 |
|
|---|
| 79 | To work around this difficulty, this version of make supports
|
|---|
| 80 | a batch mode. When BATCH_MODE_ONLY_SHELL is defined at compile
|
|---|
| 81 | time, make forces all command lines to be executed via script
|
|---|
| 82 | files instead of by command line. In this mode you must have a
|
|---|
| 83 | working sh.exe in order to use parallel builds (-j).
|
|---|
| 84 |
|
|---|
| 85 | A native Windows32 system with no Bourne shell will also run
|
|---|
| 86 | in batch mode. All command lines will be put into batch files
|
|---|
| 87 | and executed via $(COMSPEC) (%COMSPEC%). Note that parallel
|
|---|
| 88 | builds (-j) require a working Bourne shell; they will not work
|
|---|
| 89 | with COM.
|
|---|
| 90 |
|
|---|
| 91 | GNU make and Cygnus GNU Windows32 tools:
|
|---|
| 92 |
|
|---|
| 93 | Good news! Make now has native support for Cygwin sh. To enable,
|
|---|
| 94 | define the HAVE_CYGWIN_SHELL in config.h and rebuild make
|
|---|
| 95 | from scratch. This version of make tested with B20.1 of Cygwin.
|
|---|
| 96 | Do not define BATCH_MODE_ONLY_SHELL if you use HAVE_CYGWIN_SHELL.
|
|---|
| 97 |
|
|---|
| 98 | GNU make and the MKS shell:
|
|---|
| 99 |
|
|---|
| 100 | There is now semi-official support for the MKS shell. To turn this
|
|---|
| 101 | support on, define HAVE_MKS_SHELL in the config.h.W32 before you
|
|---|
| 102 | build make. Do not define BATCH_MODE_ONLY_SHELL if you turn
|
|---|
| 103 | on HAVE_MKS_SHELL.
|
|---|
| 104 |
|
|---|
| 105 | GNU make handling of drive letters in pathnames (PATH, vpath, VPATH):
|
|---|
| 106 |
|
|---|
| 107 | There is a caveat that should be noted with respect to handling
|
|---|
| 108 | single character pathnames on Windows systems. When colon is
|
|---|
| 109 | used in PATH variables, make tries to be smart about knowing when
|
|---|
| 110 | you are using colon as a separator versus colon as a drive
|
|---|
| 111 | letter. Unfortunately, something as simple as the string 'x:/'
|
|---|
| 112 | could be interpreted 2 ways: (x and /) or (x:/).
|
|---|
| 113 |
|
|---|
| 114 | Make chooses to interpret a letter plus colon (e.g. x:/) as a
|
|---|
| 115 | drive letter pathname. If it is necessary to use single
|
|---|
| 116 | character directories in paths (VPATH, vpath, Path, PATH), the
|
|---|
| 117 | user must do one of two things:
|
|---|
| 118 |
|
|---|
| 119 | a. Use semicolon as the separator to disambiguate colon. For
|
|---|
| 120 | example use 'x;/' if you want to say 'x' and '/' are
|
|---|
| 121 | separate components.
|
|---|
| 122 |
|
|---|
| 123 | b. Qualify the directory name so that there is more than
|
|---|
| 124 | one character in the path(s) used. For example, none
|
|---|
| 125 | of these settings are ambiguous:
|
|---|
| 126 |
|
|---|
| 127 | ./x:./y
|
|---|
| 128 | /some/path/x:/some/path/y
|
|---|
| 129 | x:/some/path/x:x:/some/path/y
|
|---|
| 130 |
|
|---|
| 131 | Please note that you are free to mix colon and semi-colon in the
|
|---|
| 132 | specification of paths. Make is able to figure out the intended
|
|---|
| 133 | result and convert the paths internally to the format needed
|
|---|
| 134 | when interacting with the operating system.
|
|---|
| 135 |
|
|---|
| 136 | You are encouraged to use colon as the separator character.
|
|---|
| 137 | This should ease the pain of deciding how to handle various path
|
|---|
| 138 | problems which exist between platforms. If colon is used on
|
|---|
| 139 | both Unix and Windows systems, then no ifdef'ing will be
|
|---|
| 140 | necessary in the makefile source.
|
|---|
| 141 |
|
|---|
| 142 | GNU make test suite:
|
|---|
| 143 |
|
|---|
| 144 | I verified all functionality with a slightly modified version
|
|---|
| 145 | of make-test-3.81beta1 (modifications to get test suite to run
|
|---|
| 146 | on Windows NT). All tests pass in an environment that includes
|
|---|
| 147 | sh.exe. Tests were performed on both Windows NT and Windows 95.
|
|---|
| 148 |
|
|---|
| 149 | Building GNU make on Windows NT and Windows 95/98 with Microsoft Visual C:
|
|---|
| 150 |
|
|---|
| 151 | I did not provide a Visual C project file with this port as
|
|---|
| 152 | the project file would not be considered freely distributable
|
|---|
| 153 | (or so I think). It is easy enough to create one, though, if
|
|---|
| 154 | you know how to use Visual C.
|
|---|
| 155 |
|
|---|
| 156 | I build the program statically to avoid problems locating DLL's
|
|---|
| 157 | on machines that may not have MSVC runtime installed. If you
|
|---|
| 158 | prefer, you can change make to build with shared libraries by
|
|---|
| 159 | changing /MT to /MD in the NMakefile (or in build_w32.bat).
|
|---|
| 160 |
|
|---|
| 161 | The program has not been built for non-Intel architectures (yet).
|
|---|
| 162 |
|
|---|
| 163 | I have not tried to build with any other compilers than MSVC. I
|
|---|
| 164 | have heard that this is possible though so don't be afraid to
|
|---|
| 165 | notify me of your successes!
|
|---|
| 166 |
|
|---|
| 167 | Pathnames and white space:
|
|---|
| 168 |
|
|---|
| 169 | Unlike Unix, Windows 95/NT systems encourage pathnames which
|
|---|
| 170 | contain white space (e.g. C:\Program Files\). These sorts of pathnames
|
|---|
| 171 | are legal under Unix too, but are never encouraged. There is
|
|---|
| 172 | at least one place in make (VPATH/vpath handling) where paths
|
|---|
| 173 | containing white space will simply not work. There may be others
|
|---|
| 174 | too. I chose to not try and port make in such a way so that
|
|---|
| 175 | these sorts of paths could be handled. I offer these suggestions
|
|---|
| 176 | as workarounds:
|
|---|
| 177 |
|
|---|
| 178 | 1. Use 8.3 notation
|
|---|
| 179 | 2. Rename the directory so it does not contain white space.
|
|---|
| 180 |
|
|---|
| 181 | If you are unhappy with this choice, this is free software
|
|---|
| 182 | and you are free to take a crack at making this work. The code
|
|---|
| 183 | in w32/pathstuff.c and vpath.c would be the places to start.
|
|---|
| 184 |
|
|---|
| 185 | Pathnames and Case insensitivity:
|
|---|
| 186 |
|
|---|
| 187 | Unlike Unix, Windows 95/NT systems are case insensitive but case
|
|---|
| 188 | preserving. For example if you tell the file system to create a
|
|---|
| 189 | file named "Target", it will preserve the case. Subsequent access to
|
|---|
| 190 | the file with other case permutations will succeed (i.e. opening a
|
|---|
| 191 | file named "target" or "TARGET" will open the file "Target").
|
|---|
| 192 |
|
|---|
| 193 | By default, GNU make retains its case sensitivity when comparing
|
|---|
| 194 | target names and existing files or directories. It can be
|
|---|
| 195 | configured, however, into a case preserving and case insensitive
|
|---|
| 196 | mode by adding a define for HAVE_CASE_INSENSITIVE_FS to
|
|---|
| 197 | config.h.W32.
|
|---|
| 198 |
|
|---|
| 199 | For example, the following makefile will create a file named
|
|---|
| 200 | Target in the directory subdir which will subsequently be used
|
|---|
| 201 | to satisfy the dependency of SUBDIR/DepTarget on SubDir/TARGET.
|
|---|
| 202 | Without HAVE_CASE_INSENSITIVE_FS configured, the dependency link
|
|---|
| 203 | will not be made:
|
|---|
| 204 |
|
|---|
| 205 | subdir/Target:
|
|---|
| 206 | touch $@
|
|---|
| 207 |
|
|---|
| 208 | SUBDIR/DepTarget: SubDir/TARGET
|
|---|
| 209 | cp $^ $@
|
|---|
| 210 |
|
|---|
| 211 | Reliance on this behavior also eliminates the ability of GNU make
|
|---|
| 212 | to use case in comparison of matching rules. For example, it is
|
|---|
| 213 | not possible to set up a C++ rule using %.C that is different
|
|---|
| 214 | than a C rule using %.c. GNU make will consider these to be the
|
|---|
| 215 | same rule and will issue a warning.
|
|---|
| 216 |
|
|---|
| 217 | SAMBA/NTFS/VFAT:
|
|---|
| 218 |
|
|---|
| 219 | I have not had any success building the debug version of this
|
|---|
| 220 | package using SAMBA as my file server. The reason seems to be
|
|---|
| 221 | related to the way VC++ 4.0 changes the case name of the pdb
|
|---|
| 222 | filename it is passed on the command line. It seems to change
|
|---|
| 223 | the name always to to lower case. I contend that
|
|---|
| 224 | the VC++ compiler should not change the casename of files that
|
|---|
| 225 | are passed as arguments on the command line. I don't think this
|
|---|
| 226 | was a problem in MSVC 2.x, but I know it is a problem in MSVC 4.x.
|
|---|
| 227 |
|
|---|
| 228 | The package builds fine on VFAT and NTFS filesystems.
|
|---|
| 229 |
|
|---|
| 230 | Most all of the development I have done to date has been using
|
|---|
| 231 | NTFS and long file names. I have not done any considerable work
|
|---|
| 232 | under VFAT. VFAT users may wish to be aware that this port
|
|---|
| 233 | of make does respect case sensitivity.
|
|---|
| 234 |
|
|---|
| 235 | FAT:
|
|---|
| 236 |
|
|---|
| 237 | Version 3.76 added support for FAT filesystems. Make
|
|---|
| 238 | works around some difficulties with stat'ing of
|
|---|
| 239 | files and caching of filenames and directories internally.
|
|---|
| 240 |
|
|---|
| 241 | Bug reports:
|
|---|
| 242 |
|
|---|
| 243 | Please submit bugs via the normal bug reporting mechanism which
|
|---|
| 244 | is described in the GNU make manual and the base README.
|
|---|