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

Add the git version inside the flasher

parent 3d2b9991
OBJS=mch_flasher.o serial_linux.o version.o
OUTPUT=mch_flasher
OBJS = mch_flasher.o serial_linux.o
FLASHER = mch_flasher
all: $(OBJS)
${CC} -o $(OUTPUT) $(OBJS)
all: $(FLASHER)
$(FLASHER): $(OBJS)
${CC} -o $@ $(OBJS)
version.c: ../.git/HEAD ../.git/index
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:
rm -f $(OBJS) $(FLASHER) *~
rm -f version.c $(OBJS) $(OUTPUT):q:q
......@@ -42,6 +42,11 @@
#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;
int applet_silent_mode = 1;
......@@ -418,6 +423,8 @@ main(int argc, char *argv[])
if(argc > 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]);
......@@ -437,4 +444,4 @@ main(int argc, char *argv[])
serial_close();
return 0;
}
\ No newline at end of file
}
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