This INSTALL file describes how to compile all the binaries (Linux,
MS-DOS, Win32) with Linux and how to install them in your system.

1. UNIX (Linux) binaries

 (a) create:
     + Linux binaries (x86, ELF) of LMPC and DEMcut are included in the
       Linux Binary Package and the Full Package but you can also
     + edit Makefile and src/Makefile (if you like) 
     + type 'make unix' 
 (b) install:
     + type 'make install' as root

2. MS-DOS binaries

 (a) create:
     + MS-DOS binaries of LMPC and DEMcut are included in the MS-DOS
       Binary Package and in the Full Package but you can also 
     + get the cross-compiler:
       - install ftp://sunsite.unc.edu/devel/msdos/binutils-2.6.go32.tar.gz
       - install ftp://sunsite.unc.edu/devel/msdos/djdev200.go32.tar.gz
       - install ftp://sunsite.unc.edu/devel/msdos/gcc-2.7.2.go32.tar.gz
     + install the cross-compiler
     + edit Makefile and src/Makefile (if you like)
     + type 'make dos'
 (b) install:
     + copy bin/lmpc.exe and bin/demcut.exe anywhere you can use it from MS-DOS
     + if you don't have a DPMI server (QEMM, DOSemu) copy bin/cwsdpmi.exe in
       your PATH
     + you need a MS-DOS Perl to use DEMA (The DEM Text File Analyser)

3. Win32 binaries 

 (a) create:
     + Win32 binaries of LMPC and DEMcut are included in the Win32 Binary 
       Package and in the Full Package but you can also follow the hints below
       to compile a Win32 executable with a Linux system
 (b) install:
     + copy bin/lmpc32.exe and bin/demcut32.exe anywhere you can use it from
       Windows95 or WindowsNT
     + if you don't have the cygwin.dll (version b17.1) get it from
       ftp://ftp.cygnus.com/pub/gnu-win32/ and copy it anywhere the programs
       can read it in (C:\WINDOWS\SYSTEM or the current directory)
     + you need a Win32 Perl to use DEMA (The DEM Text File Analyser)

Now I'll describe very shortly how to build LMPC executables for Windows95 and
WindowsNT with Linux.

First of all: I don't use neither Windows95 nor WindowsNT. My computer is
an almost "Linux only" box. I have to admit that I use DOSemu and Wine 
(Windows emulator) from time to time.

Linux is able to create executables for Win32 with a so-called "cross-
compiler."

The executables created with the cross-compiler need a special DLL 
(cygwin.dll) to run. This DLL works between the program and the OS. It 
emulates a UNIX behaviour for the compiled programs and a Win32 behaviour
for the underlying OS.

Get the Cygnus Developers' Kit (CDK) (known as GNU-WIN32/CYGWIN32 too) from

ftp://ftp.cygnus.com/pub/gnu-win32/

Get the file cdksrc.tar.gz (release b17.1 is 26254103 bytes long) or the 
splitted version and unpack it into a directory (/usr/src/cdk). 
Get the newest version of cygwin.dll (release b17.1 is 3046367 bytes long)
from the same place and put it in your DLL directory (something like 
C:\WINDOWS\SYSTEM or the like). 

Go to the CDK directory and configure the whole package with

./configure --target=i386-pc-cygwin32 --prefix=/usr/cdk

This should give you
1. a progress message (you may have an other machine type)
>Configuring for a i586-pc-linux-gnu host.

2. a warning (ignore it)
>*** This configuration is not supported in the following subdirectories:
>     tcl tk expect target-libgloss gdb
>    (Any other directories should still work fine.)

3. a second progress message
>Created "Makefile" in /usr/src/cdk using "config/mh-linux"
>Links are now set up to build a cross-compiler for i386-pc-cygwin32
>  from i586-pc-linux-gnu.

Make it with

make

This may take a while. It is interesting to look at the PIDs in an other
window. The process IDs easily exceed the 16 bit mark and start over again.

It may stop with an error. The most important file is gcc/xgcc. If this file
exists everything is OK and you can install the whole package with 

make install

This should generate some missing libraries and stop again with an error.

The CDK comes with its own libc: newlib. This newlib is a bit different from
other C-libraries but LMPC should compile relatively cleanly with it.

The src/Makefile of LMPC should be adapted to the location of the new 
`cross-gcc'. Than do a

make win 

in the LMPC main directory and voila ... bin/lmpc32.exe and bin/demcut32.exe
are the new Win32 executables.

4. Additional compilation hints

You need lex and yacc to compile the package. I compile it with flex version 
2.5.2 and GNU Bison version 1.25. This is my first language parse project. 
Therefore I have no idea if it may compile with other versions too. I don't 
provide precompiled C-files. They tend to be very long and can recreated 
easily.

You can create the included binaries with Linux only. You may succeed
compiling the source with djgpp for MS-DOS or even with the CDK under WindowsNT
but it is not supported at all. Compiling the source on a (non-Linux) UNIX 
workstation should be possible. As far as I know I removed all 
endian-dependence in the code. 

5. Compiling speed

The whole process of compiling DOS, Win32 and Linux binaries of LMPC and
DEMcut, the creation of the documentation for the distribution packages 
(doc, txt) and the packaging itself takes at my P133 2 minutes and 40 seconds.

Uwe Girlich
