How to check in makefile if python script outputs OK
Question: I have a Python script, which checks my language translation files (in CSV
format), if all the lines contain translations for all languages included in
the CSV's first, header line. Script lists files/lines with missing
translations. If no problem is found, it outputs OK. **My question is
following:** how do I call the script from within the makefile and check, if
the output was OK? If something else than OK was printed out by the script, I
want the makefile to stop.

Any ideas?


Answer: `make` checks output status, not text which is output. The simplest solution
is to use `sys.exit(1)` in your python script if it doesn't check out OK.

for example:

    
    
    targetfile: dependsonfile
          python pythonscript.py -o targetfile dependsonfile
    

Of course the actual syntax will depend critically on how `pythonscript.py` is
meant to be called.

If your pythonscript just does a check, you can accomplish that as follows:

    
    
    makethis: didcheck
        echo "made it" > makethis   
    
    didcheck:  #dependencies here
        python -c 'import sys; sys.exit(1)'
        touch didcheck
    

then you call make as `make makethis`.

