From e56d7d6fe119b3140c806c275b21c5f46345c214 Mon Sep 17 00:00:00 2001 From: Zorglube Date: Sun, 23 Aug 2020 18:03:45 +0200 Subject: [PATCH] Create MakeFile.BSD --- Makefile | 11 ++++------- Makefile.BSD | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 Makefile.BSD diff --git a/Makefile b/Makefile index 1ec3402..e7fa083 100644 --- a/Makefile +++ b/Makefile @@ -5,15 +5,12 @@ # For info on installing extra versions, see this page: # https://golang.org/doc/install#extra_versions -# 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" - TAGS= # Windows needs the .exe extension. -#.if ${TARGET} == "windows" -#EXT=.exe -#.endif +ifeq ($(OS),Windows_NT) +EXT=.exe +endif .PHONY: fmt vet get clean dev setdev test ServerMovieNight @@ -24,7 +21,7 @@ server: ServerMovieNight static/main.wasm # Bulid used for deploying to my server. ServerMovieNight: *.go common/*.go - GOOS=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS) + GOOS=linux GOARCH=386 go$(GO_VERSION) build -o MovieNight $(TAGS) setdev: $(eval export TAGS=-tags "dev") diff --git a/Makefile.BSD b/Makefile.BSD new file mode 100644 index 0000000..17f72d3 --- /dev/null +++ b/Makefile.BSD @@ -0,0 +1,54 @@ +# 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 + +# 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" + +TAGS= + +.PHONY: fmt vet get clean dev setdev test ServerMovieNight + +all: fmt vet test MovieNight 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=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS) + +setdev: + $(eval export TAGS=-tags "dev") + +dev: setdev all + +MovieNight: *.go common/*.go + GOOS=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o $@ $(TAGS) + +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 + GOOS=js GOARCH=wasm go$(GO_VERSION) build -o $@ $(TAGS) wasm/*.go + +clean: + -rm MovieNight ./static/main.wasm ./static/js/wasm_exec.js + +fmt: + gofmt -w . + +vet: + go$(GO_VERSION) vet $(TAGS) ./... + GOOS=js GOARCH=wasm go$(GO_VERSION) vet $(TAGS) ./... + +test: + go$(GO_VERSION) test $(TAGS) ./... + +# 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