News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

buildnumber in filename

Started by hollim, May 28, 2014, 10:32:33 AM

Previous topic - Next topic

hollim

Hi forum,

an output file in a Release target need to be named including the actual build number. Fortunately the build number is stored in a separate file inside the project dir. The manual says that back ticks could be used. So a command line in the targets' post script like the following should do it in my opinion:

objdump -D $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)-`type buildnumber.dat`.dump

This unfortunately doesn't work.
The manual however doesn't tell, if this is either platform dependent or to be used in a special context only.
This problem arose on a Windows 7 VM using C::B 13.12.

Can anybody give a hint, please?

Greetings
Hollim

oBFusCATed

Are you sure there is no new line character at the end of the buildnumber.dat file?
Are you sure type is not printing one for you?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

hollim

There is a 0x0d 0x0a in the file (it's Window$).
I'm sure 'type' isn't able to do anything as it doesn't gets called at all.

Putting a line with: `find "blablabla" c:\temp\usercode.txt` in a post build script, its execution results in:

Running target post-build steps
`find "blablabla" c:\temp\usercode.txt`
Execution of '`find "blablabla" c:\temp\usercode.txt`' in 'C:\Pro\newproject' failed.

It does however run fine in a regular cmd window.

Ho did you implement the back ticks in the Win version of C::B? Are you sure this is available on Win?

If this isn't working, is there a way to set a (global) variable from a pre build script for using in the post build script?

Please note that I'm not aware of the C::B script engine - I'm talking about the Project Build Options / Pre/Post Build Steps.

Thanks.

oBFusCATed

Hm, probably type is not an executable, but a build-in command of cmd.exe.

But I've tried `echo 5` and it is not executed. Probably C::B is not doing the macro expansion on the executables output... Someone needs to check the source to verify if this is the case...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]