|
|
|
Re: Looking for example of "Post-build steps" [message #1748988 is a reply to message #1748985] |
Wed, 30 November 2016 19:37 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
The ".o" file is generated by a compile. You probably want to run this after every compile.
This not particularly useful change to the compile command will show the working directory before every compile
pwd; ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
It assumes Linux and that bash is what executes the build recipe.
It is inserted into to the makefile rule (for C):
src/%.o: ../src/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
pwd; gcc -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
You probably want something like
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}; fromelf ${OBJECT}.o > ${OBJECT}.txt:
Again assuming bash is executing the recipes and that ${OBJECT} is the file name sans extent.
Which it isn't. The content is something like "$@" which becomes <file>.o when the recipe is executed.
You'll have to find a variable that has what you want which is unlikely.
Look in Project --> Properties --> C/C++ Build --> Build Variables.
If you can't find one then you'll need to figure out how to use the <file>.o maybe by using a script.
I'm curious though that the name contains 'elf".
That is the format of a Linux executable.
This command may not do what you want.
The post build step is for doing things that you might want to do after every build.
Like converting the linked executable to another format.
Or cleaning up things or sending the executable somewhere else.
Could be anything..
[Updated on: Wed, 30 November 2016 19:47] Report message to a moderator
|
|
|
|
Re: Looking for example of "Post-build steps" [message #1748991 is a reply to message #1748989] |
Wed, 30 November 2016 20:19 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
I'm not clear if you are trying to get the corresponding assembly for each object file or for the build executable.
If it's for each object and you want to use the post-build step, you will need to get the objects used for the link.
The problem is the post-build step probably won't have dependencies .
You'll need to find another way to get the list.
If it's just for each object , you can get gcc to output the assembly for each source file.
This link explains how: http://stackoverflow.com/a/137074/3312726
So the compile command would be
<asm output command>; <compile command>
If you are using Windows and the makefile recipes are executed by cmd.exe I think you will need to use '&' to separate the commands.
[Updated on: Wed, 30 November 2016 20:21] Report message to a moderator
|
|
|
|
Re: Looking for example of "Post-build steps" [message #1749031 is a reply to message #1748997] |
Thu, 01 December 2016 10:16 |
Pavel Yermolenko Messages: 26 Registered: June 2015 |
Junior Member |
|
|
Jonah Graham wrote on Wed, 30 November 2016 22:23If you want the assembly of each file, the easiest option may be to add "-save-temps" as an additional compiler flag. That will cause GCC to leave the .s file rather than delete it when done. It will also IIRC save the .i (pre-processed) source file too.
Also, if you edit your compile command to run too commands, make sure you join them together with && instead of ;. Otherwise if the first command fails and the second succeeds you won't get a build error, but you will have a broken build.
Thanks Jonah,
Yes, I want assembly for each file, but for the moment I search for a solution for single file. Concerning compiler flags. First I don's use GCC, but ARMCC. Second, I'm not sure if similar flag does exist for this compiler. And finally "Post-build" sounds as something that can be executed after build process ... to process in some way the files produced by build process. Isn't it ?
In other words "automate" the actions that could otherwise be done manually form the command line, i.e.:
- run compiler on .c file that produces object (.o) file
- run "fromelf" command on this .o file to produce assembly file
I believed that "Post-build" option serves for such kind of scenarios. Or I've been mistaken ? If my supposition is correct (i.e. "Post-build" can be used for scenarios as I presented above), probably it would be reasonably to search a solution how to properly integrate "fromelf" execution into "Post-build" Eclipse interface option rather than search for some compiler flag.
After all, could you, please, show me some example where "Post build" is used.
Thanks in advance.
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06452 seconds