[jamming] Pre-parsing source files before building
Craig Allsop
cjamallsop at gmail.com
Tue Aug 21 15:26:10 PDT 2007
Hi Chris,
I'm assuming srcfile1.c is converted to genfile1.c and then linked in
the final program? So to make it easier to write in jam, can we just
add a gen prefix for the generated files so that srcfile1.c is
converted to gensrcfile1.c? Therefore you would do this...
LINKTARGET = flash.hex
FINALTARGET = app.bin
MAINSRC = srcfile1.c srcfile2.c ;
for i in $(MAINSRC)
{
# this will run: yourpreparsetoolhere outfile infile
GenFile gen$(i) : yourpreparsetoolhere $(i) ;
}
Main $(LINKTARGET) : gen$(MAINSRC) ;
Convert $(FINALTARGET) : $(LINKTARGET) ;
Depends all : $(FINALTARGET) ;
Only pass the generated sources to Main, gen$(MAINSRC) will be
expanded to prefix all source with "gen". If you have others you don't
then just list with as extras.
Hope that helps.
Craig.
On 8/21/07, Chris <syndicate_dragon at yahoo.com> wrote:
> We have a tool which generates some of our source files. Unfortunately, the
> files need to be touched up a bit before our cranky compiler can use them. I
> am trying to make this pre-parsing an automated part of the jam build
> process, but I'm having some trouble finding the right magic words to make
> it work. The problem seems to be that the files may already exist and need
> not be parsed again if they have not changed from the previous build. I'm
> having a hard time coming up with a rule/dependencies that can detect if
> generated source files are newer than the final target and run the
> pre-parsing script on them before compiling them. The script we have
> automatically fixes all of the generated files, so it only needs to run
> once.
>
> Here's what I have so far, which seems to work except for the pre-parsing
> step. AUXSRC are the sources generated by the tool. There are custom actions
> for Cc and Link to deal with our stupid compiler. I can detail those if
> someone thinks it necessary, but for brevity they are omitted here. The
> "Convert" rule/action handles converting the linker output to our download
> format.
>
> LINKTARGET = flash.hex
> FINALTARGET = app.bin
> MAINSRC = srcfile1.c srcfile2.c ;
> AUXSRC = genfile1.c genfile2.c ;
> SRC = $(MAINSRC) $(AUXSRC) ;
>
> Main $(LINKTARGET) : $(SRC) ;
> Convert $(FINALTARGET) : $(LINKTARGET) ;
> Depends all : $(FINALTARGET) ;
>
>
> Thanks,
> Chris
>
> ________________________________
> Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.
> _______________________________________________
> jamming mailing list - jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
>
>
More information about the jamming
mailing list