Computing.Net > Forums > Disk Operating System > .bat and Makefile for DOS

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

.bat and Makefile for DOS

Reply to Message Icon

Name: ykzh
Date: June 4, 2002 at 21:14:48 Pacific
Comment:

Hello, help on two questions will be highly appreciated.

Question 1:

How to check the result of last DOS command in a .bat file ?
For example, in miketex I use

@echo off
echo looking for latex package %1
initexmf --find-latex-input %1.sty

How can I proceed the following command
initexmf --update-fndb
only when the search of the last command returns no result ?

In unix, to know the result of last command, I can direct the output by "> /dev/null" then check "$status",
but how to do the same thing in DOS ?


Question 2:

I use cgywin so "make" works very well for
my PC with OS win2k. But I noticed sth strange:
If I use "ps2pdf $(File).ps" directly from DOS commandline input, then the result is perfect. But if I put the above command on a Makefile,for example:

pf:
(tab) ps2pdf $(File).ps

Then my PC refused to do the task, and I got
error message like:
make: *** [pf] Error 128
The dinamic link library cygz.dll could not be found in the specified path ....

I search my PC and found no cygz.dll file at all. Can someone tell me why the same command works for commandline input but does not work in a Makefile? (both commands were
issued from the same DOS window)

Thanks again.



Sponsored Link
Ads by Google

Response Number 1
Name: cup
Date: June 4, 2002 at 23:30:32 Pacific
Reply:

1) The DOS equivalent of $status is errorlevel. It is returned as a number and used in a very strange way. This will only work if your program returns a non zero value. See

if /?

This varies depending on whether you are using NT or Win9x or DOS6.x

2) The problem is $(File). Make looks for a symbol File in the makefile. Try using $$ in place of $.


0

Response Number 2
Name: ykzh
Date: June 5, 2002 at 16:52:48 Pacific
Reply:

Thanks to CUP' reply. The symbol looks like a very fast CPU :)

The ERRORLEVEL works.

For the second question, actually in
commandline input I substitued a true file name for $(File), while in Makefile I assigned a value to the variable named File.

It is kind of strange that the same way worked in the unix env, while not work for cygwin make. I am not sure if "cygwin make" has a bug though. Those commands like ps2pdf, dvips etc have different options for different OS. But I did not think I use the options wrong.


0

Response Number 3
Name: cup
Date: June 6, 2002 at 00:11:41 Pacific
Reply:

Makefiles can be a pain sometimes. It is the only programming system I use where the starting point is in the middle.

I've never used cygwin so I don't know the root cause of the problem. Have you tried -DFile=xxx from the make command line? If that works then the definition of File is missing. You'll need to add in a File= somewhere.


0

Response Number 4
Name: ykzh
Date: June 8, 2002 at 20:53:08 Pacific
Reply:

I solved the second problem. (Pose here in case someone may have the same problem.)

Actually the cygwin I installed should be upgraded to higher version to agree with the version of my Miktex.
After upgrading, I have the required cygz.dll, so no more problems exist for the makefile.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: .bat and Makefile for DOS

looking for dos 1.x and aol for dos www.computing.net/answers/dos/looking-for-dos-1x-and-aol-for-dos/8056.html

Watcom and Boundschecker for dos www.computing.net/answers/dos/watcom-and-boundschecker-for-dos/4122.html

AOL for DOS www.computing.net/answers/dos/aol-for-dos/5327.html