Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/23/03 12:33
Read: times


 
#46474 - RE: Answered my own question..
Responding to: ???'s previous message
Lee:
There is also another solution that many C compilers will support as well. I know Keil has this feature too. There is a means by which to define a symbol via a compiler command line argument. Thus you could make two project files, one with the selection A type specified on the command line, and the other with the selection B type specified on the command line.

Note that command line defines to a C compiler work right nicely if you happen to be using a MAKE file to drive a compiler. This way it is possible to select a project build configuration without having to touch any source files but just edit the .MAK file. To take it a step further, often a system configuraton selection in a MAKE file will entail more than one define argument to the C compiler. It is thus possible to use command line arguments to the MAKE program that are used to select various ways to build the code. This way even the make file need not be edited. {Of course this could go on forever as a batch file could be used to invoke the make utility. :-) }

The Keil linker also has command line arguments that can be used to set values of symbols at link time. In a complex project with lots of source files one of these linker commands can be used to change certain kinds of configurations without having to re-invoke the compiler. {That is provided you are using a smart build IDE or a make file where only touched files are re-compiled. :=) } // The Cygnal IDE is a dumb build in that it re-compiles every file and links every time you say re-build irregardless of whether a source has changed or not. For small projects with 1 or 2 source files that results in a few K bytes of code this is of little concern. When you have a 15 or 20 file source set and your target has say 60 to 80 K of code this can consume a lot of extra building time. //

Michael Karas


List of 6 messages in thread
TopicAuthorDate
Keil C51 <i>#define</i> scope            01/01/70 00:00      
   Answered my own question..            01/01/70 00:00      
      RE: Answered my own question..            01/01/70 00:00      
         RE: Answered my own question..            01/01/70 00:00      
            RE: Keil            01/01/70 00:00      
      RE: Answered my own question..            01/01/70 00:00      

Back to Subject List