1@echo off
2echo Configuring MAKE for DJGPP
3
4rem The SmallEnv trick protects against too small environment block,
5rem in which case the values will be truncated and the whole thing
6rem goes awry.  COMMAND.COM will say "Out of environment space", but
7rem many people don't care, so we force them to care by refusing to go.
8
9rem Where is the srcdir?
10set XSRC=.
11if not "%XSRC%"=="." goto SmallEnv
12if "%1%"=="" goto SrcDone
13set XSRC=%1
14if not "%XSRC%"=="%1" goto SmallEnv
15
16:SrcDone
17
18update %XSRC%/configh.dos ./config.h
19
20rem Do they have Make?
21redir -o junk.$$$ -eo make -n -f NUL
22rem REDIR will return 1 if it cannot run Make.
23rem If it can run Make, it will usually return 2,
24rem but 0 is also OK with us.
25if errorlevel 2 goto MakeOk
26if not errorlevel 1 goto MakeOk
27if exist junk.$$$ del junk.$$$
28echo No Make program found--use DOSBUILD.BAT to build Make.
29goto End
30
31rem They do have Make.	Generate the Makefile.
32
33:MakeOk
34del junk.$$$
35update %XSRC%/Makefile.DOS ./Makefile
36echo Done.
37if not "%XSRC%"=="." echo Invoke Make thus: "make srcdir=%XSRC%"
38goto End
39
40:SmallEnv
41echo Your environment is too small.  Please enlarge it and run me again.
42
43:End
44set XRSC=
45