[Tutor] launching and monitor from make

Ertl, John john.ertl at fnmoc.navy.mil
Wed Oct 12 17:33:33 CEST 2005


Ewald,

That easy...If you know.  Thanks for the example and the help.  Now lets see
if I can modify the make file without upsetting the make god.

Thanks again.

John Ertl 

 -----Original Message-----
From: 	Ewald Ertl [mailto:ewald.ertl at hartter.com] 
Sent:	Wednesday, October 12, 2005 7:40 AM
To:	Ertl, John
Subject:	Re: [Tutor] launching and monitor from make

Hi John

Ertl, John wrote:
> All,
> 
> I have a very simple python program that reads one file and overwrites
> anouther text file.  This workes great from the command line and it has
> error checking but just outputs messages and the like to the screen.
> 
> The CM team here would like to have the script run each week as part of
the
> automated rebuilds.  The suggestion was to make the execution of the
scritp
> part of the bigger programs make file.  How would I handel errors when the
> program is run from a makefile?  I hate make so I have not done a lot of
> playing with what make can do in this respect but can python get an error
> message to make?


I think your Python-Script is an executeable "Shell"-Script with
"#!/usr/bin/env python ... "
So you can just insert your script in the makefile

When the exit-Code of the script is 0, than make assumes that everything is
ok,
otherwise an error occured.


Here's a short example with "ls"

Here the mkfile want's to list the file "hugo" which does not exist

mkfile:
all:
	ls -l hugo
--------------
#gmake -f mkfile
ls -l hugo
hugo: Datei oder Verzeichnis nicht gefunden
gmake: *** [all] Error 2



Here the mkfile itself is listed with ls
mkfile:
all:
	ls -l mkfile
----------
#gmake -f mkfile
ls -l mkfile
-rw-rw-r--   1 ewer     entw          19 Okt 12 16:35 mkfile


HTH
Ewald Ertl


More information about the Tutor mailing list