-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
66 lines (50 loc) · 1.96 KB
/
Makefile
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
PKG = github.com/gopheracademy/manager
CMD = manager
all: $(CMD)
################################################################################
# building/bundling CSS/JS artifacts
# BRIAN: These targets don't work - they're from an example on the internet
#
hash-fonts: FORCE
bash ./src/hash-artifacts.sh build/fonts-by-hash src/*.otf
build/fonts-by-hash/fonts.scss: hash-fonts
sh ./src/render-font-css.sh > $@
build/alltag.css: src/alltag.scss | build/fonts-by-hash/fonts.scss
sassc -t compressed -I vendor/github.com/majewsky/xyrillian.css -I build/fonts-by-hash $< $@
hashed-artifacts: build/alltag.css src/alltag.js | src/hash-artifacts.sh hash-fonts FORCE
bash ./src/hash-artifacts.sh build/by-hash $^ src/*.otf
build/bindata/bindata.go: hashed-artifacts
@mkdir -p build/bindata
go-bindata -modtime 1 -pkg bindata -prefix build/by-hash/ -o $@ build/by-hash/*
# build the cms
content: FORCE
@cd content && npm install && npm run build
# build the website
www: FORCE
@cd www && npm install && npm run build
################################################################################
# compiling and installing the binary
# NOTE: This repo uses Go modules, and uses a synthetic GOPATH at
# $(CURDIR)/.gopath that is only used for the build cache. $GOPATH/src/ is
# empty.
GO = GOPATH=$(CURDIR)/.gopath GOBIN=$(CURDIR)/build go
GO_BUILDFLAGS =
GO_LDFLAGS = -s -w
$(CMD): deps generate www
$(GO) build $(GO_BUILDFLAGS) -ldflags '$(GO_LDFLAGS)' '$(PKG)'
################################################################################
# utilities
# convenience target for developers: `make run` runs the application with
# environment options sourced from $PWD/.env
run:$(CMD)
set -euo pipefail && source ./.env && .$(CMD) $*
vendor: FORCE
$(GO) mod tidy
$(GO) mod vendor
# generate all the service files from the oto definitions in the def directory
generate: FORCE
@./generate.sh
.PHONY: FORCE
deps: FORCE
@go install github.com/pacedotdev/oto
.PHONY: FORCE