home *** CD-ROM | disk | FTP | other *** search
/ Dream 41 / Amiga_Dream_41.iso / Amiga / Programmation / c / PDC.lha / PDC / bin.lzh / doc / CCX.doc < prev    next >
Encoding:
Text File  |  1990-04-06  |  10.4 KB  |  222 lines

  1. CCX.doc    [latest change - 12 July 89 by LDH]
  2.  
  3. ABSTRACT
  4.  
  5.     CCX is a smart front end that recognizes the type of file from
  6. its suffix, and will invoke the necessary programs for you to produce an
  7. executable module.  With CCX you can, in one command, preprocess the source
  8. code, compile the result to assembler, assemble and link the resulting
  9. object module with a set of libraries.
  10.  
  11.  
  12. SYNOPSIS
  13.  
  14.     CCX is a UNIX-like cc command that makes the usual compile,
  15. assemble and link stages a little friendlier.  For example, a runnable
  16. version of the "hello world" program called hello, whose source code is in
  17. a file called hello.c as shown below:
  18.  
  19.     /*hello.c*/
  20.     main()
  21.     {
  22.           printf("Hello World!\n");
  23.     }
  24.  
  25. could be made by typing the following at the CLI prompt:
  26.  
  27.     CCX hello.c
  28.  
  29. CCX would automatically perform the following for you:
  30.  
  31.     o invoke the PDC C compiler on the program.
  32.     o invoke the A68k assembler on the source code put out by PDC.
  33.     o invoke Blink to link the output of A68k with acrt0.o and
  34.           the libraries specified in the PDCLibs environment variable.
  35.     o The executable program will be called hello, and any
  36.       intermediate files will be cleaned up.
  37.  
  38. COMMAND LINE OPTIONS:
  39.  
  40.   CCX supports several command line options which can modify CCX's
  41. behavior,  change where certain files are searched for,  and define where
  42. temporary files are kept during compilation.  Options come in two flavors,
  43. switches and as parameters that take arguments.
  44.  
  45.   Switches appear by themselves on the line preceded by a minus sign.  "-S",
  46. and "-c" are two valid switch options.  It should be noted that upper and
  47. lower case letters are distinct.  "-A" and "-a" for example represent
  48. different switch options.  Furthermore, some options can have special
  49. meanings depending upon whether the flag is "-" or "+".  An example of
  50. such a "sign dependency" is the I option, which adds a directory to search
  51. for include files.  "-I vd0:include" indicates to search vd0:include BEFORE
  52. searching any of the default directories.  "+I vd0:include", conversely,
  53. searches vd0:include AFTER the default directories.  
  54.  
  55.   Parameter options are followed by an additional value optionally separated
  56. by a space.  For example, "-Idf0:include"  and "-I df0:include" are both
  57. valid parameter options.  Here is the current list of options:
  58.  
  59.         -a      Preserve .s files.  The normal behavior of CCX is to delete
  60.                 these intermediate files after running the assembler.  When
  61.                 this option is specified or implied, the compiler places its
  62.                 output in the current directory (rather than on the "quad
  63.                 device") and it is not deleted after the assembler is
  64.                 finished.
  65.  
  66.     -A    Instruct the compiler to annotate its assembly language output
  67.                 with the C source to show how each statement was compiled.
  68.                 Obviously, one would expect the annotated source to not be
  69.                 deleted automatically, so the "-A" option implies "-a" as well.
  70.  
  71.         -c      Suppress the link phase.  All C and assembly programs are 
  72.                 converted to object modules, but not linked together. 
  73.  
  74.     -D    Used to define a macro variable just as though it had
  75.         been included in the source file.  For example, the
  76.         option "-D DEBUG=1" is identical to including the 
  77.         statement #define DEBUG 1 in your C source code.
  78.  
  79.         There are three macro variables that are predefined for
  80.         you:  "amiga", "m68000", and "pdc".  These variables are 
  81.                 useful for writing compiler-specific code in your programs.
  82.  
  83.         -g      Generate debugging information.  Currently, this is 
  84.                 implemented in the form of A68k's "-d" flag.  This approach
  85.                 will give a symbolic debugger access to the global symbol
  86.                 table that is generated during assembly.  It isn't an
  87.                 especially powerful solution, but is adequate in many
  88.                 situations.
  89.  
  90.     -I    Defines additional directories where #include'd files should
  91.     +I    be sought.  For example, "-I dh0:include" would add the 
  92.                 directory include on drive dh0: as the first place to look 
  93.                 for include files.  Additional [+-]I <file> options may be 
  94.                 added, with virtually no limitations.
  95.  
  96.     -l    Defines additional libraries where Blink should look for
  97.     +l    library modules to include in the link list.  If "-lmath"
  98.         were specified, CCX would look for a module math.lib.
  99.                 Note that the ".lib" extension is optional and will be tacked 
  100.                 on if ommitted.
  101.  
  102.         -m      Instructs the linker to produce a link map named <file>.map
  103.                 where <file> is the name of the executable it generates.
  104.  
  105.     -o    Use "-o <name>" to choose the name of the output of the
  106.                 final phase.  Usually this is the output of the linker, though
  107.                 it is interpreted for the resulting object file when used
  108.                 in conjunction with the "-c" option or the assembly file when
  109.                 used with the "-S" option.  The "-o" option presupposes that
  110.                 running CCX will, in the end, only produce one file.  
  111.                 Otherwise, the target of the "-o" option would be ambiguous.
  112.  
  113.         -O      Is swallowed by CCX for compatibility purposes, but is not
  114.                 acted upon in any way.
  115.  
  116.     -q    By default, intermediate assembly language files will be kept
  117.                 in RAM for reasons of speed.  Use the "-q <dir>" option to over-
  118.         ride this by keeping these intermediate files in <dir>.  This
  119.                 option is  particularly appropriate when trying to compile on 
  120.                 a system with limited memory.
  121.  
  122.     -S    Only the compiler is invoked.  No files are assembled.
  123.  
  124.         -s      Used as "-s <object file>" in order to substitute a different
  125.                 startup module during the link phase.  Additionally, "-s 0"
  126.                 will entirely suppress the inclusion of a startup module.
  127.  
  128.         -U      Undefine symbol after preprocessing has completed.  Currently
  129.                 not supported at PDC's command line level.
  130.  
  131.     -V    Prints out the command line passed to all programs
  132.         just before they are invoked.
  133.  
  134.         -W      Sends a string as a command line argument to the specified
  135.                 phase, as in: "-W<phase> <string>" where phase is a char
  136.                 representing:
  137.                                p=preprocessor    0|c=compiler
  138.                                a=assembler    l=linker
  139.  
  140.                 For instance, "-Wc -b" would send a "-b" flag to the compiler,
  141.                 telling it to generate inline assembly for certain select
  142.                 library functions.  Only one "-W" option can be stored for each
  143.                 phase.  The final "-W" for each phase is the one that is used.
  144.                 Quotes can be used to send multiple switches to a phase, as in:
  145.  
  146.                               PDC -c -W0 "-b -P main.pre -g" main.c
  147.  
  148.                 That would send the compiler its -b and -g flags, and also
  149.                 tell it to read from the precompiled header file "main.pre".
  150.  
  151.         -w      Tells Blink to link with a particular file.  This could be used
  152.                 as in "-w project.lnk" to utilize a link file that might have
  153.                 been included with the source to a program.
  154.  
  155.         -Y      This is a quick way to change the name of a program used for
  156.                 one of the phases without recompiling CCX.  "-Yl klink" for
  157.                 instance, would substitute klink for blink as the default
  158.                 linker.  "-Y" without a <phase> specifier implies "-Yp Cpp"
  159.                 and is used to request use of the external preprocessor "Cpp".
  160.  
  161. DEFAULTS:
  162.  
  163. The following extensions have special meaning to CCX:
  164.  
  165.     .c    A C source code file like hello.c above.
  166.     .s    An assembler source code file.
  167.     .a        "         ".
  168.     .asm        "         ".
  169.     .o    An object file, the output of an assembler.
  170.     .obj        "       ".
  171.  
  172. CCX will obey the search path for the CLI process from which it was run.
  173. Additionally, it accesses the following environment variables for default
  174. parameters:
  175.  
  176. PDCLibs   - Selects a list of standard libraries in the order with which
  177.           they are to be linked.  A typical arrangement could be set by
  178.           placing the following line in your Startup-Sequence:
  179.  
  180.           SetEnv PDCLibs "PDC.lib; Amiga.lib; Math.lib"
  181.  
  182.           There is one important point to bear in mind:  The order in
  183.           which you specify the libraries to link can be CRITICAL.  For
  184.           instance, Math.lib and PDC.lib both contain the function 
  185.           "printf()".  The PDC.lib printf() will print garbage if you
  186.           give it a floating point parameter to print, whereas the Math.lib
  187.           printf() will greatly increase the size of your code because it
  188.           must bring in a number of additional floating point functions.  The
  189.           standard configuration (above) will give you garbage if you try
  190.           printing out a float (try running the fahr.c program after linking
  191.           with libraries in the above order).  One way to alter the ordering
  192.           without changing the PDCLibs environment variable is to use the +l
  193.           and -l options.  "CCX -lmath fahr.c" will make the linker see the
  194.           floating point printf() first and link with that instead.
  195.  
  196. PDCLibDirs - Presents the standard path to search for libraries and
  197.           object modules.  Here's a typical assignment for someone who
  198.           keeps libraries around in "vd0:":
  199.  
  200.           SetEnv PDCLibDirs "pdc:lib; vd0:lib"
  201.  
  202. PDCIncDirs - This is the standard list of places to search for include
  203.           files.  To this list, additional directories can be pre- or appended
  204.           using the [+-]I option.  Again, a typical assignment might go like:
  205.  
  206.           SetEnv PDCIncDirs "pdc:include; vd0:include"
  207.  
  208. Note that with the three environment variables listed above, the order in
  209. which their elements are listed is significant.  For instance, placing
  210. Math.lib before PDC.lib would give you the floating point (read: larger)
  211. versions of f/s/printf() and f/s/scanf() rather than the default versions
  212. in PDC.lib.
  213.  
  214. PDCStartup - Normally "acrt0.o" by default within CCX, you can set this
  215.           environment variable in order to choose some other startup as
  216.           the default.
  217.  
  218.  
  219. Notice:  The program CCX is based upon code originally written by Fred Fish
  220. and later modified by Jeff Lydiatt for the version of PDC on Fish Disk 110.
  221. This version is a major revision of the original code and is specially 
  222. tailored to work in the PDC release 3 programming environment.