# Define the source .typ files and the target PDF names
TYP_FILES := $(wildcard *.typ)
PDF_FILES := $(TYP_FILES:.typ=.pdf)
PREFIXED_PDFS := $(addprefix danielchen_, $(PDF_FILES))

# Rule to build all PDFs with the "danielchen_" prefix
all: $(PREFIXED_PDFS)

danielchen_%.pdf: %.typ
	typst compile $< $@

# Rule for watching all .typ files concurrently
watch:
	@$(foreach file, $(TYP_FILES), \
		(typst watch $(file) danielchen_$(basename $(file)).pdf &) ; \
	)
	@wait

# Cleanup rule
clean:
	rm -f danielchen_*.pdf