Can I compile but not link?

Help
2004-08-20
2004-08-22
  • Markus Wankus

    Markus Wankus - 2004-08-20

    I am thinking of using cpptasks to implement a custom compiler and linker in Ant for an embedded toolchain.  I essentially have a toolchain driver similar to gcc that sits on top of all of the command line tools and allows me to only compile, only preprocess, or preprocess, compile, and link (or any combination thereof) with the same command line executable, spawning the appropriate tools based on the command line flags you give it, and the source file extensions it sees.  Can I do this with cpptasks?  Here is what I thought I would do:

    1) Create a compiler adapter - say myCompiler - with a command of "myCC" and appropriate command line args to compile.

    2) Create a linker adapter - say myLinker - also with a command of "myCC" but with appropriate command line args for linking.

    3) Define my own task, extending CCTask, but providing my own default compiler and linker adapters to be the two classes defined above.

    Now - in my build.xml I assume if I do not specify any <compiler/> or <linker/> entries, it will by default compile and link using myCC in both cases.  However - is it possible to only run a compile step?  Can I re-define the <linker/> to be nothing?  If I leave it undefined it will simply use the default and link anyways, correct?

    Is the solution to not specify a default in my custom task based on CCTask?  If so - that means I will have to *always* specify <compiler/> and <linker/> entries for normal compile and link builds - which is verbose and a pain...

    I'm new to cpptasks so if I am missing something obvious please feel free to enlighten me or whack me with something large and blunt.

    Thanks,
    Mark.

     
    • Curt Arnold

      Curt Arnold - 2004-08-22

      Cpptasks only links if you specify an outfile attribute, if you omit it, it only compiles.

      You can use the name or classname attribute on the cc element to specify the default compiler (and the default linker by inference).

      <cc name="myCC">

      <cc classname="com.example.cpptasks.MyCC">

      There had not been a request to be able to override the default compiler, but if it is important enough to you that you'd be willing to create a derivative CCTask, I might be able to work it in.

       
      • Markus Wankus

        Markus Wankus - 2004-08-22

        OK, cool.  I guess I'll dig in and play with it.  I'll work on it - but our tools are pretty specific (and not useful to many people).  I may not even need a derivative CCTask - I'm not entirely sure yet.  The big thing was being able to compile, but not link - which I didn't see anywhere in the docs.

        Thanks for the reply.  I look forward to hacking around with cpptasks!

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks