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.

71 lines
1.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 = 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 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: windows_build darwin_build linux_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)