Makefile 768 B

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