I would like to embed a Git revision (SHA1) in my executables during build. I can do it locally as follows:
git log -1 --format='%h' >version objcopy --input binary --output elf64-x86-64 version version.o
The problem is that I am using NetBeans (on Windows) for remote creation (on Linux). This is a bit of a paradox: the Git command seems to be running on the local computer (where the source is), but the objcopy command should be running on the remote server (where the build is). This is a problem because while NetBeans allows me to edit the Makefile project to insert the pre-build step, I cannot figure out how and where to put the Git command so that it runs on the local computer before the remote build steps.
I tried to create a separate NetBeans project to run the Git team on a local hosting, believing that I would depend on this “real” project, but NetBeans does not seem to allow me to create a project that “does nothing” (i.e. it does not have source files and does not create a library or executable file - it will only generate a text file version).
I am using NetBeans 7.3 for C ++ with the option "Auto Copy" for remote assemblies. A possible solution would be to use NFS / Samba mode with a Git repository stored on the server, but that would be pretty damaging, since there are already several developers using automatic copying in the project for a long time. Therefore, it would be great to have a solution to create some files locally in NetBeans before starting the remote build.
source share