Split resources form core lua

This commit is contained in:
Łukasz Magiera 2016-01-19 01:25:14 +01:00
parent 08fc944e02
commit d40aab48ea
5 changed files with 14 additions and 6 deletions

View File

@ -9,10 +9,12 @@ BUILD = bin/
SOURCE = src/c/
CORELUA = src/lua/core
RESOURCES = resources
LIBS=-lm
GENERATED=include/luares.h src/c/gen/luares.c
GENERATED=include/luares.h src/c/gen/luares.c include/res.h src/c/gen/res.c
LUAPARAMS = $(CORELUA) include/luares.h src/c/gen/luares.c lua_
RESPARAMS = $(RESOURCES) include/res.h src/c/gen/res.c res_
LDFLAGS=-static
SRCDIRECTORIES = $(shell find $(SOURCE) -type d)
@ -27,7 +29,7 @@ $(BUILDDIRECTORIES):
mkdir -p $@
#Build
all: smallclean $(BUILDDIRECTORIES) luaresources $(BUILD)lupi
all: smallclean $(BUILDDIRECTORIES) resources $(BUILD)lupi
build: clean all
@ -38,8 +40,9 @@ $(BUILD)%.c.o: $(SOURCE)%.c
$(CC) -c $(CFLAGS) -I /usr/include -I src/c -I src/c/lib/lua $< -o $@
#Resources
luaresources: cleanresourcues
resources: cleanresourcues
scripts/txt2c $(LUAPARAMS)
scripts/txt2c $(RESPARAMS)
#Clean rules
cleanresourcues:
@ -56,4 +59,4 @@ smallclean:
# Other
.PHONY: clean cleanresourcues luaresources build smallclean all
.PHONY: clean cleanresourcues resources build smallclean all

View File

@ -3,7 +3,6 @@
extern char lua_boot[];
extern char lua_component[];
extern char lua_computer[];
extern char lua_eepromDefault[];
extern char lua_eeprom[];
extern char lua_filesystem[];
extern char lua_init[];

4
include/res.h Normal file
View File

@ -0,0 +1,4 @@
#ifndef RES_H
#define RES_H
extern char res_eepromDefault[];
#endif

View File

@ -1,4 +1,5 @@
#include "luares.h"
#include "res.h"
#include "lupi.h"
#include <lua.h>
#include <lualib.h>
@ -12,7 +13,6 @@ void setup_modules(lua_State *L) {
pushstuple(L, "component", lua_component);
pushstuple(L, "computer", lua_computer);
pushstuple(L, "eeprom", lua_eeprom);
pushstuple(L, "eepromDefault", lua_eepromDefault);
pushstuple(L, "filesystem", lua_filesystem);
pushstuple(L, "sandbox", lua_sandbox);
pushstuple(L, "textgpu", lua_textgpu);
@ -21,5 +21,7 @@ void setup_modules(lua_State *L) {
pushstuple(L, "utf8data", lua_utf8_utf8data);
pushstuple(L, "utf8", lua_utf8_utf8);
pushstuple(L, "eepromDefault", res_eepromDefault);
lua_setglobal(L, "moduleCode");
}