diff --git a/Makefile b/Makefile
index c44637d..23b88f1 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ $(OUT)ppkb-usb-debugger: usb-debugger.c common.c
$(OUT)kmap.h: keymaps/physical-map.txt keymaps/factory-keymap.txt
@mkdir -p $(OUT)
- php keymaps/map-to-c.php $^ > $@
+ php keymaps/map-to-c.php $^ $@
$(OUT)ppkb-i2c-inputd: i2c-inputd.c $(OUT)kmap.h common.c
@mkdir -p $(OUT)
diff --git a/keymaps/map-to-c.php b/keymaps/map-to-c.php
index 681e962..1a99327 100644
--- a/keymaps/map-to-c.php
+++ b/keymaps/map-to-c.php
@@ -20,9 +20,23 @@
* along with this program. If not, see .
*/
+set_error_handler(function($severity, $message, $file, $line) {
+ if (!(error_reporting() & $severity))
+ return;
+
+ throw new ErrorException($message, 0, $severity, $file, $line);
+});
+
+if (count($argv) != 4) {
+ echo "Usage: $argv[0]