分享
 
 
 

build lcc 4.2 on win32

王朝system·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有