104 lines
2.5 KiB
Makefile
Raw Normal View History

2026-01-28 19:34:39 +01:00
# retoor <retoor@molodetz.nl>
2025-01-04 06:00:03 +01:00
2025-03-20 02:57:47 +01:00
CC = gcc
2026-01-28 19:34:39 +01:00
CFLAGS = -Ofast -Werror -Wall -I./include
LDFLAGS = -lreadline -lncurses -lcurl -ljson-c -lsqlite3 -lm -lpthread -lssl -lcrypto
SRCDIR = src
TOOLSDIR = src/tools
BUILDDIR = build
BINDIR = bin
SRC_CORE = $(SRCDIR)/r_error.c \
$(SRCDIR)/r_config.c \
$(SRCDIR)/tool_registry.c \
$(SRCDIR)/db.c \
$(SRCDIR)/http_client.c \
$(SRCDIR)/messages.c \
$(SRCDIR)/agent.c \
$(SRCDIR)/bash_executor.c \
2026-01-28 20:15:02 +01:00
$(SRCDIR)/context_manager.c \
2026-01-29 00:38:21 +01:00
$(SRCDIR)/r_diff.c \
2026-01-28 19:34:39 +01:00
$(SRCDIR)/main.c
SRC_TOOLS = $(TOOLSDIR)/tools_init.c \
$(TOOLSDIR)/tool_terminal.c \
$(TOOLSDIR)/tool_file.c \
$(TOOLSDIR)/tool_db.c \
$(TOOLSDIR)/tool_http.c \
$(TOOLSDIR)/tool_python.c \
2026-01-29 00:38:21 +01:00
$(TOOLSDIR)/tool_indexer.c \
$(TOOLSDIR)/tool_code.c \
$(TOOLSDIR)/tool_file_edit.c \
$(TOOLSDIR)/tool_system.c \
$(TOOLSDIR)/tool_network.c \
$(TOOLSDIR)/tool_dns.c \
$(TOOLSDIR)/tool_automation.c \
$(TOOLSDIR)/tool_csv.c
2026-01-28 19:34:39 +01:00
SRC = $(SRC_CORE) $(SRC_TOOLS)
OBJ_CORE = $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SRC_CORE))
OBJ_TOOLS = $(patsubst $(TOOLSDIR)/%.c,$(BUILDDIR)/tools/%.o,$(SRC_TOOLS))
OBJ = $(OBJ_CORE) $(OBJ_TOOLS)
.PHONY: all clean build build_legacy run
all: build
build: $(BINDIR)/r
cp $(BINDIR)/r r
$(BINDIR)/r: $(OBJ)
@mkdir -p $(BINDIR)
$(CC) $(OBJ) $(LDFLAGS) -o $@
$(BUILDDIR)/%.o: $(SRCDIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/tools/%.o: $(TOOLSDIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
build_legacy:
@mkdir -p $(BINDIR)
$(CC) main.c $(CFLAGS) $(LDFLAGS) -o $(BINDIR)/r_legacy
cp $(BINDIR)/r_legacy r
2025-04-13 00:21:00 +02:00
2025-03-20 02:57:47 +01:00
build_rpylib:
2025-03-27 23:08:00 +01:00
$(CC) -shared -o rpylib.so -fPIC rpylib.c -lpython3.12 `python3-config --includes` -I/usr/include/CL -ljson-c -lcurl -lsqlite3
2025-03-20 02:57:47 +01:00
2026-01-28 19:34:39 +01:00
run: build
2025-03-22 03:15:49 +01:00
./r --verbose
2025-03-28 20:50:10 +01:00
2026-01-28 19:34:39 +01:00
install:
cp ./r /usr/local/bin/r
2025-03-30 01:09:06 +01:00
2026-01-28 19:34:39 +01:00
clean:
rm -rf $(BUILDDIR) $(BINDIR)
rm -f r
2025-03-30 01:09:06 +01:00
2026-01-28 19:34:39 +01:00
appimage: build
-@rm -rf AppImage
mkdir -p AppImage/usr/bin
mkdir -p AppImage/lib
cp AppRun AppImage/AppRun
cp r.desktop AppImage/r.desktop
cp r.png AppImage/r.png
cp $(BINDIR)/r AppImage/usr/bin/r
./collect_so_files.sh
appimagetool-x86_64.AppImage AppImage
mv r-x86_64.AppImage r
2025-04-02 15:37:59 +02:00
2025-03-30 01:09:06 +01:00
docker: docker_make docker_run
2026-01-28 19:34:39 +01:00
2025-03-30 01:09:06 +01:00
docker_make:
docker build -t r .
2026-01-28 19:34:39 +01:00
2025-03-30 01:09:06 +01:00
docker_run:
docker run -v .:/app --rm -it r
2025-05-05 14:09:21 +02:00
build_deb:
2025-05-14 05:23:36 +02:00
dpkg-deb --build r_package