From b9c3b8d688434919f9cb68f53eab8238f26e6c2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Krzysztof=20Wos=CC=81?= <krzysztof.wos@gmail.com>
Date: Mon, 20 Mar 2017 13:07:01 +0900
Subject: [PATCH] Exit with an error if re2c is not available

Instead of overwriting src/json.hpp with an empty file
---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index df05e62e..20857022 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 .PHONY: pretty clean ChangeLog.md
 
 # used programs
-RE2C = re2c
+RE2C := $(shell command -v re2c 2> /dev/null)
 SED = sed
 
 # main target
@@ -185,6 +185,9 @@ clang_sanitize: clean
 
 # create scanner with re2c
 re2c: src/json.hpp.re2c
+ifndef RE2C
+	$(error "re2c is not available, please install re2c")
+endif
 	$(RE2C) -W --utf-8 --encoding-policy fail --bit-vectors --nested-ifs --no-debug-info $< | $(SED) '1d' > src/json.hpp
 
 # pretty printer