update makefile

This commit is contained in:
Jason
2019-08-14 11:37:01 +08:00
parent 72bdc12e73
commit 987e3023e6

View File

@@ -4,15 +4,15 @@ CMDDIR=$(shell pwd)/cmd
VERSION=$(shell git describe --tags --long || echo "unknown version")
BUILD_TAGS='fakeDNS stats'
BUILD_LDFLAGS='-s -w -X "main.version=$(VERSION)"'
GOBUILD=go build -ldflags $(BUILD_LDFLAGS) -v -tags $(BUILD_TAGS)
DEBUG_BUILD_LDFLAGS='-s -w -X "main.version=$(VERSION)-debug"'
all: build
build:
cd $(CMDDIR) && $(GOBUILD) -o $(BUILDDIR)/$(NAME)
cd $(CMDDIR) && go build -ldflags $(BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -o $(BUILDDIR)/$(NAME)
debug:
cd $(CMDDIR) && $(GOBUILD) -race -o $(BUILDDIR)/$(NAME)
cd $(CMDDIR) && go build -ldflags $(DEBUG_BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -race -o $(BUILDDIR)/$(NAME)
clean:
rm -rf $(BUILDDIR)