Browse Source

Split resources form core lua

pull/4/head
Łukasz Magiera 7 years ago
parent
commit
d40aab48ea
  1. 11
      Makefile
  2. 1
      include/luares.h
  3. 4
      include/res.h
  4. 0
      resources/eepromDefault.lua
  5. 4
      src/c/modules.c

11
Makefile

@ -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

1
include/luares.h

@ -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

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

0
src/lua/core/eepromDefault.lua → resources/eepromDefault.lua

4
src/c/modules.c

@ -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");
}
Loading…
Cancel
Save