Forcing build of one file (CWHC08 V3.1)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Forcing build of one file (CWHC08 V3.1)

7,888件の閲覧回数
wre
Contributor III
I have a file with a const Uint8 [] being set by the __DATE__ macro.  I would like this file to be built everytime the project is built so that the current date is always used.  Is there an easy way to make this happen?
 
Thanks,
 
Bill
 
ラベル(1)
タグ(1)
0 件の賞賛
返信
8 返答(返信)

1,795件の閲覧回数
marc_paquette
Contributor V
An alternative to touching the source file in a prelinking batch file is to delete the source file's object code. The IDE will recompile a source file if it cannot find its object code file.
 
In other words, instead using these commands 
 
type date.c > tmpdate.c
del date.c
ren tmpdate.c date.c
use this single command in your batch file
 
del target_Data\ObjectCode\date.c.o
 
where target is the name of your build target.
 
The disadvantage of this latter method is that you need to issue a del command for each build target.
 
Marc.
0 件の賞賛
返信

1,795件の閲覧回数
wre
Contributor III

Thanks Marc, I'll give one (or both) of these a try. 

Perhaps this could be a feature request for a future release of the IDE...force a build of selected files?

Thanks,

Bill

0 件の賞賛
返信

1,795件の閲覧回数
marc_paquette
Contributor V
An excellent idea. I'll make a feature request to the IDE team.
 
Marc.
0 件の賞賛
返信

1,795件の閲覧回数
wre
Contributor III

Hi Marc.  I could be doing something wrong but it seems that the pre-linker batch runner isn't quite the right place to do this work.

If I touch the source file (I'm using a touch.exe in the batch file), it happens after the compile and leaves that source file 'dirty' as in always needing to be built (check mark in the left column of the files list in the project window). This could be considered ok, but isn't quite 'clean'.

If I delete the xxx.c.o file, the linker complains that it can't find the file in its NAMES list when it gets to the linking phase, which seems to make sense as I have just deleted the object file created by the compile process.

If I remember I can always just click in the left column of the files list and make that file dirty before a build...but automation is better than me remembering!   :smileyvery-happy:

Thanks,

Bill

0 件の賞賛
返信

1,795件の閲覧回数
marc_paquette
Contributor V
Forgive me for asking a stupid question, but are you sure you are using the BatchRunner pre-linker and not the post-linker?
 
Using the method I describe in an earlier post, I was able to successfully touch a source file using the BatchRunner pre-linker and the IDE recognized that the file was touched before it started the compile phase.
 
If you continue to have problems, feel free to post the simplest possible project (persistently touched file, project, and batch file) that reproduces the problem.
 
Thanks.
 
Marc.
 
0 件の賞賛
返信

1,795件の閲覧回数
wre
Contributor III
Hi Marc, I'm ok with checking the obvious.  Yes, I am using the Batchrunner pre-linker.
 
Are you saying that the batch program will run before the compile phase?  By name (and observation), it seems like it would run between the compile phase and the linking phase.
 
It will take some time for me to put together a minimal project.
 
Bill
 

Message Edited by wre on 03-03-200601:54 PM

0 件の賞賛
返信

1,795件の閲覧回数
marc_paquette
Contributor V
I apologize for the confusion. You're right: the IDE invokes the prelinker after the compile phase (and before the regular linker).
 
Marc.
0 件の賞賛
返信

1,795件の閲覧回数
marc_paquette
Contributor V

My colleagues suggest this solution: use the BatchRunner PreLinker to touch a file before the IDE builds the rest of a build target.

In your build target's Settings window, choose BatchRunner PreLinker from the Pre-linker option. A new settings panel appears, BatchRunner Prelinker. In this panel, choose the batch file you'd like to run before each build. In this batch file, "touch" the source code file you want updated.

In a Windows batch file, you can "touch" a file like this:

type date.c > tmpdate.c
del date.c
ren tmpdate.c date.c

I hope this helps.

Marc.

0 件の賞賛
返信