Installation on Windows
On Windows, lcc is designed to work with Microsoft's Visual C++ (VC), version 5.0 and above, and Microsoft's Assembler, MASM. It uses the VC header files, libraries, and command-line tools, and it uses MASM to assemble the code it generates. You must use MASM 6.11d or later, because earlier releases generate incorrect COFF object files. MASM 6.15 is available as part of the free Visual C++ 6.0 Processor Pack.
Building the distribution components from the ground up requires Microsoft's Visual C/C++ compiler, Microsoft's make, nmake, and the standard Windows command interpreter. makefile.nt is written to use only nmake. As on UNIX systems, the compilation components are installed in a single build directory, and the top-level programs, lcc.exe and bprint.exe, are installed in a directory on the PATH. If the conventions used below are followed, the Windows-specific parts of the driver program, lcc.exe, can be used unmodified.
Building from the source distribution on a Windows system involves the following steps. Below, the build directory is referred to as BUILDDIR, and the distribution is in \dist\lcc.
Create the build directory, perhaps using a version- and platform-specific naming convention as suggested in Installation on UNIX, and record the name of this directory in the BUILDDIR environment variable:
C:\dist\lccset BUILDDIR=\progra~1\lcc\version\bin
C:\dist\lccmkdir %BUILDDIR%
The default build, or installation, directory is \Program Files\lcc\version\bin, where version is the version number, e.g., 4.2, but the nmake commands require that you use the corresponding 8.3 file name, progra~1, instead of Program Files.
etc\win32.c is the Windows-specific part of the driver. It assumes that environment variable include gives the locations of the VC header files and that the linker (link.exe) and the assembler (ml.exe) are on the PATH. It also assumes that the macro LCCDIR gives the build directory. If necessary, revise a copy of etc\win32.c to reflect the conventions on your computer (see Building the Driver), then build the driver, specifying the default temporary directory, if necessary:
C:\dist\lccnmake -f makefile.nt HOSTFILE=etc/win32.c lcc
...
cl -nologo -Zi -MLd -Fd%BUILDDIR%\ -c -Fo%BUILDDIR%\lcc.obj etc/lcc.c
lcc.c
cl -nologo -Zi -MLd -Fd%BUILDDIR%\ -c -Fo%BUILDDIR%\host.obj etc/win32.c
win32.c
cl -nologo -Zi -MLd -Fd%BUILDDIR%\ -Fe%BUILDDIR%\lcc.exe %BUILDDIR%\lcc.obj %BUILDDIR%\host.obj
If you make a copy of etc\win32.c, specify the path of the copy as the value of HOSTFILE. For example, if you copy etc\win32.c to BUILDDIR and edit it, use the command
C:\dist\lccnmake -f makefile.nt HOSTFILE=%BUILDDIR%\win32.c lcc
Build the preprocessor, compiler proper, library, and other accessories (see Building the Compiler):
C:\dist\lccnmake -f makefile.nt all
This command uses the VC command-line tools cl and lib to build bprint.exe, cpp.exe, lburg.exe, liblcc.lib, librcc.lib, and rcc.exe, all in BUILDDIR. There may be some warnings, but there should be no warnings.
Create a test directory and run the test suite:
C:\dist\lccmkdir %BUILDDIR%\x86\win32\tst
C:\dist\lccnmake -f makefile.nt test
This command compiles each program in tst, compares the generated assembly code and diagnostics with the expected assembly code and diagnostics, executes the program, and compares the output with the expected output (using fc). For example, when the nmake command compiles tst\8q.c, it leaves the generated assembly code and diagnostic output in %BUILDDIR%\x86\win32\tst\8q.s and %BUILDDIR%\x86\win32\tst\8q.2, and it compares them with the expected results in x86\win32\tst\8q.sbk. It builds the executable program in %BUILDDIR%\x86\win32\tst\8q.exe, runs it, and redirects the output to %BUILDDIR%\x86\win32\tst\8q.1, which it compares with x86\win32\tst\8q.1bk. The output from this step is voluminous, but there should be no differences and no errors.
Run the "triple" test, which compiles rcc with itself and verifies the results:
C:\dist\lccnmake -f makefile.nt triple
...
Assembling: C:/TEMP/lcc2001.asm
fc /b %BUILDDIR%\1rcc.exe %BUILDDIR%\2rcc.exe
Comparing files %BUILDDIR%\1rcc.exe and %BUILDDIR%\2RCC.EXE
00000088: B4 D5
This command builds rcc twice; once using the rcc built by VC and again using the rcc built by lcc. The resulting binaries are compared using fc. They should be identical, except for one or two bytes of timestamp data, as shown at the end of the output above (which will be different on your system). If 1rcc.exe and 2rcc.exe aren't identical, our compiler is generating incorrect code; contact us.
Copy lcc.exe and bprint.exe to a directory on your PATH, e.g.,
C:\dist\lcccopy %BUILDDIR%\lcc.exe \bin
1 file(s) copied.
C:\dist\lcccopy %BUILDDIR%\bprint.exe \bin
1 file(s) copied.
Finally, clean up:
C:\dist\lccnmake -f makefile.nt clean
This command removes the derived files in BUILDDIR, but does not remove rcc.exe, etc.; "nmake -f makefile.nt clobber" cleans up and removes all executables and libraries. Test directories under BUILDDIR are not removed; you'll need to remove these by hand, e.g.,
C:\dist\lccrmdir %BUILDDIR%\x86 /s
%BUILDDIR%\x86, Are you sure (Y/N)? y