Explorar o código

Makefile for linux env

AY's Macbook Pro %!s(int64=3) %!d(string=hai) anos
pai
achega
32c2e7a9ea
Modificáronse 2 ficheiros con 59 adicións e 0 borrados
  1. 1 0
      .gitignore
  2. 58 0
      Makefile

+ 1 - 0
.gitignore

@@ -65,3 +65,4 @@ start.sh.backup
 *.backup
 system/bridge.json
 launcher.exe
+web.tar.gz

+ 58 - 0
Makefile

@@ -0,0 +1,58 @@
+PLATFORMS := darwin/amd64 darwin/arm64 freebsd/amd64 linux/386 linux/amd64 linux/arm linux/arm64 linux/mipsle windows/386 windows/amd64 windows/arm windows/arm64
+
+temp = $(subst /, ,$@)
+os = $(word 1, $(temp))
+arch = $(word 2, $(temp))
+
+all: $(PLATFORMS) web.tar.gz arozos_file_checksum.sha1
+
+binary: $(PLATFORMS)
+
+hash: arozos_file_checksum.sha1
+
+web: web.tar.gz
+
+clean: 
+	rm -rf arozos_*_*
+	rm -f web.tar.gz
+
+$(PLATFORMS):
+	@echo "Building $(os)/$(arch)"
+	GOROOT_FINAL=Git/ GOOS=$(os) GOARCH=$(arch) go build -o 'arozos_$(os)_$(arch)'  -ldflags "-s -w" -trimpath
+
+web.tar.gz:
+	-mkdir ./automake/
+	@echo "Removing old build resources, if exists"
+	-rm -rf ./automake/web/
+	-rm -rf ./automake/system/
+	-rm -rf ./automake/subservice/
+
+	@echo "Moving subfolders to build folder"
+	-cp -r ./web ./automake/web/
+	# cp -r ./subservice ./automake/subservice/
+	-cp -r ./system ./automake/system/
+
+	@ echo "Remove sensitive information"
+	-rm ./automake/system/dev.uuid
+	-rm ./automake/system/ao.db
+	-mv ./automake/system/storage.json ./automake/system/storage.json.example
+	-rm -rf ./automake/system/aecron/
+	-rm ./automake/system/cron.json
+	-rm ./automake/system/bridge.json
+	-rm ./automake/system/auth/authlog.db
+
+	@ echo "Remove modules that should not go into the build folder"
+	-rm -rf "./automake/web/Cyinput"
+	-rm -rf "./automake/web/Label Maker"
+	-rm -rf "./automake/web/Dummy"
+
+	@echo "Creating tarball for all required files"
+	-rm web.tar.gz
+	-cd ./automake/ && tar -czf ../web.tar.gz system/ web/
+
+	@echo "Clean up the autobuild directory"
+	rm -rf ./automake/
+
+arozos_file_checksum.sha1:
+	@echo "Generating the checksum, if sha1sum installed"
+	-sha1sum arozos_*_* web.tar.gz > arozos_file_checksum.sha1