[LLVMdev] llvmc for PIC16

Mikhail Glushenkov the.dead.shall.rise at gmail.com
Sun Jun 28 12:09:15 PDT 2009

Hi Sanjiv,

2009/6/28 Sanjiv Gupta <sanjiv.gupta at microchip.com>:
> I have a few more things to ask.
> In a command line such as below:
> clang-cc -triple=pic16- -emit-llvm-bc hello.c -o /tmp/llvm_YdmvZG/hello.bc
> who is suppose to create TmpDir  /tmp/llvm_YdmvZG/  ?
> I see neither the driver nor clang-cc creates it.

The temporary directory is created by the driver automatically, the
same as with gcc (see include/llvm/CompilerDriver/Main.inc, if you're
interested in details).

> How to change TmpDir? For example I may want to create a Debug or Release
> dir under the current dir to create binaries, then how to say that ./Debug
> or ./Release should be used by the driver as TmpDir ?

I think that this should be the responsibility of the build system.
Example (Makefile syntax):

$(BuildMode)/%.o : %.c
    llvmc -c $SOURCE -o $(BuildMode)/$TARGET

$(BuildMode)/$(ProgramName) : $(ObjectFiles)
    llvmc $(ObjectFiles) -o $(BuildMode)/$(ProgramName)

This is basically what LLVM's build system does.

There is also the -save-temps option which was recently modified to
behave like GCC 4.5. You can now do:

llvmc -save-temps=obj -o MyTempDir MyFile.c

This will produce an executable named a.out in the current directory
and save all temporary files to MyTempDir.

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

More information about the llvm-dev mailing list