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.

147 lines
4.3 KiB

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