Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 := darwin/amd64 darwin/arm64 linux/amd64 linux/386 linux/arm linux/arm64 linux/mipsle linux/riscv64 windows/amd64 windows/arm64
  3. temp = $(subst /, ,$@)
  4. os = $(word 1, $(temp))
  5. arch = $(word 2, $(temp))
  6. all: web.tar.gz $(PLATFORMS) fixwindows arozos_file_checksum.sha1
  7. binary: $(PLATFORMS)
  8. hash: arozos_file_checksum.sha1
  9. web: web.tar.gz
  10. clean:
  11. rm -f arozos_*_*
  12. rm -f web.tar.gz
  13. $(PLATFORMS):
  14. @echo "Building $(os)/$(arch)"
  15. GOROOT_FINAL=Git/ GOOS=$(os) GOARCH=$(arch) GOARM=6 go build -o './dist/arozos_$(os)_$(arch)' -ldflags "-s -w" -trimpath
  16. fixwindows:
  17. -mv ./dist/arozos_windows_amd64 ./dist/arozos_windows_amd64.exe
  18. -mv ./dist/arozos_windows_arm64 ./dist/arozos_windows_arm64.exe
  19. web.tar.gz:
  20. @echo "Removing old build resources, if exists"
  21. -rm -rf ./dist/
  22. -mkdir ./dist/
  23. @echo "Moving subfolders to build folder"
  24. -cp -r ./web ./dist/web/
  25. # cp -r ./subservice ./dist/subservice/
  26. -cp -r ./system ./dist/system/
  27. @ echo "Remove sensitive information"
  28. -rm ./dist/system/dev.uuid
  29. -rm ./dist/system/ao.db
  30. -rm ./dist/system/smtp_conf.json
  31. -rm ./dist/system/storage.json
  32. # -mv ./dist/system/storage.json ./dist/system/storage.json.example
  33. -rm -rf ./dist/system/aecron/
  34. -rm -rf ./dist/system/logs/
  35. -rm -rf ./dist/system/storage/
  36. -rm ./dist/system/cron.json
  37. -rm ./dist/system/bridge.json
  38. -rm ./dist/system/auth/authlog.db
  39. @ echo "Remove ip2country, todo: Add binary base searching for this function"
  40. -rm -rf "./dist/system/ip2country"
  41. @ echo "Remove modules that should not go into the build folder"
  42. -rm -rf "./dist/web/Cyinput"
  43. -rm -rf "./dist/web/Label Maker"
  44. -rm -rf "./dist/web/Dummy"
  45. @echo "Creating tarball for all required files"
  46. -rm ./dist/web.tar.gz
  47. -cd ./dist/ && tar -czf ./web.tar.gz system/ web/
  48. @echo "Clearing up unzipped folder structures"
  49. -rm -rf "./dist/web"
  50. -rm -rf "./dist/system"
  51. arozos_file_checksum.sha1:
  52. @echo "Generating the checksum, if sha1sum installed"
  53. -sha1sum ./dist/web.tar.gz > ./dist/arozos_file_checksum.sha1