Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. NAME=gost
  2. BINDIR=bin
  3. VERSION=$(shell cat cmd/gost/version.go | grep 'version =' | sed 's/.*\"\(.*\)\".*/\1/g')
  4. GOBUILD=CGO_ENABLED=0 go build --ldflags="-s -w" -v -x -a
  5. GOFILES=cmd/gost/*.go
  6. PLATFORM_LIST = \
  7. darwin-amd64 \
  8. darwin-arm64 \
  9. linux-386 \
  10. linux-amd64 \
  11. linux-amd64v3 \
  12. linux-armv5 \
  13. linux-armv6 \
  14. linux-armv7 \
  15. linux-armv8 \
  16. linux-mips-softfloat \
  17. linux-mips-hardfloat \
  18. linux-mipsle-softfloat \
  19. linux-mipsle-hardfloat \
  20. linux-mips64 \
  21. linux-mips64le \
  22. linux-s390x \
  23. linux-riscv64 \
  24. freebsd-386 \
  25. freebsd-amd64
  26. WINDOWS_ARCH_LIST = \
  27. windows-386 \
  28. windows-amd64 \
  29. windows-amd64v3 \
  30. windows-arm64
  31. all: linux-amd64 darwin-amd64 darwin-arm64 windows-amd64 # Most used
  32. darwin-amd64:
  33. GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  34. darwin-arm64:
  35. GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  36. linux-386:
  37. GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  38. linux-amd64:
  39. GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  40. linux-amd64v3:
  41. GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  42. linux-armv5:
  43. GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  44. linux-armv6:
  45. GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  46. linux-armv7:
  47. GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  48. linux-armv8:
  49. GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  50. linux-mips-softfloat:
  51. GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  52. linux-mips-hardfloat:
  53. GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  54. linux-mipsle-softfloat:
  55. GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  56. linux-mipsle-hardfloat:
  57. GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  58. linux-mips64:
  59. GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  60. linux-mips64le:
  61. GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  62. linux-s390x:
  63. GOARCH=s390x GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  64. linux-riscv64:
  65. GOARCH=riscv64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  66. freebsd-386:
  67. GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  68. freebsd-amd64:
  69. GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
  70. windows-386:
  71. GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe $(GOFILES)
  72. windows-amd64:
  73. GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe $(GOFILES)
  74. windows-amd64v3:
  75. GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe $(GOFILES)
  76. windows-arm64:
  77. GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe $(GOFILES)
  78. gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
  79. zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
  80. $(gz_releases): %.gz : %
  81. chmod +x $(BINDIR)/$(NAME)-$(basename $@)
  82. gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)
  83. $(zip_releases): %.zip : %
  84. zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe
  85. all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST)
  86. releases: $(gz_releases) $(zip_releases)
  87. clean:
  88. rm $(BINDIR)/*