Compiler 2013: Command-line options
外观
Suppose $(CC)
is the compiler program, e.g. java -jar student.jar
$(CC)
SHOULD accept three independent options described as follows.
-o FILE
indicates that the compiler SHOULD output toFILE
; this option appears exactly once.-c
indicates that the compiler SHOULD NOT generate the run-time library in the output; this option appears at most once.-O
indicates that the compiler MAY optimize the input program; this option appears at most once.
Other command-line arguments passed to the compiler SHOULD be treated as source code files and compiled accordingly. The order of compilation is insignificant. It's guaranteed that there's at least one input file.
Input files with .c
extension SHOULD be compiled as C programs, while files with other extensions SHOULD be treated as assembly programs (so there's no need to compile it but the compiler has to concatenate it with other compiled modules).
Example
Compile a single file:
$(CC) hello.c -o hello.s
Compile multiple files:
$(CC) A.c -o A.o -c $(CC) B.c -o B.o -c -O $(CC) A.o B.o C.c -o X