Next: , Previous: , Up: PC Installation   [Contents][Index]

B.3.1.2 Compiling gawk for PC Operating Systems

gawk can be compiled for MS-DOS, Windows32, and OS/2 using MinGW (Windows32) 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 a native MS-Windows binary of gawk using the MinGW tools, 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.out executables 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



As of November 2014, this site is still there, but the author could not find a package for GNU Make.

Next: , Previous: , Up: PC Installation   [Contents][Index]