I'm using XP command line.
I have a makefile and a .bat that runs the makefile. I also have an environment variable that I would like to use within the makefile. I have found some documentation but I am having a hard time seeing how to use it in my case. I think it is easy but I'm just missing something.
In my case I want to make the below more general. I want to specify the location of the borlandc (i.e. BorlandDir) folder externally to the makefile.
I type "mk" to run the make.
Here is my case:
MK.BAT
------
echo off
ver | findstr /i "5\.1\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_XP
echo The OS must be XP to run Borland C
PAUSE
goto:eof
:ver_XP
if '%BorlandDir%' == '' call setpath
%BorlandDir%\bin\make -s >this2
rem echo if you get "Bad command or file name" or it does not create emul.exe, run 'setpath'
echo if you get "Unable to execute command 'tlink.exe'", copy borlandc\bin\tlink.exe here
echo To make this debuggable, add -v
echo e.g., bcc -M -v -l3 -I%BorlandDir%\include -L%BorlandDir%\lib 1830.obj emul.obj iostuff.obj panel.obj
rem make -s
find /i /v "borland" <this2 >this1
find /i /v "available memory" <this1 >this
more <this
del ..\1830.exe 2> nul
move 1830.exe ..
SETPATH.BAT
-----------
set BorlandDir=..\borlandc
path=%path%;%BorlandDir%\bin
MAKEFILE
--------
COMPILE=bcc -a -3 -Od -v -c -ms -Oi -Iborlandc\include
ASSEMBLE=borlandc\bin\tasm -zi -ml -t -la
1830.exe: 1830.obj emul.obj iostuff.obj panel.obj
echo link 1830.exe
bcc -M -v -l3 -Lborlandc\lib 1830.obj emul.obj iostuff.obj panel.obj
1830.obj: 1830.c \
panel.h \
iostuff.h
$(COMPILE) 1830.c
iostuff.obj: iostuff.c \
panel.h \
api.h \
iostuff.h
$(COMPILE) iostuff.c
panel.obj: panel.c \
panel.h \
iostuff.h
$(COMPILE) panel.c
emul.obj: emul.asm
echo emul.asm:
$(ASSEMBLE) emul.asm