[jamming] Jam commands to build a specific file

Kai Backman kaib at google.com
Wed May 31 09:44:31 PDT 2006


 Hi Craig,

 Here is your Jamfile slightly rewritten:

---<snip>---
C++ = g++ ;
LINK = g++ ;

rule Resource
{
  # This used to be Resource (typo?)
  DEPENDS $(<) : $(>) ;
}

actions Resource
{
  windres $(>) $(<) -Iassets\\graphics
}

SRC = [ FDirName src platform Windows entry.cpp ] ;
RES_FILE = [ FDirName src platform Windows resources.res ] ;

DEPENDS all : mytest ;

# By using INCLUDES you force the exe to depend on the rc file
# and thus make jam update it before it compiles the exe (which
# is usually what you want). You could alternatively do this instead:
# DEPENDS [ FDirName path to mytest.exe ] : $(RES_FILE:S=.rc) ;
INCLUDES $(SRC) : $(RES_FILE:S=.rc) ;

Resource $(RES_FILE:S=.rc) : $(RES_FILE) ;

# Get the rc file on the link command line
LINKFLAGS = $(RES_FILE:S=.rc) ;

Main mytest : $(SRC) ;
---<snip>---

 Let me know if this solves what you had in mind.

 Take care,

 Kai



On 5/27/06, Craig Kadziolka <craigk at wp.pl> wrote:
> Hi everyone,
>
> I was wondering if it is possible to specify a jam rule/action to tell jam
> how to build a specific file as part of a larger build.
>
> I just want to be able to tell Jam to build resources.o from resources.rc,
> but to do that as part of the overall build of "mytest"
>
> For example, I want to build a windows RC file, so my Jamfile looks like
> this:
>
> C++                 =   g++ ;
> LINK                =   g++ ;
>
> rule Resource { Resource $(<) : $(>) ; }
> actions Resource { windres $(>) $(<) -Iassets\\graphics }
>
> SRC =
>     src\\platform\\Windows\\entry.cpp
>     src\\platform\\Windows\\resources.rc
>     ;
>
>
> DEPENDS all             :   mytest
>                       ;
>
> Main mytest         :   $(SRC)
>                       ;
>
>
> Resource src\\platform\\Windows\\resources.rc ;
>
> ------------- end jamfile
>
> However it complains about an unknown suffix for resources.rc. Is there any
> way to make Jam work in this situation without going and extending Jambase
> and rebuilding jam itself?
>
> Im sorry if this message gets sent twice to the mailing list, i tried to
> send it last night but accidentally from a different email account and it
> didnt seem to get through.
>
> Thanks in advance,
>
> Craig.
>
> _______________________________________________
> jamming mailing list  -  jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
>


-- 
Kai Backman, Software Engineer, kaib at google.com


More information about the jamming mailing list