From 2e32db2794bec49436141f6addbe507a04244513 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau Date: Tue, 18 Aug 2020 17:18:45 +0200 Subject: [PATCH] Multi-target build Try to customize the MakeFile in order to be able to build an binary for any target system. --- .gitignore | 2 ++ Makefile | 7 +++++-- readme.md | 11 ++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d996f8d..7e1383f 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ tags # channel and emote list from twitch subscribers.json +/.settings/ +/.project diff --git a/Makefile b/Makefile index e7fa083..f693306 100644 --- a/Makefile +++ b/Makefile @@ -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") diff --git a/readme.md b/readme.md index 9e8506a..fae361e 100644 --- a/readme.md +++ b/readme.md @@ -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 ```