2019 |
mateusz.vi |
1 |
@echo off
|
|
|
2 |
|
|
|
3 |
REM This batch file expects to be run in the tree directory.
|
|
|
4 |
REM And it expects compiler CC [tcc or bcc] to be in the path.
|
|
|
5 |
REM for easier cleanup use BIN as output directory
|
|
|
6 |
|
|
|
7 |
if %1'==' goto badArgument
|
|
|
8 |
if %2'==' goto badArgument
|
|
|
9 |
if %3'==' goto badArgument
|
|
|
10 |
|
|
|
11 |
REM Setup the memory model to use and copy the matching file
|
|
|
12 |
set MEMMODEL=%2
|
|
|
13 |
|
|
|
14 |
REM check if CC set, otherwise use default Borland's tcc
|
|
|
15 |
if NOT %CC%'==' goto usecats
|
|
|
16 |
REM Change tcc to bcc if you are using Borland C/C++ 3.1
|
|
|
17 |
set CC=tcc
|
|
|
18 |
|
|
|
19 |
:usecats
|
|
|
20 |
REM if adding cats add necessary files to compile command line
|
|
|
21 |
if NOT %1==CATS goto compileDOS
|
|
|
22 |
set TREECMPLXDEF=-DUSE_CATGETS
|
|
|
23 |
set TREECMPLXTRA=catgets.c db.c get_line.c
|
|
|
24 |
|
|
|
25 |
:compileDOS
|
|
|
26 |
md BIN > \NUL
|
|
|
27 |
echo tree.cpp stack.c w32fDOS\%3\w32fdos.cpp w32fDOS\common\w32api.cpp %TREECMPLXTRA% > BIN\filelist
|
|
|
28 |
%CC% -DDOS -Iw32fDOS\common %TREECMPLXDEF% %MEMMODEL% -nBIN -tDe -etree.exe @BIN\filelist
|
|
|
29 |
copy BIN\tree.exe . > \NUL
|
|
|
30 |
|
|
|
31 |
:cleanup
|
|
|
32 |
echo cleaning up
|
|
|
33 |
set MEMMODEL=
|
|
|
34 |
set TREECMPLXTRA=
|
|
|
35 |
set TREECMPLXDEF=
|
|
|
36 |
REM copy tree.exe to current directory
|
|
|
37 |
del BIN\*.* < YES.TXT > \NUL
|
|
|
38 |
rd BIN > \NUL
|
|
|
39 |
@echo Tree for DOS is now compiled. [tree.exe]
|
|
|
40 |
goto done
|
|
|
41 |
|
|
|
42 |
:badArgument
|
|
|
43 |
REM display proper usage
|
|
|
44 |
echo Usage: makedos CATS/NOCATS -ml/-ms/other large/small/other
|
|
|
45 |
echo where CATS specifies compile with Cats support and any thing
|
|
|
46 |
echo else means do not use cats. NOTE: compiling with cats
|
|
|
47 |
echo will cause the resulting executable (NOT source) to be
|
|
|
48 |
echo under the LGPL as the cats files are LGPL and not PD.
|
|
|
49 |
echo and the second argument specifies the DOS memory model to use,
|
|
|
50 |
echo this may be anything valid for the compiler,
|
|
|
51 |
echo currently -ml for large model is recommended,
|
|
|
52 |
echo but -ms may be used for small model; all other models untested.
|
|
|
53 |
echo The third argument specifies the subdirectory under w32fDOS for
|
|
|
54 |
echo the file w32fDOS.cpp that matches the memory model specified.
|
|
|
55 |
echo The default is 'large' when -ml is specified and 'small' for -ms.
|
|
|
56 |
echo.
|
|
|
57 |
echo If bcc is to be used (or another compiler with compatible arguments)
|
|
|
58 |
echo then set the environment variable CC to bcc before calling makedos.bat.
|
|
|
59 |
echo.
|
|
|
60 |
echo This batch file must be ran from the tree\ directory.
|
|
|
61 |
echo Try again.
|
|
|
62 |
|
|
|
63 |
:done
|