COQVERSION:= $(shell $(COQBIN)coqtop -v | head -1 | grep -E '(trunk|master)' | wc -l | sed 's/ *//g')

ifneq "$(COQVERSION)" "0"
  COQVERSION:= dev
else
  COQVERSION:= $(shell $(COQBIN)coqtop --print-version | cut -d" " -f1)
  ifneq (,$(findstring +,$(COQVERSION)))
    COQVERSION:= $(shell echo $(COQVERSION) | cut -d"+" -f1)
  else
    COQVERSION:= $(shell echo $(COQVERSION) | cut -d"." -f1-2)
  endif
endif
