camper/Makefile

53 lines
1.6 KiB
Makefile

HTML_FILES := $(shell find web -name *.gohtml -o -name *.svg)
GO_FILES := $(shell find . -name *.go)
DEFAULT_DOMAIN = camper
POT_FILE = po/$(DEFAULT_DOMAIN).pot
LINGUAS = ca es fr
MO_FILES = $(patsubst %,locale/%/LC_MESSAGES/$(DEFAULT_DOMAIN).mo,$(LINGUAS))
XGETTEXTFLAGS = --no-wrap --from-code=UTF-8 --package-name=camper --msgid-bugs-address=jordi@tandem.blog
DEMO_SQL = demo.sql
all: locales $(DEMO_SQL)
locales: $(MO_FILES)
locale/%/LC_MESSAGES/camper.mo: po/%.po
mkdir -p $(@D)
msgfmt -o $@ $<
po/%.po: $(POT_FILE)
msgmerge --no-wrap --update --backup=off $@ $<
$(POT_FILE): $(HTML_FILES) $(GO_FILES)
xgettext $(XGETTEXTFLAGS) --language=Scheme --output=$@ --keyword=pgettext:1,2c $(HTML_FILES)
xgettext $(XGETTEXTFLAGS) --language=C --output=$@ --keyword=Gettext:1 --keyword=GettextNoop:1 --keyword=Pgettext:1,2c --keyword=PgettextNoop:1,2c --join-existing $(GO_FILES)
test-deploy:
sqitch deploy --db-name $(PGDATABASE)
pg_prove test/*
$(DEMO_SQL): demo/demo.sql demo/plots.avif demo/safari_tents.avif demo/bungalows.avif demo/wooden_lodges.avif
m4 --prefix-builtins $< > $@
clean:
$(RM) $(DEMO_SQL)
$(RM) $(MO_FILES)
$(RM) $(POT_FILE)
$(RM) debian/debhelper-build-stamp
$(RM) debian/camper-demo.substvars
$(RM) debian/camper-sqitch.substvars
$(RM) debian/camper.postrm.debhelper
$(RM) debian/camper.substvars
$(RM) debian/files
$(RM) debian/golang-tandem-camper-dev.substvars
$(RM) -r _build/
$(RM) -r debian/.debhelper/
$(RM) -r debian/camper/
$(RM) -r debian/golang-tandem-camper-dev/
$(RM) -r debian/tmp/
$(RM) -r debian/camper-demo/
$(RM) -r debian/camper-sqitch/
.PHONY: locales test-db clean