home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
prog
/
c
/
pdc.lzh
/
File9
< prev
next >
Wrap
Text File
|
1991-08-04
|
6KB
|
158 lines
cc.doc [latest change - 16Jul88 by Jal]
ABSTRACT
cc is a smart front end that recognises the type of file from
the suffix, and will invoke the necessary programs for you to produce an
executable module. With cc you can in one command preprocess the source
code, compile the result to assembler, assemble and link the resulting
object module with the pdc library and Amiga.lib.
SYNOPSIS
cc is a unix-like cc command that makes the usual compile,
assemble and link stages a little friendlier. For example, a runnable
version of the "hello world" program called hello, whose source code is in
a file called hello.c as shown below:
/*hello.c*/
main()
{
printf("Hello World!\n");
}
could be made by typing the following at the CLI prompt:
1> cc hello.c
cc would automatically perform the following for you.
o invoke the macro preprocessor Cpp on the file "hello.c".
o invoke the PDC C compiler on the preprocessed code.
o invoke the A68k assembler on the source code put out by PDC.
o invoke Blink to link the output of A68k with PDCStartup.obj
using Blink's option LIB PDC.lib ami.lib.
o The executable program will be called hello, and any
intermediate files will be deleted by cc.
COMMAND LINE OPTIONS:
cc supports several command line options which can modify cc's
behaviour, change where certain files are searched for, and define where
temporary files are kept during compilation. Options come in two flavours,
switches and as parameters that take arguments.
Switches appear by themselves on the line preceded by a minus sign. "-S",
and "-c" are two valid switch options. It should be noted that upper and
lower case letters are distinct. "-O" and "-o" for example could represent
different switch options.
Argument types are followed by an additional value optionally separated
by a space. For example, "-Idf0:include" and "-I df0:include" are both
valid argument options. Here is the current list of options:
-S "cc -S test.c" will invoke Cpp and the PDC compiler
-A and leave the resulting assembler source in a file
-a called "test.s".
-c "cc -c test.c" or "cc -c test.a" will product an
object file test.o. cc recognizes the first form as a
c program and will compile and assemble test.c. The
second form is recognized an assembler program, and the
compile stage will be skipped.
-V will print out the command line passed to all programs
just before they are invoked.
-D used to define a macro variable just as though it had
been included in the source file. For example, the
option "-D DEBUG=1" is identical to including the
statement #define DEBUG 1 in your C source code.
There are three macro variables that are predefined for
you - "amiga", "m68000", and "pdc". Although these are
defined as lower case in cc, there seems to be a bug in
the cpp preprocessor which changes the names to upper case.
These variables are useful for writing compiler-specific
code in your programs.
There can be a maximum of 32 "-D var=1" defines.
-I used to define additional directories where Cpp should
look for files you have #included. For example,
"-I df0:include" would add the directory include on
drive df0: as one source to look for the standard I/O
header file "stdio.h". Additional -I <file> options
can be specified as required to a maximum of 16.
By default, "ram:include", and "PDC:include" will also
be searched in the order shown for any included files
not found in the specified libraries.
-l defines additional libraries where Blink should look for
library modules to include in the link list. If "-lc"
were specified, cc would look for a module ram:lib/c.lib,
and pdc.lib to link with the object code. Note that the
.lib extension is tacked on to the name for you and you
should not include it on the command line.
There are a maximum 16 libraries that can be specified on
one line. The libraries "-l pdc" and "-l Ami" have been
predefined for you.
-o use "-o name" to define the name of the resulting exec-
utable filename. By default, the name will be the first
module you specify on the command line, minus the suffix
if you do not over-ride it with this option. For example,
cc hello.c would result in a runnable program called hello.
-q by default intermediate files will be kept in ram. Use
the "-q ram:" option to over-ride this.
DEFAULTS:
The following extensions have special meaning to cc:
.c A c source code file like hello.c above.
.s An assembler source code file.
.a " ".
.o An object file, the output of an assembler.
cc will search in order, the current directory, ram:, and PDC:
for several modules that it needs for execution, as well as for include
libraries and object modules for the linker. Here is a summary of where it
expects to find things:
A68k, Cpp, PDC, and Blink:
If not found in the current directory, cc will search ram:c,
and PDC:c for these modules. If not found there, the manx
version of cc will search any paths given by the AmigaDos path
command, and finally the "C:" directory. The version compiled under
lattice however will only search the "C:" directory if the required
program is not found by the above search.
Object Modules:
cc generates the command:
"Blink PDCStartup.obj module.o LIB PDC.lib Ami.lib".
Both the modules PDCStartup.obj, PDC.lib and Ami.lib should
either be in the current directory, or in a directory called ram:lib,
or PDC:lib.
Bugs (sigh):
The only serious bug at this time is the inability to stop the
compile, assemble or link if an error is detected in a previous
stage. I need to spend a little more time understanding Manx's
fexecv() function to trace this one down.