2018-03-28 17:45:53 +02:00
|
|
|
APPLICATION = lua_basic
|
2018-05-22 12:08:30 +02:00
|
|
|
|
|
|
|
# If no BOARD is found in the environment, use this default:
|
|
|
|
BOARD ?= native
|
|
|
|
|
|
|
|
# This has to be the absolute path to the RIOT base directory:
|
|
|
|
RIOTBASE ?= $(CURDIR)/../..
|
|
|
|
|
|
|
|
# Comment this out to disable code in RIOT that does safety checking
|
|
|
|
# which is not needed in a production environment but helps in the
|
|
|
|
# development process:
|
|
|
|
DEVELHELP ?= 1
|
|
|
|
|
|
|
|
# Change this to 0 show compiler invocation lines by default:
|
|
|
|
QUIET ?= 1
|
|
|
|
|
|
|
|
ifneq ($(BOARD),native)
|
|
|
|
# This stack size is large enough to run Lua print() functions of
|
|
|
|
# various lengths. Other functions untested.
|
2018-03-28 17:45:53 +02:00
|
|
|
CFLAGS += -DTHREAD_STACKSIZE_MAIN='(THREAD_STACKSIZE_DEFAULT+2048)'
|
2018-05-22 12:08:30 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
USEPKG += lua
|
|
|
|
|
2018-11-22 16:29:47 +01:00
|
|
|
LUA_PATH = $(BINDIR)/lua
|
2018-05-22 12:08:30 +02:00
|
|
|
|
|
|
|
# add directory of generated *.lua.h files to include path
|
|
|
|
CFLAGS += -I$(LUA_PATH)
|
|
|
|
|
|
|
|
# generate .lua.h header files of .lua files
|
|
|
|
LUA = $(wildcard *.lua)
|
|
|
|
|
2018-11-22 16:29:47 +01:00
|
|
|
LUA_H = $(LUA:%.lua=$(LUA_PATH)/%.lua.h)
|
2018-05-22 12:08:30 +02:00
|
|
|
|
2018-11-22 16:29:47 +01:00
|
|
|
BUILDDEPS += $(LUA_H) $(LUA_PATH)/
|
2018-05-22 12:08:30 +02:00
|
|
|
|
2018-11-22 16:29:47 +01:00
|
|
|
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.
|
2018-05-22 12:08:30 +02:00
|
|
|
|
2018-11-22 16:29:47 +01:00
|
|
|
$(LUA_PATH)/:
|
|
|
|
$(Q)mkdir -p $@
|
2018-05-22 12:08:30 +02:00
|
|
|
|
2018-11-22 16:29:47 +01:00
|
|
|
# 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' > $@
|