Multi-target build

Try to customize the MakeFile in order to be able to build an binary for
any target system.
This commit is contained in:
Bertrand Moreau 2020-08-18 17:18:45 +02:00 committed by Zorglube
parent 932e0ed370
commit 2e32db2794
3 changed files with 15 additions and 5 deletions

2
.gitignore vendored
View File

@ -47,3 +47,5 @@ tags
# channel and emote list from twitch
subscribers.json
/.settings/
/.project

View File

@ -5,10 +5,13 @@
# 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.
ifeq ($(OS),Windows_NT)
ifeq ($(TARGET),windows)
EXT=.exe
endif
@ -21,7 +24,7 @@ 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)
GOOS=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS)
setdev:
$(eval export TAGS=-tags "dev")

View File

@ -37,13 +37,18 @@ set it to the version you installed (eg, `1.14.1`). The Makefile will now use
the newer version.
### Compile and install
To just download and run:
You have to :
- download ;
- choose your `TARGET` "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows"
;
- choose your `ARCH` "386 amd64 amd64p32 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32leppc s390 s390x sparc sparc64"
;
- and run ;
```bash
$ git clone https://github.com/zorchenhimer/MovieNight
$ cd MovieNight
$ make
$ make TARGET=windows ARCH=386
$ ./MovieNight
```