aboutsummaryrefslogtreecommitdiffhomepage
path: root/GNUmakefile
blob: c69b87c328d7844c2fde825a5b223d52df17beba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
GO := go

cssfiles  := $(shell find static -name '*.css' -not -name '*.min.css')
cssfiles  := $(cssfiles:.css=.min.css)
gofiles   := $(shell find main.go src -name '*.go')
sqlfiles  := $(shell find src/dbx/sql -name '*.sql')
templates := $(shell find src/templates -name '*.tmpl')

exttmpl := $(wildcard cmd/exttmpl/*.go)

all: euro-cash.eu exttmpl

euro-cash.eu: $(cssfiles) $(templates) $(gofiles) $(sqlfiles)
	$(GO) build

all-i18n: exttmpl
	find . -name '*.html.tmpl' -exec ./exttmpl -out po/templates.pot {} +
	for bcp in en en-US nl;                                                     \
	do                                                                          \
		mkdir -p "po/$$bcp";                                                    \
		msgmerge --update "po/$$bcp/messages.po" po/templates.pot;              \
	done
	$(GO) build

exttmpl: $(exttmpl)
	$(GO) build ./cmd/exttmpl

%.min.css: %.css
	if command -v lightningcss >/dev/null;                                      \
	then                                                                        \
		lightningcss -m $< -o $@;                                               \
	else                                                                        \
		cp $< $@;                                                               \
	fi

clean:
	find . -type f \(                                                           \
		-name euro-cash.eu                                                      \
		-or -name exttmpl                                                       \
		-or -name '*.min.css'                                                   \
		-or -name '*.tar.gz'                                                    \
	\) -delete

.PHONY: all-i18n clean release