.PHONY=static all clean

ALL_STATIC := $(patsubst res/static/%,public/%,$(wildcard res/static/*))
ALL_TEMPLATES := $(wildcard res/templates/*.html)
PY_SRC := $(wildcard src/**.py)

NAME ?= Cancionero San Leandro
AUTHOR ?= 2025 Carlos Galindo, Parroquia San Leandro
SLO_LINKS ?= false


all: public public/audios public/index.html static

static: $(ALL_STATIC)

public:
	mkdir public

public/index.html: $(ALL_TEMPLATES) $(PY_SRC)
	python3 src/latex_scanner.py \
		--latex latex/cancionero.tex \
		--audios audios \
		--other-latex latex/canciones/ \
		--use-cache \
		--title "$(NAME)" \
		--author "$(AUTHOR)" \
		--links "$(SLO_LINKS)"

public/audios: audios public
	rm -f public/audios
	#ln -s ../audios/Canciones public/audios

public/%: res/static/%
	cp -ra $< $@

clean:
	rm -rf public
	rm -f songs.dat
