gawk can be compiled for MS-DOS, Windows32, and OS/2 using the GNU development tools from DJ Delorie (DJGPP: MS-DOS only) or Eberhard Mattes (EMX: MS-DOS, Windows32 and OS/2). The file README_d/README.pc in the gawk distribution contains additional notes, and pc/Makefile contains important information on compilation options.
To build gawk for MS-DOS and Windows32, copy the files in the pc directory (except for ChangeLog) to the directory with the rest of the gawk sources, then invoke make with the appropriate target name as an argument to build gawk. The Makefile copied from the pc directory contains a configuration section with comments and may need to be edited in order to work with your make utility.
The Makefile supports a number of targets for building various MS-DOS and Windows32 versions. A list of targets is printed if the make command is given without a target. As an example, to build gawk using the DJGPP tools, enter ‘make djgpp’. (The DJGPP tools needed for the build may be found at ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/.) To build a native MS-Windows binary of gawk, type ‘make mingw32’.
The 32 bit EMX version of gawk works “out of the box” under OS/2. However, it is highly recommended to use GCC 2.95.3 for the compilation. In principle, it is possible to compile gawk the following way:
$ ./configure $ make
This is not recommended, though. To get an OMF executable you should use the following commands at your sh prompt:
$ CFLAGS="-O2 -Zomf -Zmt" $ export CFLAGS $ LDFLAGS="-s -Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000" $ export LDFLAGS $ RANLIB="echo" $ export RANLIB $ ./configure --prefix=c:/usr $ make AR=emxomfar
These are just suggestions for use with GCC 2.x. You may use any other set of (self-consistent) environment variables and compiler flags.
If you use GCC 2.95 it is recommended to use also:
$ LIBS="-lgcc" $ export LIBS
You can also get an
a.out executable if you prefer:
$ CFLAGS="-O2 -Zmt" $ export CFLAGS $ LDFLAGS="-s -Zstack 0x6000" $ LIBS="-lgcc" $ unset RANLIB $ ./configure --prefix=c:/usr $ make
NOTE: Compilation of
a.outexecutables also works with GCC 3.2. Versions later than GCC 3.2 have not been tested successfully.
‘make install’ works as expected with the EMX build.
NOTE: Ancient OS/2 ports of GNU make are not able to handle the Makefiles of this package. If you encounter any problems with make, try GNU Make 3.79.1 or later versions. You should find the latest version on ftp://hobbes.nmsu.edu/pub/os2/.