You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
844 B
37 lines
844 B
PACKAGE = gitlab.weird-web-workers.org/golang/test
|
|
|
|
SOURCES = version.go \
|
|
server.go \
|
|
signal.go
|
|
|
|
VERSION = 0.0.1
|
|
REVISION = $(shell git rev-parse HEAD)
|
|
BUILDTIME= "$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
|
|
|
GOOS = $(shell go env GOOS)
|
|
GOARCH = $(shell go env GOARCH)
|
|
|
|
LIBRARY = $(GOPATH)/pkg/$(GOOS)_$(GOARCH)/$(PACKAGE).a
|
|
|
|
.PHONY: all clean .version
|
|
|
|
all: $(LIBRARY)
|
|
|
|
$(LIBRARY): $(SOURCES)
|
|
go install $(PACKAGE)
|
|
|
|
.version:
|
|
-@printf "%s\n%s\n%s" "$(VERSION)" "$(REVISION)" >$@.new
|
|
-@diff $@ $@.new >/dev/null 2>&1 && rm $@.new || mv $@.new $@
|
|
|
|
version.go: version.go.m4 .version
|
|
-@m4 -Dm4_version=$(VERSION) \
|
|
-Dm4_revision=$(REVISION) \
|
|
-Dm4_build_time=$(BUILDTIME) \
|
|
-Dm4_package=$(PACKAGE) \
|
|
$< >$@
|
|
|
|
clean:
|
|
-@rm -f version.go 2>/dev/null
|
|
-@rm -f .version 2>/dev/null
|
|
-@rm -f $(LIBRARY) 2>/dev/null
|