a really dumb question: why doesn't "echo %ERRORLEVEL%" work?

View: New views
3 Messages — Rating Filter:   Alert me  

a really dumb question: why doesn't "echo %ERRORLEVEL%" work?

by Mark Galeck (CW) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,  I RTFMd gnu make manual carefully, and all I found on how make executes commands, is that it just passes them to the shell, it does not know anything about how the shell executes them.  

OK, so I am on the Windows XP shell, and I have this makefile:

foobar:
                echo %ERRORLEVEL%


Now here is what I see at my shell prompt if I execute this command by hand:

D:\tmp>echo %ERRORLEVEL%
0

But when I try to execute this command through make, I see something else:

D:\tmp>make foobar
echo %ERRORLEVEL%
%ERRORLEVEL%

D:\tmp>


Why??  How to do it so that make really passes the command as is??  

Mark


_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make

RE: a really dumb question: why doesn't "echo %ERRORLEVEL%" work?

by Mark Galeck (CW) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>I RTFMd gnu make manual carefully

OK, apparently not carefully enough:
5.3.1 Choosing the Shell
says, that /bin/sh will be used by default.  If I am on DOS and gnu make is installed, then likely /bin/sh will be not the DOS shell!  

I should say:  
SHELL = CMD.EXE


Sorry for the dumb question, I hope this thread helps somebody in the future



_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make

deleting the target if interrupted, does not work?

by Mark Galeck (CW) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,  I have another question, this time I really don't want to look silly, so I really tried to grep the manual faithfully, and the only place that it says what happens when you try to kill make, is:

5.6 Interrupting or Killing make
If make gets a fatal signal while a command is executing, it may delete the target file that the command was supposed to update. This is done if the target file's last-modification time has changed since make first checked it.


This does not work for me.  

Here is an example, not a real-life situation of course, but as simple as I could make it to capture the essence of the problem:  


foobar.pl is:

open FOOBAR, ">foobar";
while (1) {
}

and makefile is:

SHELL = cmd.exe
foobar:
        perl foobar.pl


Now here's what happens when I type Ctrl-C while the perl script is looping:

D:\tmp>make foobar
perl foobar.pl
Terminating on signal SIGINT(2)
make: *** Deleting file `foobar'
make: unlink: foobar: Permission denied
make: *** [foobar] Error 2

and the file foobar is still there, however, I can delete it without any problem:

D:\tmp>del foobar

D:\tmp>

So I was able to delete it after the perl script is gone, why can't make wait until the perl script is gone and then delete the file?  


Thank you for any insight!  Mark



_______________________________________________
Help-make mailing list
Help-make@...
http://lists.gnu.org/mailman/listinfo/help-make