|
From: | John Graham-Cumming |
Subject: | Re: setting variable based on errorlevel under DOS |
Date: | Wed, 26 Oct 2005 13:06:55 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
address@hidden wrote:
include gmsl all: address@hidden /t || if errorlevel 0 cmd /c "set status=1" $(if $(status),@echo failed,@echo success)
Firstly, I don't know why you are doing 'include gmsl'. You don't need it for what you are trying to do.
Secondly, your use of $(if) is incorrect. Since the entire line starting $(if) will be expanded before any of the commands for all are run the value of status is irrelevant and the result you'll get will be based on the value of status in the Makefile.
What you really want to do is something like this: all: @myprogram @if errorlevel 1 ( echo failed ) else ( echo success ) You can read more about the DOS shell here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx John. -- John Graham-Cumming address@hidden Home: http://www.jgc.org/ POPFile: http://getpopfile.org/ Sign up for my Spam and Anti-spam Newsletter at http://www.jgc.org/
[Prev in Thread] | Current Thread | [Next in Thread] |