Clean up Makefile
Removed the Darwin and Windows specific build targets. Instead, the system's build target will be used (as specified with the GOOS and GOARCH environment variables). Added a "server" build target. This is mostly just for me to build the binary that will be deployed on my own server. Added the GO_VERSION environment variable to all the calls to the go command. This will allow easier building on systems that have installed an additional version of Go along side their distribution's version. Users wanting to build with one of these versions must first install it with `go get` and `go[version] download` as detailed here: https://golang.org/doc/install#extra_versions. Setting the GO_VERSION environment variable to the version number will use that version. Eg, setting it to "1.13.7" will call `go1.13.7 build [...]` instead of `go build [...]`.
This commit is contained in:
parent
c32838def6
commit
72a44b6170
43
Makefile
43
Makefile
@ -1,38 +1,51 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
TAGS=
|
TAGS=
|
||||||
|
|
||||||
.PHONY: fmt vet get clean dev setdev test
|
# Windows needs the .exe extension.
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
EXT=.exe
|
||||||
|
endif
|
||||||
|
|
||||||
all: fmt vet test MovieNight MovieNight.exe MovieNightDarwin static/main.wasm settings.json
|
.PHONY: fmt vet get clean dev setdev test ServerMovieNight
|
||||||
|
|
||||||
|
all: fmt vet test MovieNight$(EXT) static/main.wasm settings.json
|
||||||
|
|
||||||
|
# Build the server deployment
|
||||||
|
server: ServerMovieNight static/main.wasm
|
||||||
|
|
||||||
|
# Bulid used for deploying to my server.
|
||||||
|
ServerMovieNight: *.go common/*.go
|
||||||
|
GOOS=linux GOARCH=386 go$(GO_VERSION) build -o MovieNight $(TAGS)
|
||||||
|
|
||||||
setdev:
|
setdev:
|
||||||
$(eval export TAGS=-tags "dev")
|
$(eval export TAGS=-tags "dev")
|
||||||
|
|
||||||
dev: setdev all
|
dev: setdev all
|
||||||
|
|
||||||
MovieNight.exe: *.go common/*.go
|
MovieNight$(EXT): *.go common/*.go
|
||||||
GOOS=windows GOARCH=amd64 go build -o MovieNight.exe $(TAGS)
|
go$(GO_VERSION) build -o $@ $(TAGS)
|
||||||
|
|
||||||
MovieNight: *.go common/*.go
|
|
||||||
GOOS=linux GOARCH=386 go build -o MovieNight $(TAGS)
|
|
||||||
|
|
||||||
MovieNightDarwin: *.go common/*.go
|
|
||||||
GOOS=darwin GOARCH=amd64 go build -o MovieNightDarwin $(TAGS)
|
|
||||||
|
|
||||||
static/main.wasm: wasm/*.go common/*.go
|
static/main.wasm: wasm/*.go common/*.go
|
||||||
GOOS=js GOARCH=wasm go build -o ./static/main.wasm $(TAGS) wasm/*.go
|
GOOS=js GOARCH=wasm go$(GO_VERSION) build -o $@ $(TAGS) wasm/*.go
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm MovieNight.exe MovieNight MovieNightDarwin ./static/main.wasm
|
-rm MovieNight$(EXT) ./static/main.wasm
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
gofmt -w .
|
gofmt -w .
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
go vet $(TAGS) ./...
|
go$(GO_VERSION) vet $(TAGS) ./...
|
||||||
GOOS=js GOARCH=wasm go vet $(TAGS) ./...
|
GOOS=js GOARCH=wasm go$(GO_VERSION) vet $(TAGS) ./...
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test $(TAGS) ./...
|
go$(GO_VERSION) test $(TAGS) ./...
|
||||||
|
|
||||||
# Do not put settings_example.json here as a prereq to avoid overwriting
|
# Do not put settings_example.json here as a prereq to avoid overwriting
|
||||||
# the settings if the example is updated.
|
# the settings if the example is updated.
|
||||||
|
Loading…
Reference in New Issue
Block a user