views:

1100

answers:

2

Part of the install for an App I am responsible compiles some C code libraries. This is done in a DOS console using GNU Make.

So, as part of the install, a DOS Console window pops open, you see the make file output wiz by as it compiles and links, when finished the DOS Console window closes and the installer continues.

All good, unless there is a compilation error. Then the make file bugs out and the DOS Console window closes before you have a chance to figure out what is happening.

So, what I'd like to happen is have the Makefile/DOS console window pause with a 'press a key to continue' type functionality IF there is an error from the makefile so that the DOS console stays open. Otherwise, just exit as normal and close the DOS console.

I can't work out how to do this in a GNU Makefile or from a DOS batch file that could run the Make.

Any DOS/GNU Make guru's with a solution?

+5  A: 

this should do the trick:

if not ERRORLEVEL 0 pause

type "help if" in dos for more info on errorlevel usage.

Amir Arad
+1  A: 

Have you tried the 'pause' command?

@echo off
echo hello world
pause