1@echo off
2rem Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3rem 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4rem This file is part of GNU Make.
5rem
6rem GNU Make is free software; you can redistribute it and/or modify it under
7rem the terms of the GNU General Public License as published by the Free
8rem Software Foundation; either version 3 of the License, or (at your option)
9rem any later version.
10rem
11rem GNU Make is distributed in the hope that it will be useful, but WITHOUT
12rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13rem FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for.
14rem more details.
15rem
16rem You should have received a copy of the GNU General Public License along
17rem with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19echo Configuring MAKE for DJGPP
20
21rem The SmallEnv trick protects against too small environment block,
22rem in which case the values will be truncated and the whole thing
23rem goes awry.  COMMAND.COM will say "Out of environment space", but
24rem many people don't care, so we force them to care by refusing to go.
25
26rem Where is the srcdir?
27set XSRC=.
28if not "%XSRC%"=="." goto SmallEnv
29if "%1%"=="" goto SrcDone
30set XSRC=%1
31if not "%XSRC%"=="%1" goto SmallEnv
32
33:SrcDone
34
35update %XSRC%/configh.dos ./config.h
36
37rem Do they have Make?
38redir -o junk.$$$ -eo make -n -f NUL
39rem REDIR will return 1 if it cannot run Make.
40rem If it can run Make, it will usually return 2,
41rem but 0 is also OK with us.
42if errorlevel 2 goto MakeOk
43if not errorlevel 1 goto MakeOk
44if exist junk.$$$ del junk.$$$
45echo No Make program found--use DOSBUILD.BAT to build Make.
46goto End
47
48rem They do have Make.	Generate the Makefile.
49
50:MakeOk
51del junk.$$$
52update %XSRC%/Makefile.DOS ./Makefile
53echo Done.
54if not "%XSRC%"=="." echo Invoke Make thus: "make srcdir=%XSRC%"
55goto End
56
57:SmallEnv
58echo Your environment is too small.  Please enlarge it and run me again.
59
60:End
61set XRSC=
62