Commit f47f4eec authored by Tzu-Jung Lee's avatar Tzu-Jung Lee
Browse files

examples: modify Makefile for the ease of development iterations

parent a03eed52
# PROGS ?= $(notdir $(shell go list ./...))
PROGS ?= $(filter-out bin Makefile,$(shell ls))
BUILD_CMD ?= GOGC=off GOOS=linux go build $(LDFLAGS) -i -o bin/$@ $@/*.go
DEPLOY_CMD ?= scp bin/$< gentoo:/tmp
RUN_CMD ?= ssh -t gentoo sudo LOGXI=${LOGXI} /tmp/$<
Q ?= @
......@@ -15,20 +19,11 @@ LDFLAGS ?= -ldflags="-w -X $(BUILDDATESYM)=$(BUILDDATE) -X $(GITSYM)=$(GITHEAD)
all: $(PROGS)
$(Q) echo $(PROGS)
$(Q) mkdir -p bin
run-%: bin/%
$(Q) echo Running prebuilt bin/$@ ...
sudo LOGXI=${LOGXI} $<
$(Q) echo Building bin/$@ ...
$(Q) GOGC=off GOOS=linux go build $(LDFLAGS) -o bin/$@ $@/*.go
sudo LOGXI=${LOGXI} bin/$@
run-%: %
$(Q) $(RUN_CMD)
$(Q) rm -rf bin
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment