You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.7 KiB

9 years ago
9 years ago
  1. BINARY = weed/weed
  2. package = github.com/chrislusf/seaweedfs/weed
  3. GO_FLAGS = #-v
  4. SOURCE_DIR = ./weed/
  5. appname := weed
  6. sources := $(wildcard *.go)
  7. build = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -ldflags "-extldflags -static" -o build/$(appname)$(3) $(SOURCE_DIR)
  8. tar = cd build && tar -cvzf $(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3)
  9. zip = cd build && zip $(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3)
  10. build_large = CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -tags 5BytesOffset -ldflags "-extldflags -static" -o build/$(appname)$(3) $(SOURCE_DIR)
  11. tar_large = cd build && tar -cvzf $(1)_$(2)_large_disk.tar.gz $(appname)$(3) && rm $(appname)$(3)
  12. zip_large = cd build && zip $(1)_$(2)_large_disk.zip $(appname)$(3) && rm $(appname)$(3)
  13. all: build
  14. .PHONY : clean deps build linux release windows_build darwin_build linux_build bsd_build clean
  15. clean:
  16. go clean -i $(GO_FLAGS) $(SOURCE_DIR)
  17. rm -f $(BINARY)
  18. rm -rf build/
  19. deps:
  20. go get $(GO_FLAGS) -d $(SOURCE_DIR)
  21. rm -rf /home/travis/gopath/src/github.com/coreos/etcd/vendor/golang.org/x/net/trace
  22. rm -rf /home/travis/gopath/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
  23. build: deps
  24. go build $(GO_FLAGS) -o $(BINARY) $(SOURCE_DIR)
  25. linux: deps
  26. mkdir -p linux
  27. GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o linux/$(BINARY) $(SOURCE_DIR)
  28. release: deps windows_build darwin_build linux_build bsd_build 5_byte_linux_build 5_byte_darwin_build 5_byte_windows_build
  29. ##### LINUX BUILDS #####
  30. 5_byte_linux_build:
  31. $(call build_large,linux,amd64,)
  32. $(call tar_large,linux,amd64)
  33. 5_byte_darwin_build:
  34. $(call build_large,darwin,amd64,)
  35. $(call tar_large,darwin,amd64)
  36. 5_byte_windows_build:
  37. $(call build_large,windows,amd64,.exe)
  38. $(call zip_large,windows,amd64,.exe)
  39. linux_build: build/linux_arm.tar.gz build/linux_arm64.tar.gz build/linux_386.tar.gz build/linux_amd64.tar.gz
  40. build/linux_386.tar.gz: $(sources)
  41. $(call build,linux,386,)
  42. $(call tar,linux,386)
  43. build/linux_amd64.tar.gz: $(sources)
  44. $(call build,linux,amd64,)
  45. $(call tar,linux,amd64)
  46. build/linux_arm.tar.gz: $(sources)
  47. $(call build,linux,arm,)
  48. $(call tar,linux,arm)
  49. build/linux_arm64.tar.gz: $(sources)
  50. $(call build,linux,arm64,)
  51. $(call tar,linux,arm64)
  52. ##### DARWIN (MAC) BUILDS #####
  53. darwin_build: build/darwin_amd64.tar.gz
  54. build/darwin_amd64.tar.gz: $(sources)
  55. $(call build,darwin,amd64,)
  56. $(call tar,darwin,amd64)
  57. ##### WINDOWS BUILDS #####
  58. windows_build: build/windows_386.zip build/windows_amd64.zip
  59. build/windows_386.zip: $(sources)
  60. $(call build,windows,386,.exe)
  61. $(call zip,windows,386,.exe)
  62. build/windows_amd64.zip: $(sources)
  63. $(call build,windows,amd64,.exe)
  64. $(call zip,windows,amd64,.exe)
  65. ##### BSD BUILDS #####
  66. bsd_build: build/freebsd_arm.tar.gz build/freebsd_386.tar.gz build/freebsd_amd64.tar.gz \
  67. build/netbsd_arm.tar.gz build/netbsd_386.tar.gz build/netbsd_amd64.tar.gz \
  68. build/openbsd_arm.tar.gz build/openbsd_386.tar.gz build/openbsd_amd64.tar.gz
  69. build/freebsd_386.tar.gz: $(sources)
  70. $(call build,freebsd,386,)
  71. $(call tar,freebsd,386)
  72. build/freebsd_amd64.tar.gz: $(sources)
  73. $(call build,freebsd,amd64,)
  74. $(call tar,freebsd,amd64)
  75. build/freebsd_arm.tar.gz: $(sources)
  76. $(call build,freebsd,arm,)
  77. $(call tar,freebsd,arm)
  78. build/netbsd_386.tar.gz: $(sources)
  79. $(call build,netbsd,386,)
  80. $(call tar,netbsd,386)
  81. build/netbsd_amd64.tar.gz: $(sources)
  82. $(call build,netbsd,amd64,)
  83. $(call tar,netbsd,amd64)
  84. build/netbsd_arm.tar.gz: $(sources)
  85. $(call build,netbsd,arm,)
  86. $(call tar,netbsd,arm)
  87. build/openbsd_386.tar.gz: $(sources)
  88. $(call build,openbsd,386,)
  89. $(call tar,openbsd,386)
  90. build/openbsd_amd64.tar.gz: $(sources)
  91. $(call build,openbsd,amd64,)
  92. $(call tar,openbsd,amd64)
  93. build/openbsd_arm.tar.gz: $(sources)
  94. $(call build,openbsd,arm,)
  95. $(call tar,openbsd,arm)