Commit 377ba6ce authored by Benoit Rat's avatar Benoit Rat

Add the git version inside the flasher

parent 3d2b9991
version.c
mch_flasher mch_flasher
OBJS=mch_flasher.o serial_linux.o version.o
OUTPUT=mch_flasher
OBJS = mch_flasher.o serial_linux.o all: $(OBJS)
FLASHER = mch_flasher ${CC} -o $(OUTPUT) $(OBJS)
all: $(FLASHER)
$(FLASHER): $(OBJS) version.c: ../.git/HEAD ../.git/index
${CC} -o $@ $(OBJS) echo "/**" > $@
echo " * File automatically generated by Makefile (DO NOT MODIFIED)\n *\n * To use this you in a c code just add the following lines:\n * " >> $@
echo "\textern const char build_time[];\n\textern const char git_user[];\n\textren const char git_revision[];\n * " >> $@
echo "**/" >> $@
echo 'const char build_time[] = __DATE__ " @ " __TIME__ ;' >> $@
echo "const char git_user[] = \"$(shell git config --get user.name)\";" >> $@
echo "const char git_revision[] = \"$(shell git rev-parse HEAD)\";" >> $@
echo "" >> $@
clean: clean:
rm -f $(OBJS) $(FLASHER) *~ rm -f version.c $(OBJS) $(OUTPUT):q:q
...@@ -42,6 +42,11 @@ ...@@ -42,6 +42,11 @@
#define PORT_SPEED 115200 #define PORT_SPEED 115200
//External variable from version.c
extern const char build_time[];
extern const char git_user[];
extern const char git_revision[];
char *program_path; char *program_path;
int applet_silent_mode = 1; int applet_silent_mode = 1;
...@@ -418,6 +423,8 @@ main(int argc, char *argv[]) ...@@ -418,6 +423,8 @@ main(int argc, char *argv[])
if(argc > 2) if(argc > 2)
serial_port = argv[2]; serial_port = argv[2];
//Print line to know the version of software for testing purpose
fprintf(stderr,"\nCompiled by %s (%s)\ngit rev:%s\n\n",git_user,build_time,git_revision);
program_path = dirname(argv[0]); program_path = dirname(argv[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment