OBJS=mch_flasher.o serial_linux.o version.o
OUTPUT=mch_flasher

CFLAGS = -Wall

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 "" >> $@

clean:
		rm -f version.c $(OBJS) $(OUTPUT)
