diff --git a/build_all b/build_all
index de649bcc3cc1a1cc474183611055ce85df33ca87..14faf2b77ecd833dceccf800c16caed4c6d30c69 100755
--- a/build_all
+++ b/build_all
@@ -2,6 +2,6 @@
 
 chmod o-rwx $(dirname $0)
 make -C $(dirname $0)/pip-install-to-json \
-     REPO=$(pwd)/repo STATE=$(pwd)/state install
+     REPO=$(pwd)/repo STATE_DIR=$(pwd)/state install
 make -C $(dirname $0)/mbed-cli \
-     REPO=$(pwd)/repo STATE=$(pwd)/state build
+     REPO=$(pwd)/repo STATE_DIR=$(pwd)/state build