summaryrefslogtreecommitdiffhomepage
path: root/GNUmakefile
blob: 3c48127b3a91cf4bfd0f68bdcfeaba29b90045f6 (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
45
cssfiles  := $(shell find static -name '*.css' -not -name '*.min.css')
cssfiles  := $(cssfiles:.css=.min.css)
gofiles   := $(shell find main.go src -name '*.go')
templates := $(shell find src/templates -name '*.tmpl')

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

all: euro-cash.eu exttmpl mfmt

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

all-i18n: exttmpl
	go generate ./src
	find . -name out.gotext.json | mcp -b sed s/out/messages/
	go build

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

mfmt: $(mfmt)
	go build ./cmd/mfmt

%.min.css: %.css
	lightningcss -m $< -o $@

watch:
	ls euro-cash.eu | entr -r ./euro-cash.eu -no-email -port $${PORT:-8080}

release: all-i18n
	[ -n "$$GOOS" -a -n "$$GOARCH" ]
	find data static -type f \(                                                 \
		-not -name '*.css'                                                      \
		-or -name '*.min.css'                                                   \
	\) -exec tar -cf euro-cash.eu-$$GOOS-$$GOARCH.tar.gz euro-cash.eu {} +

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