diff --git a/examples/lua_basic/Makefile b/examples/lua_basic/Makefile
index 21793cae59d59ed90f64d5ad8087c917e2673003..212c31f99a690c7b778da7d1f8950f2972e309b2 100644
--- a/examples/lua_basic/Makefile
+++ b/examples/lua_basic/Makefile
@@ -36,13 +36,7 @@ endif
 
 USEPKG += lua
 
-include $(RIOTBASE)/Makefile.include
-
-# The code below generates a header file from any .lua scripts in the
-# example directory. The header file contains a byte array of the
-# ASCII characters in the .lua script.
-
-LUA_PATH := $(BINDIR)/lua
+LUA_PATH = $(BINDIR)/lua
 
 # add directory of generated *.lua.h files to include path
 CFLAGS += -I$(LUA_PATH)
@@ -50,14 +44,20 @@ CFLAGS += -I$(LUA_PATH)
 # generate .lua.h header files of .lua files
 LUA = $(wildcard *.lua)
 
-LUA_H := $(LUA:%.lua=$(LUA_PATH)/%.lua.h)
+LUA_H = $(LUA:%.lua=$(LUA_PATH)/%.lua.h)
 
-$(LUA_PATH)/:
-	@mkdir -p $@
+BUILDDEPS += $(LUA_H) $(LUA_PATH)/
 
-$(LUA_H): | $(LUA_PATH)/
-$(LUA_H): $(LUA_PATH)/%.lua.h: %.lua
+include $(RIOTBASE)/Makefile.include
+
+# The code below generates a header file from any .lua scripts in the
+# example directory. The header file contains a byte array of the
+# ASCII characters in the .lua script.
 
-	xxd -i $< | sed 's/^unsigned/const unsigned/g' > $@
+$(LUA_PATH)/:
+	$(Q)mkdir -p $@
 
-$(RIOTBUILD_CONFIG_HEADER_C): $(LUA_H)
+# FIXME: This way of embedding lua code is not robust. A proper script will
+#        be included later.
+$(LUA_H): $(LUA_PATH)/%.lua.h: %.lua | $(LUA_PATH)/
+	$(Q)xxd -i $< | sed 's/^unsigned/const unsigned/g' > $@