Makefile 2.3 KB

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