2020-01-30 20:46:54 +01:00
|
|
|
# If a different version of Go is installed (via `go get`) set the GO_VERSION
|
|
|
|
# environment variable to that version. For example, setting it to "1.13.7"
|
|
|
|
# will run `go1.13.7 build [...]` instead of `go build [...]`.
|
|
|
|
#
|
|
|
|
# For info on installing extra versions, see this page:
|
|
|
|
# https://golang.org/doc/install#extra_versions
|
|
|
|
|
2020-08-18 17:18:45 +02:00
|
|
|
# goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows"
|
|
|
|
# goarchList = "386 amd64 amd64p32 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32leppc s390 s390x sparc sparc64"
|
|
|
|
|
2019-03-24 23:51:39 +01:00
|
|
|
TAGS=
|
|
|
|
|
2020-01-30 20:46:54 +01:00
|
|
|
# Windows needs the .exe extension.
|
2020-08-18 17:18:45 +02:00
|
|
|
ifeq ($(TARGET),windows)
|
2020-01-30 20:46:54 +01:00
|
|
|
EXT=.exe
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: fmt vet get clean dev setdev test ServerMovieNight
|
|
|
|
|
|
|
|
all: fmt vet test MovieNight$(EXT) static/main.wasm settings.json
|
2019-03-10 16:42:12 +01:00
|
|
|
|
2020-01-30 20:46:54 +01:00
|
|
|
# Build the server deployment
|
|
|
|
server: ServerMovieNight static/main.wasm
|
|
|
|
|
|
|
|
# Bulid used for deploying to my server.
|
|
|
|
ServerMovieNight: *.go common/*.go
|
2020-08-18 17:18:45 +02:00
|
|
|
GOOS=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS)
|
2019-03-10 16:42:12 +01:00
|
|
|
|
2019-03-24 23:51:39 +01:00
|
|
|
setdev:
|
|
|
|
$(eval export TAGS=-tags "dev")
|
|
|
|
|
|
|
|
dev: setdev all
|
|
|
|
|
2020-01-30 20:46:54 +01:00
|
|
|
MovieNight$(EXT): *.go common/*.go
|
|
|
|
go$(GO_VERSION) build -o $@ $(TAGS)
|
2019-10-01 23:35:08 +02:00
|
|
|
|
2020-03-30 01:48:37 +02:00
|
|
|
static/js/wasm_exec.js:
|
|
|
|
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js $@
|
|
|
|
|
|
|
|
static/main.wasm: static/js/wasm_exec.js wasm/*.go common/*.go
|
2020-01-30 20:46:54 +01:00
|
|
|
GOOS=js GOARCH=wasm go$(GO_VERSION) build -o $@ $(TAGS) wasm/*.go
|
2019-03-12 04:15:42 +01:00
|
|
|
|
2019-03-10 16:42:12 +01:00
|
|
|
clean:
|
2020-03-30 01:48:37 +02:00
|
|
|
-rm MovieNight$(EXT) ./static/main.wasm ./static/js/wasm_exec.js
|
2019-03-10 16:42:12 +01:00
|
|
|
|
|
|
|
fmt:
|
2019-06-19 00:46:35 +02:00
|
|
|
gofmt -w .
|
2019-03-10 16:42:12 +01:00
|
|
|
|
|
|
|
vet:
|
2020-01-30 20:46:54 +01:00
|
|
|
go$(GO_VERSION) vet $(TAGS) ./...
|
|
|
|
GOOS=js GOARCH=wasm go$(GO_VERSION) vet $(TAGS) ./...
|
2019-03-25 04:43:30 +01:00
|
|
|
|
|
|
|
test:
|
2020-01-30 20:46:54 +01:00
|
|
|
go$(GO_VERSION) test $(TAGS) ./...
|
2019-04-04 17:19:57 +02:00
|
|
|
|
|
|
|
# Do not put settings_example.json here as a prereq to avoid overwriting
|
|
|
|
# the settings if the example is updated.
|
|
|
|
settings.json:
|
|
|
|
cp settings_example.json settings.json
|