Shell script problems, passing options to gcc
Hi,
I'm trying to create a tiny script that passes command line options to gcc when I'm working with GCC. The script is as follows:
#!/bin/bash
# cmpl - Script to compile .c source files
gcc "$CFLAGS" "$1".c -o "$1".o
This script works when $CFLAGS is only one option, for instance:
"-O2"
but fails whenever a second option is included, such as:
"-O2 -pipe"
giving the message: "cc1: invalid option '-O2 -pipe'
The combination above works when I type it at the command line. I'm confused. Any help would be much appreciated.
Mark
|