<commit_before>TARGET = vita-lua
TITLE_ID = STAR00001

BOOTSCRIPT ?= vitafm
FONT ?= src/font/UbuntuMono-R.ttf
SPLASH ?= src/revitalize_splash.png
MINIFY ?= no

FFI_BINDINGS = $(wildcard src/ffi/*.c)
FFI_GLUE     = $(wildcard lua/*.lua)
FFI_GLUE_C   = $(patsubst %.lua, %.c, $(FFI_GLUE))
FFI_GLUE_O   = $(patsubst %.lua, %.o, $(FFI_GLUE))
OBJS         = src/main.o

LIBS     = -ldebugnet -lvita2d -lfreetype -lpng -lz -ljpeg -lSceTouch_stub -lSceDisplay_stub -lSceGxm_stub -lSceCtrl_stub -lSceNet_stub -lSceNetCtl_stub -lSceHttp_stub -lSceAudio_stub -lScePower_stub -lSceSysmodule_stub -lluajit-5.1 -lm -lphysfs
INCLUDES = -I./includes -I$(VITASDK)/arm-vita-eabi/include/luajit-2.0

PREFIX = $(VITASDK)/bin/arm-vita-eabi

CC = $(PREFIX)-gcc
LD = $(PREFIX)-ld

DEBUGGER_IP ?= $(shell ip addr list `ip route | grep default | grep -oP 'dev \K[a-z0-9]* '` | grep -oP 'inet \K[0-9\.]*')
DEBUGGER_PORT = 18194
DEFS = -DDEBUGGER_IP=\"$(DEBUGGER_IP)\" -DDEBUGGER_PORT=$(DEBUGGER_PORT)

CFLAGS  = -Wl,-q -Wall -O3 -std=gnu99 $(DEFS) $(INCLUDES)

all: $(TARGET).vpk

%.vpk: eboot.bin
	vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
	vita-pack-vpk -s param.sfo -b eboot.bin $@

eboot.bin: $(TARGET).velf
	vita-make-fself $< $@

%.velf: %.elf
	$(PREFIX)-strip -g $<
	vita-elf-create $< $@ >/dev/null

%.c: %.lua
	@if [ "$(MINIFY)" == "yes" ]; then \
		echo luamin $< > $<_min; \
		luamin $< > $<_min; \
		echo ./scripts/generate_init.sh $<_min $*.c; \
		./scripts/generate_init.sh $<_min $*.c; \
		echo rm $<_min; \
		rm $<_min; \
	else \
		echo ./scripts/generate_init.sh $< $*.c; \
		./scripts/generate_init.sh $< $*.c; \
	fi

src/boot.c:
	@if [ "$(BOOTSCRIPT)" == "vitafm" ]; then \
		echo ./scripts/generate_bootc.sh src/vitafm/src/vitafm_launch.lua; \
		./scripts/generate_bootc.sh src/vitafm/src/vitafm_launch.lua; \
	else \
		echo ./scripts/generate_bootc.sh $(BOOTSCRIPT); \<commit_msg>Use plain zip to create vpk.<commit_after>TARGET = vita-lua
TITLE_ID = STAR00001

BOOTSCRIPT ?= vitafm
FONT ?= src/font/UbuntuMono-R.ttf
SPLASH ?= src/revitalize_splash.png
MINIFY ?= no

FFI_BINDINGS = $(wildcard src/ffi/*.c)
FFI_GLUE     = $(wildcard lua/*.lua)
FFI_GLUE_C   = $(patsubst %.lua, %.c, $(FFI_GLUE))
FFI_GLUE_O   = $(patsubst %.lua, %.o, $(FFI_GLUE))
OBJS         = src/main.o

LIBS     = -ldebugnet -lvita2d -lfreetype -lpng -lz -ljpeg -lSceTouch_stub -lSceDisplay_stub -lSceGxm_stub -lSceCtrl_stub -lSceNet_stub -lSceNetCtl_stub -lSceHttp_stub -lSceAudio_stub -lScePower_stub -lSceSysmodule_stub -lluajit-5.1 -lm -lphysfs
INCLUDES = -I./includes -I$(VITASDK)/arm-vita-eabi/include/luajit-2.0

PREFIX = $(VITASDK)/bin/arm-vita-eabi

CC = $(PREFIX)-gcc
LD = $(PREFIX)-ld

DEBUGGER_IP ?= $(shell ip addr list `ip route | grep default | grep -oP 'dev \K[a-z0-9]* '` | grep -oP 'inet \K[0-9\.]*')
DEBUGGER_PORT = 18194
DEFS = -DDEBUGGER_IP=\"$(DEBUGGER_IP)\" -DDEBUGGER_PORT=$(DEBUGGER_PORT)

CFLAGS  = -Wl,-q -Wall -O3 -std=gnu99 $(DEFS) $(INCLUDES)

all: $(TARGET).vpk

%.vpk: eboot.bin
	mkdir vpktmp || true
	vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" vpktmp/param.sfo
	cp eboot.bin vpktmp/eboot.bin
	cd vpktmp && zip ../$@ -r *

eboot.bin: $(TARGET).velf
	vita-make-fself $< $@

%.velf: %.elf
	$(PREFIX)-strip -g $<
	vita-elf-create $< $@ >/dev/null

%.c: %.lua
	@if [ "$(MINIFY)" == "yes" ]; then \
		echo luamin $< > $<_min; \
		luamin $< > $<_min; \
		echo ./scripts/generate_init.sh $<_min $*.c; \
		./scripts/generate_init.sh $<_min $*.c; \
		echo rm $<_min; \
		rm $<_min; \
	else \
		echo ./scripts/generate_init.sh $< $*.c; \
		./scripts/generate_init.sh $< $*.c; \
	fi

src/boot.c:
	@if [ "$(BOOTSCRIPT)" == "vitafm" ]; then \
		echo ./scripts/generate_bootc.sh src/vitafm/src/vitafm_launch.lua; \
		./scripts/generate_bootc.sh src/vitafm/src/vitafm_launch.lua; \
	else \
		echo ./scripts/generate_bootc.sh $(BOOTSCRIPT); \
{'fraction_non_alphanumeric': 0.19604784191367655, 'fraction_numerical': 0.011440457618304731, 'mean_word_length': 3.3370913190529876, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2024310', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1784, 'n_words': 320}