Adiciona libraries toml/fs, metadados .toml e build por library

- tinyblocks-toml: lexer + parser TOML (include/lexeme.h, include/ast.h,
  src/lexer.c, src/parser.c) e bloco Toml.Get.
- tinyblocks-fs: categoria "Arquivos" com FS.Open/Read/Write/Append/Tell/Close.
- library.toml em cada library com metadados (categoria, cor, descricao) e
  receita de build, sem precisar embutir isso no .so.
- Makefiles proprios por library com build/ local; Makefile raiz delega.
- Palco (tb_stage) movido para o core; pen deixa de depender do editor, o
  que torna os .so arrastaveis.
- Editor linka com -rdynamic para resolver simbolos do core em .so via dlopen.
- Testes: test-toml (parser) e test-plugin (dlopen de .so standalone).
This commit is contained in:
mguinhos committed 2026-10-20 19:38:58 -03:00
1 parent 90d47bf8a0
commit dc23b92d15
48 files changed
+2405 -744

No files matched your search

+20 -22
View File
@@ -1,35 +1,33 @@
# Makefile da library editor (editor visual estilo Scratch)
# Constroi build/libtinyblocks-editor.a e build/libtinyblocks-editor.so
# Inclui o widget Editor.Stage (tb_stage.c).
CC := gcc
BUILD := ../../build
SDL2_CFLAGS := $(shell sdl2-config --cflags)
SDL2_LIBS := $(shell sdl2-config --libs)
SDL2TTF_CFLAGS:= $(shell pkg-config --cflags SDL2_ttf 2>/dev/null)
SDL2TTF_LIBS := $(shell pkg-config --libs SDL2_ttf 2>/dev/null)
ifeq ($(SDL2TTF_LIBS),)
$(error SDL2_ttf não encontrado. Instale: sudo apt install libsdl2-ttf-dev)
endif
BUILD := build
CORE := ../../build
CFLAGS := -std=c11 -Wall -Wextra -pedantic -fvisibility=hidden \
-D_POSIX_C_SOURCE=200809L \
-I../../include \
-Iinclude \
$(SDL2_CFLAGS) $(SDL2TTF_CFLAGS)
-D_POSIX_C_SOURCE=200809L \
-I../../include -Iinclude -Isrc \
-I../tinyblocks-graphics/include \
-I../tinyblocks-variables/include
LDFLAGS := $(SDL2_LIBS) $(SDL2TTF_LIBS) -lm
OBJ := $(BUILD)/tb_editor.o
OBJ := $(BUILD)/tb_editor.o $(BUILD)/tb_stage_widget.o
LIB_A := $(BUILD)/libtinyblocks-editor.a
LIB_SO := $(BUILD)/libtinyblocks-editor.so
.PHONY: all static shared clean
all: static shared
static: $(LIB_A)
shared: $(LIB_SO)
$(OBJ): src/tb_editor.c include/tb_editor.h
$(BUILD)/tb_editor.o: src/tb_editor.c include/tb_editor.h src/tb_stage_widget.h \
../tinyblocks-graphics/include/tb_graphics.h \
../tinyblocks-variables/include/tb_variables.h
@mkdir -p $(BUILD)
$(CC) $(CFLAGS) -fPIC -c $< -o $@
$(BUILD)/tb_stage_widget.o: src/tb_stage_widget.c src/tb_stage_widget.h \
../tinyblocks-graphics/include/tb_graphics.h
@mkdir -p $(BUILD)
$(CC) $(CFLAGS) -fPIC -c $< -o $@
@@ -37,7 +35,7 @@ $(LIB_A): $(OBJ)
ar rcs $@ $^
$(LIB_SO): $(OBJ)
$(CC) -shared -o $@ $^ $(LDFLAGS)
$(CC) -shared -o $@ $^ -ldl
clean:
$(RM) $(OBJ) $(LIB_A) $(LIB_SO)
$(RM) -r $(BUILD)