plat ?= darwin plats = linux darwin arch ?= amd64 archs = amd64 arm arm64 all: stock define build_app @echo 'building $(1) ...' @GOOS=$(2) GOARCH=$(3) go build -o builder/$(1) ./cmd/$(1) @echo 'build $(1) done' endef stock: $(call build_app,stock,$(plat),$(arch)) .PHONY: stock clean: -@rm -f builder/* run: -@mkdir -p logs @nohup ./builder/stock >> logs/stock.log & @ps -ef | grep ./builder/stock | grep -v grep stop: -@pkill -2 stock -@ps -ef | grep ./builder/stock | grep -v grep ps: -@ps -ef | grep ./builder/stock | grep -v grep | wc -l -@ps -ef | grep ./builder/stock | grep -v grep push: -@scp builder/* root@119.29.105.154:/root/stock/builder/