+\fBbuildcounter\fR is a small automatic tool that helps keeping track of different builds for projects in C/C++. It works by creating and modifying a header file with a single define \fBBUILDNO\fR that counts with each invocation starting with 1.

+.SH OPTIONS

+.IP "\fB-s\fR" 4

+Silent mode: Without this parameter, \fBbuildcounter\fR will not only write the define to the given filename, but also to stdout.

+.SH USING BUILDCOUNTER

+To use \fBbuildcounter\fR for your project, do this:

+.IP "\fB1\fR" 4

+In your source folder, call \fBbuildcounter buildno.h\fR manually. As this creates an internal header file, it should not go into a special include folder.

+.IP "\fB2\fR" 4

+Create a target called "buildno.h" in your makefile.

+If you do not have a default target containing only dependencies yet, create one. Make it dependend to all necessary build steps and add the "buildno.h" to the end.

+

+\fBExample:\fR

+.IP "" 8

+all: withoutcounting buildno.h

+

+withoutcounting: a.out

+

+a.out: test.c

+ gcc test.c

+

+buildno.h: test.c

+ buildcounter -s buildno.h

+

+.IP "\fB3\fR" 4

+In your code, include "buildno.h" and use \fBBUILDNO\fR.

+Build your code normally using the default target (or explicitly call "make all"). If you do not want to increase the counter after a specific build, call "make withoutcounting".

+

+.SH REMARKS

+Finding the right place to call \fBbuildcounter\fR allows some easy mistakes.

+It should only be called once for each successful build. That means that you should call it after the real building.

+If you forget to make it dependend of any of your source files, \fBbuildcounter\fR will be called even if there where no changes at all. If you only add some but not all source files, changes of other files will not change the counter.

+

+.SH BUGS

+No known bugs.

+If you find one, please use \fBhttps://bitbucket.org/Ragnara/buildcounter\fR to create a ticket.

-\fBbuildcounter\fR is a small automatic tool that helps keeping track of different builds for projects in C/C++. It works by creating and modifying a header file with a single define \fBBUILDNO\fR that counts with each invocation starting with 1.

-.SH OPTIONS

-.IP "\fB-s\fR" 4

-Silent mode: Without this parameter, \fBbuildcounter\fR will not only write the define to the given filename, but also to stdout.

-.SH USING BUILDCOUNTER

-To use \fBbuildcounter\fR for your project, do this:

-.IP "\fB1\fR" 4

-In your source folder, call \fBbuildcounter buildno.h\fR manually. As this creates an internal header file, it should not go into a special include folder.

-.IP "\fB2\fR" 4

-Create a target called "increasebuildcounter" in your makefile. Make it a .PHONY target.

-If you do not have a default target containing only dependencies yet, create one. Make it dependend to all necessary build steps and add the "increasebuildcounter" to the end.

-

-\fBExample:\fR

-.IP "" 8

-all: withoutcounting increasebuildcounter

-

-withoutcounting: a.out

-

-a.out: test.c

- gcc test.c

-

-increasebuildcounter:

- buildcounter -s buildno.h

-

-.IP "\fB3\fR" 4

-In your code, include "buildno.h" and use \fBBUILDNO\fR.

-Build your code normally using the default target (or explicitly call "make all"). If you do not want to increase the counter after a specific build, call "make withoutcounting".

-

-.SH BUGS

-No known bugs.

-If you find one, please use \fBhttps://bitbucket.org/Ragnara/buildcounter\fR to create a ticket.

-.SH AUTHOR

-b.w (a) gmx (.) tm

File
distributions/out/.gitignore

File
readme.rst

1

In your source folder, call **buildcounter buildno.h** manually. As this creates an internal header file, it should not go into a special include folder.

2

- Create a target called "increasebuildcounter" in your makefile. Make it a .PHONY target. If you do not have a default target containing only dependencies yet, create one. Make it dependend to all necessary build steps and add the "increasebuildcounter" to the end.

+ Create a target called "buildno.h" in your makefile. If you do not have a default target containing only dependencies yet, create one. Make it dependend to all necessary build steps and add the "buildno.h" to the end.

*Example:*

::

- all: withoutcounting increasebuildcounter

-

- withoutcounting: a.out

+ all: withoutcounting buildno.h

- a.out: test.c

- gcc test.c

+ withoutcounting: a.out

- increasebuildcounter:

+ a.out: test.c

+ gcc test.c

+

+ buildno.h: test.c

buildcounter -s buildno.h

3

In your code, include "buildno.h" and use **BUILDNO**. Build your code normally using the default target (or explicitly call "make all"). If you do not want to increase the counter after a specific build, call "make withoutcounting".

+Remarks

+.......

+

+Finding the right place to call buildcounter allows some easy mistakes.

+It should only be called once for each successful build. That means that you should call it after the real building.

+If you forget to make it dependend of any of your source files, buildcounter will be called even if there where no changes at all. If you only add some but not all source files, changes of other files will not change the counter.