Makefile 863 B

12345678910111213141516171819202122232425262728293031323334
  1. service=bar
  2. at_osc=@osc
  3. os=linux
  4. arch=amd64
  5. dir_guard=@mkdir -p $(@D)
  6. party_host=xuj.local
  7. exec=/usr/local/bin/$(service)
  8. all: $(service) $(at_osc)
  9. $(service): $(wildcard **.go)
  10. go build .
  11. $(at_osc): $(wildcard at-osc/**.go)
  12. go build -o "$(at_osc)" ./at-osc
  13. run: $(service)
  14. ./$(service)
  15. put: build/$(service).$(os)_$(arch)
  16. # Move old binary out of the way and ask old instance to quit
  17. ssh $(party_host) [ -f $(exec) ] "&&" mv $(exec) $(exec).retired "||" /bin/true
  18. scp $^ $(party_host):$(exec)
  19. osc-utility message --host $(party_host) --port 9137 --address /bar/halt
  20. build/$(service).%: $(wildcard **.go)
  21. $(dir_guard)
  22. GOOS=$(word 1, $(subst _, ,$*)) GOARCH=$(word 2, $(subst _, ,$*)) go build -o $@ .
  23. build/@osc.%: $(wildcard at-osc/**.go)
  24. $(dir_guard)
  25. GOOS=$(word 1, $(subst _, ,$*)) GOARCH=$(word 2, $(subst _, ,$*)) go build -o $@ ./at-osc