| 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-%VERSION%
|
|---|
| 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 does 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.
|
|---|
| 83 |
|
|---|
| 84 | A native Windows32 system with no Bourne shell will also run
|
|---|
| 85 | in batch mode. All command lines will be put into batch files
|
|---|
| 86 | and executed via $(COMSPEC) (%COMSPEC%).
|
|---|
| 87 |
|
|---|
| 88 | GNU make and Cygnus GNU Windows32 tools:
|
|---|
| 89 |
|
|---|
| 90 | Good news! Make now has native support for Cygwin sh. To enable,
|
|---|
| 91 | define the HAVE_CYGWIN_SHELL in config.h and rebuild make
|
|---|
| 92 | from scratch. This version of make tested with B20.1 of Cygwin.
|
|---|
| 93 | Do not define BATCH_MODE_ONLY_SHELL if you use HAVE_CYGWIN_SHELL.
|
|---|
| 94 |
|
|---|
| 95 | GNU make and the MKS shell:
|
|---|
| 96 |
|
|---|
| 97 | There is now semi-official support for the MKS shell. To turn this
|
|---|
| 98 | support on, define HAVE_MKS_SHELL in the config.h.W32 before you
|
|---|
| 99 | build make. Do not define BATCH_MODE_ONLY_SHELL if you turn
|
|---|
| 100 | on HAVE_MKS_SHELL.
|
|---|
| 101 |
|
|---|
| 102 | GNU make handling of drive letters in pathnames (PATH, vpath, VPATH):
|
|---|
| 103 |
|
|---|
| 104 | There is a caveat that should be noted with respect to handling
|
|---|
| 105 | single character pathnames on Windows systems. When colon is
|
|---|
| 106 | used in PATH variables, make tries to be smart about knowing when
|
|---|
| 107 | you are using colon as a separator versus colon as a drive
|
|---|
| 108 | letter. Unfortunately, something as simple as the string 'x:/'
|
|---|
| 109 | could be interpreted 2 ways: (x and /) or (x:/).
|
|---|
| 110 |
|
|---|
| 111 | Make chooses to interpret a letter plus colon (e.g. x:/) as a
|
|---|
| 112 | drive letter pathname. If it is necessary to use single
|
|---|
| 113 | character directories in paths (VPATH, vpath, Path, PATH), the
|
|---|
| 114 | user must do one of two things:
|
|---|
| 115 |
|
|---|
| 116 | a. Use semicolon as the separator to disambiguate colon. For
|
|---|
| 117 | example use 'x;/' if you want to say 'x' and '/' are
|
|---|
| 118 | separate components.
|
|---|
| 119 |
|
|---|
| 120 | b. Qualify the directory name so that there is more than
|
|---|
| 121 | one character in the path(s) used. For example, none
|
|---|
| 122 | of these settings are ambiguous:
|
|---|
| 123 |
|
|---|
| 124 | ./x:./y
|
|---|
| 125 | /some/path/x:/some/path/y
|
|---|
| 126 | x:/some/path/x:x:/some/path/y
|
|---|
| 127 |
|
|---|
| 128 | Please note that you are free to mix colon and semi-colon in the
|
|---|
| 129 | specification of paths. Make is able to figure out the intended
|
|---|
| 130 | result and convert the paths internally to the format needed
|
|---|
| 131 | when interacting with the operating system.
|
|---|
| 132 |
|
|---|
| 133 | You are encouraged to use colon as the separator character.
|
|---|
| 134 | This should ease the pain of deciding how to handle various path
|
|---|
| 135 | problems which exist between platforms. If colon is used on
|
|---|
| 136 | both Unix and Windows systems, then no ifdef'ing will be
|
|---|
| 137 | necessary in the makefile source.
|
|---|
| 138 |
|
|---|
| 139 | GNU make test suite:
|
|---|
| 140 |
|
|---|
| 141 | I verified all functionality with a slightly modified version
|
|---|
| 142 | of make-test-%VERSION% (modifications to get test suite to run
|
|---|
| 143 | on Windows NT). All tests pass in an environment that includes
|
|---|
| 144 | sh.exe. Tests were performed on both Windows NT and Windows 95.
|
|---|
| 145 |
|
|---|
| 146 | Building GNU make on Windows NT and Windows 95/98 with Microsoft Visual C:
|
|---|
| 147 |
|
|---|
| 148 | I did not provide a Visual C project file with this port as
|
|---|
| 149 | the project file would not be considered freely distributable
|
|---|
| 150 | (or so I think). It is easy enough to create one, though, if
|
|---|
| 151 | you know how to use Visual C.
|
|---|
| 152 |
|
|---|
| 153 | I build the program statically to avoid problems locating DLL's
|
|---|
| 154 | on machines that may not have MSVC runtime installed. If you
|
|---|
| 155 | prefer, you can change make to build with shared libraries by
|
|---|
| 156 | changing /MT to /MD in the NMakefile (or in build_w32.bat).
|
|---|
| 157 |
|
|---|
| 158 | The program has not been built for non-Intel architectures (yet).
|
|---|
| 159 |
|
|---|
| 160 | I have not tried to build with any other compilers than MSVC. I
|
|---|
| 161 | have heard that this is possible though so don't be afraid to
|
|---|
| 162 | notify me of your successes!
|
|---|
| 163 |
|
|---|
| 164 | Pathnames and white space:
|
|---|
| 165 |
|
|---|
| 166 | Unlike Unix, Windows 95/NT systems encourage pathnames which
|
|---|
| 167 | contain white space (e.g. C:\Program Files\). These sorts of pathnames
|
|---|
| 168 | are legal under Unix too, but are never encouraged. There is
|
|---|
| 169 | at least one place in make (VPATH/vpath handling) where paths
|
|---|
| 170 | containing white space will simply not work. There may be others
|
|---|
| 171 | too. I chose to not try and port make in such a way so that
|
|---|
| 172 | these sorts of paths could be handled. I offer these suggestions
|
|---|
| 173 | as workarounds:
|
|---|
| 174 |
|
|---|
| 175 | 1. Use 8.3 notation
|
|---|
| 176 | 2. Rename the directory so it does not contain white space.
|
|---|
| 177 |
|
|---|
| 178 | If you are unhappy with this choice, this is free software
|
|---|
| 179 | and you are free to take a crack at making this work. The code
|
|---|
| 180 | in w32/pathstuff.c and vpath.c would be the places to start.
|
|---|
| 181 |
|
|---|
| 182 | Pathnames and Case insensitivity:
|
|---|
| 183 |
|
|---|
| 184 | Unlike Unix, Windows 95/NT systems are case insensitive but case
|
|---|
| 185 | preserving. For example if you tell the file system to create a
|
|---|
| 186 | file named "Target", it will preserve the case. Subsequent access to
|
|---|
| 187 | the file with other case permutations will succeed (i.e. opening a
|
|---|
| 188 | file named "target" or "TARGET" will open the file "Target").
|
|---|
| 189 |
|
|---|
| 190 | By default, GNU make retains its case sensitivity when comparing
|
|---|
| 191 | target names and existing files or directories. It can be
|
|---|
| 192 | configured, however, into a case preserving and case insensitive
|
|---|
| 193 | mode by adding a define for HAVE_CASE_INSENSITIVE_FS to
|
|---|
| 194 | config.h.W32.
|
|---|
| 195 |
|
|---|
| 196 | For example, the following makefile will create a file named
|
|---|
| 197 | Target in the directory subdir which will subsequently be used
|
|---|
| 198 | to satisfy the dependency of SUBDIR/DepTarget on SubDir/TARGET.
|
|---|
| 199 | Without HAVE_CASE_INSENSITIVE_FS configured, the dependency link
|
|---|
| 200 | will not be made:
|
|---|
| 201 |
|
|---|
| 202 | subdir/Target:
|
|---|
| 203 | touch $@
|
|---|
| 204 |
|
|---|
| 205 | SUBDIR/DepTarget: SubDir/TARGET
|
|---|
| 206 | cp $^ $@
|
|---|
| 207 |
|
|---|
| 208 | Reliance on this behavior also eliminates the ability of GNU make
|
|---|
| 209 | to use case in comparison of matching rules. For example, it is
|
|---|
| 210 | not possible to set up a C++ rule using %.C that is different
|
|---|
| 211 | than a C rule using %.c. GNU make will consider these to be the
|
|---|
| 212 | same rule and will issue a warning.
|
|---|
| 213 |
|
|---|
| 214 | SAMBA/NTFS/VFAT:
|
|---|
| 215 |
|
|---|
| 216 | I have not had any success building the debug version of this
|
|---|
| 217 | package using SAMBA as my file server. The reason seems to be
|
|---|
| 218 | related to the way VC++ 4.0 changes the case name of the pdb
|
|---|
| 219 | filename it is passed on the command line. It seems to change
|
|---|
| 220 | the name always to to lower case. I contend that
|
|---|
| 221 | the VC++ compiler should not change the casename of files that
|
|---|
| 222 | are passed as arguments on the command line. I don't think this
|
|---|
| 223 | was a problem in MSVC 2.x, but I know it is a problem in MSVC 4.x.
|
|---|
| 224 |
|
|---|
| 225 | The package builds fine on VFAT and NTFS filesystems.
|
|---|
| 226 |
|
|---|
| 227 | Most all of the development I have done to date has been using
|
|---|
| 228 | NTFS and long file names. I have not done any considerable work
|
|---|
| 229 | under VFAT. VFAT users may wish to be aware that this port
|
|---|
| 230 | of make does respect case sensitivity.
|
|---|
| 231 |
|
|---|
| 232 | FAT:
|
|---|
| 233 |
|
|---|
| 234 | Version 3.76 added support for FAT filesystems. Make
|
|---|
| 235 | works around some difficulties with stat'ing of
|
|---|
| 236 | files and caching of filenames and directories internally.
|
|---|
| 237 |
|
|---|
| 238 | Bug reports:
|
|---|
| 239 |
|
|---|
| 240 | Please submit bugs via the normal bug reporting mechanism which
|
|---|
| 241 | is described in the GNU make manual and the base README.
|
|---|