I wrote a little python script, intending to automate non-default options for gcc (on Kubuntu 14.04); the python runs without error now, and inserting a debug print statement (or changing the system command to 'echo') verifies the correct information is being passed, but I get an error from gcc saying
$ python gccm prog16
gcc: fatal error: no input files
compilation terminated.
Here's the script I wrote:
#!/usr/bin/python
from sys import argv #get incoming argument
import subprocess #function to call an OS program
script, target = argv
# massage received argument into form needed for math.h linkage
target = "-o " + target + " " + target + ".c -lm"
subprocess.call (['gcc', target], shell=False)`
There are other additions I'd make to the gcc call (compile version options, stricter code checking, etc.), if I can get this to work correctly. Based on the error message, it appears to be invoking gcc correctly, but the target source file isn't being found; could this not be running in the directory from which I invoke it? If so, how can I get it to run from the correct directory (where I'm keeping my C source code files); if not, what else could cause this?