1
0

Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # 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
  2. PLATFORMS := linux/amd64 linux/386 linux/arm linux/arm64 linux/mipsle linux/riscv64 windows/amd64
  3. temp = $(subst /, ,$@)
  4. os = $(word 1, $(temp))
  5. arch = $(word 2, $(temp))
  6. #all: web.tar.gz $(PLATFORMS) fixwindows zoraxy_file_checksum.sha1
  7. all: clear_old $(PLATFORMS) fixwindows
  8. binary: $(PLATFORMS)
  9. hash: zoraxy_file_checksum.sha1
  10. web: web.tar.gz
  11. clean:
  12. rm -f zoraxy_*_*
  13. rm -f web.tar.gz
  14. $(PLATFORMS):
  15. @echo "Building $(os)/$(arch)"
  16. GOROOT_FINAL=Git/ GOOS=$(os) GOARCH=$(arch) GOARM=6 go build -o './dist/zoraxy_$(os)_$(arch)' -ldflags "-s -w" -trimpath
  17. fixwindows:
  18. -mv ./dist/zoraxy_windows_amd64 ./dist/zoraxy_windows_amd64.exe
  19. # -mv ./dist/zoraxy_windows_arm64 ./dist/zoraxy_windows_arm64.exe
  20. clear_old:
  21. -rm -rf ./dist/
  22. -mkdir ./dist/
  23. web.tar.gz:
  24. @echo "Removing old build resources, if exists"
  25. -rm -rf ./dist/
  26. -mkdir ./dist/
  27. @echo "Moving subfolders to build folder"
  28. -cp -r ./web ./dist/web/
  29. -cp -r ./system ./dist/system/
  30. @ echo "Remove sensitive information"
  31. -rm -rf ./dist/certs/
  32. -rm -rf ./dist/conf/
  33. -rm -rf ./dist/rules/
  34. @echo "Creating tarball for all required files"
  35. -rm ./dist/web.tar.gz
  36. -cd ./dist/ && tar -czf ./web.tar.gz system/ web/
  37. @echo "Clearing up unzipped folder structures"
  38. -rm -rf "./dist/web"
  39. -rm -rf "./dist/system"
  40. zoraxy_file_checksum.sha1:
  41. @echo "Generating the checksum, if sha1sum installed"
  42. -sha1sum ./dist/web.tar.gz > ./dist/zoraxy_file_checksum.sha1