Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 = GOOS=$(1) GOARCH=$(2) go build -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. all: build
  11. .PHONY : clean deps build linux release windows_build darwin_build linux_build bsd_build clean
  12. clean:
  13. go clean -i $(GO_FLAGS) $(SOURCE_DIR)
  14. rm -f $(BINARY)
  15. rm -rf build/
  16. deps:
  17. go get $(GO_FLAGS) -d $(SOURCE_DIR)
  18. build: deps
  19. go build $(GO_FLAGS) -o $(BINARY) $(SOURCE_DIR)
  20. linux: deps
  21. mkdir -p linux
  22. GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o linux/$(BINARY) $(SOURCE_DIR)
  23. release: deps windows_build darwin_build linux_build bsd_build
  24. ##### LINUX BUILDS #####
  25. linux_build: build/linux_arm.tar.gz build/linux_arm64.tar.gz build/linux_386.tar.gz build/linux_amd64.tar.gz
  26. build/linux_386.tar.gz: $(sources)
  27. $(call build,linux,386,)
  28. $(call tar,linux,386)
  29. build/linux_amd64.tar.gz: $(sources)
  30. $(call build,linux,amd64,)
  31. $(call tar,linux,amd64)
  32. build/linux_arm.tar.gz: $(sources)
  33. $(call build,linux,arm,)
  34. $(call tar,linux,arm)
  35. build/linux_arm64.tar.gz: $(sources)
  36. $(call build,linux,arm64,)
  37. $(call tar,linux,arm64)
  38. ##### DARWIN (MAC) BUILDS #####
  39. darwin_build: build/darwin_amd64.tar.gz
  40. build/darwin_amd64.tar.gz: $(sources)
  41. $(call build,darwin,amd64,)
  42. $(call tar,darwin,amd64)
  43. ##### WINDOWS BUILDS #####
  44. windows_build: build/windows_386.zip build/windows_amd64.zip
  45. build/windows_386.zip: $(sources)
  46. $(call build,windows,386,.exe)
  47. $(call zip,windows,386,.exe)
  48. build/windows_amd64.zip: $(sources)
  49. $(call build,windows,amd64,.exe)
  50. $(call zip,windows,amd64,.exe)
  51. ##### BSD BUILDS #####
  52. bsd_build: build/freebsd_arm.tar.gz build/freebsd_386.tar.gz build/freebsd_amd64.tar.gz \
  53. build/netbsd_arm.tar.gz build/netbsd_386.tar.gz build/netbsd_amd64.tar.gz \
  54. build/openbsd_arm.tar.gz build/openbsd_386.tar.gz build/openbsd_amd64.tar.gz
  55. build/freebsd_386.tar.gz: $(sources)
  56. $(call build,freebsd,386,)
  57. $(call tar,freebsd,386)
  58. build/freebsd_amd64.tar.gz: $(sources)
  59. $(call build,freebsd,amd64,)
  60. $(call tar,freebsd,amd64)
  61. build/freebsd_arm.tar.gz: $(sources)
  62. $(call build,freebsd,arm,)
  63. $(call tar,freebsd,arm)
  64. build/netbsd_386.tar.gz: $(sources)
  65. $(call build,netbsd,386,)
  66. $(call tar,netbsd,386)
  67. build/netbsd_amd64.tar.gz: $(sources)
  68. $(call build,netbsd,amd64,)
  69. $(call tar,netbsd,amd64)
  70. build/netbsd_arm.tar.gz: $(sources)
  71. $(call build,netbsd,arm,)
  72. $(call tar,netbsd,arm)
  73. build/openbsd_386.tar.gz: $(sources)
  74. $(call build,openbsd,386,)
  75. $(call tar,openbsd,386)
  76. build/openbsd_amd64.tar.gz: $(sources)
  77. $(call build,openbsd,amd64,)
  78. $(call tar,openbsd,amd64)
  79. build/openbsd_arm.tar.gz: $(sources)
  80. $(call build,openbsd,arm,)
  81. $(call tar,openbsd,arm)