ARCHES := x86 arm
# overrides to s9pk.mk must precede the include statement

# Build x86_64 + aarch64 only (matches manifest images.arch).
# The default goal vendors the Node app into ./app (the Docker build context)
# before delegating to s9pk.mk's build matrix.
.DEFAULT_GOAL := default
.PHONY: default prep clean-app

# Root of the Premier Gunner Node app (this s9pk lives in ./s9pk).
APP_SRC := ..

default: prep
	@$(MAKE) --no-print-directory all

# Sync app sources into ./app so the Dockerfile can COPY them. node_modules and
# runtime data are excluded; the Dockerfile reinstalls deps via `npm ci`.
prep:
	@echo "   Vendoring Node app into ./app ..."
	@rm -rf app
	@mkdir -p app
	@rsync -a \
		--exclude='node_modules/' \
		--exclude='data/' \
		--exclude='s9pk/' \
		--exclude='.git/' \
		--exclude='*.log' \
		--exclude='.DS_Store' \
		--exclude='.env' \
		"$(APP_SRC)/package.json" \
		"$(APP_SRC)/package-lock.json" \
		"$(APP_SRC)/src" \
		"$(APP_SRC)/public" \
		app/

clean-app:
	rm -rf app

include s9pk.mk
