Skip to content
Snippets Groups Projects
Makefile 751 B
Newer Older
OBJS=mch_flasher.o serial_linux.o version.o
OUTPUT=mch_flasher
all:	$(OBJS)
		${CC} -o $(OUTPUT) $(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 "" >> $@
		rm -f version.c $(OBJS) $(OUTPUT)