1.6 Pre- and Postbuild steps

CodeBlocks

[Contents] CodeBlocks Manual   [Search] Search

[Table of contents]

1.6 Pre- and Postbuild steps


CodeBlocks makes it possible to perform additional operations before or after compiling a project. These operations are called Prebuilt or Postbuilt Steps. Typical Postbuilt Steps are:
  • Creating an Intel Hexformat from a finished object
  • Manipulating objects by objcopy
  • Generating dump files by objdump
Example
Creating a Disassembly from an object under Windows. Piping to a file requires calling cmd with the /c option.
  cmd /c objdump -D name.elf > name.dis
Archiving a project can be another example for a Postbuilt Step. For this purpose, create a Build Target ’Archive’ and include the following instruction in the Postbuilt Step:
  zip -j9 $(PROJECT_NAME)_$(TODAY).zip src h obj $(PROJECT_NAME).cbp
With this command, the active project and its sources, header and objects will be packed as a zip file. In doing so, the Built-in variables $(PROJECT_NAME) and $(TODAY), the project name and the current date will be extracted (see section 3.2). After the execution of the Target ’Archive’, the packed file will be stored in the project directory.
In the share/codeblocks/scripts directory you will find some examples for scripts. You can add a script via menu ’Settings’ /’Scripting’ and register in a menu. If you execute e.g. the script make_dist from the menu then all files belonging to a project will be compressed in an archive <project>.tar.gz.


[Previous] 1.5  Virtual Targets
[Next] 1.7  Adding Scripts in Build Targets

Created: 2010/25/05 11:52   Updated: 2010/25/05 11:52
Author: HighTec EDV-Systeme GmbH
Copyright © 2010 HighTec EDV-Systeme GmbH