start and stop a program by make

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

start and stop a program by make

by Martin Mensch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello,
 
I would like to start a program by using a make rule. I know that compilers and so on are all programs. The ones that I want to start do not finish and so don't send an error code back and as much as I have seen make then just waits for the error code to come. Here is an example:
 
my_rule:
    program1.exe arg1 arg2
    program2.exe arg1 arg2
 
This should start program1 and leave it running and then start program2 and leave it running.
But what I see is this:
program1 starts and nothing else happens. When I manually stop program1 then program2 starts.
 
Another very good thing would be to have a rule like this:
 
my_rule:
    stop program1
    stop program2
 
If they are not running it should do nothing, maybe the '-' prefix will do this?
 
(using make 3.81 under WinXP)
 
Thank you for any help
 
Martin

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

Re: start and stop a program by make

by Paul Smith-20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-10-15 at 15:49 +0200, Martin Mensch wrote:

> I would like to start a program by using a make rule. I know that
> compilers and so on are all programs. The ones that I want to start do
> not finish and so don't send an error code back and as much as I have
> seen make then just waits for the error code to come.

There is no way for make to not wait for a program.

If you had a UNIX system with a normal shell, you could put the process
into the background, like this:

        foo:
                program1 &
                program2 &

(the "&" tells the shell to put the program into the background).  You
mentioned you're using Windows, but I don't know if you're using Cygwin
(which has, I believe, a UNIX-style shell) or MingW or whatever.  I
don't know how to put a program into the background on Windows.

If no one here answers you might ask on the make-w32@... mailing
list, which is for Windows-specific make questions.



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