|
#### Makefile Script to kepler libs
|
|
export CGO_ENABLED=0
|
|
GOPATHSRC := $(GOPATH)/src
|
|
GOHOSTARCH:=$(shell go env GOHOSTARCH)
|
|
GOHOSTOS:=$(shell go env GOHOSTOS)
|
|
GOARCH ?= $(GOHOSTARCH)
|
|
GOOS ?= $(GOHOSTOS)
|
|
GO111MODULE ?= on
|
|
ifneq ($(GOOS)_$(GOARCH),$(GOHOSTOS)_$(GOHOSTARCH))
|
|
GOPATHBIN := $(GOPATH)/bin/$(GOOS)_$(GOARCH)
|
|
else
|
|
GOPATHBIN := $(GOPATH)/bin
|
|
endif
|
|
GOSRCS := $(shell find . -name "*.go")
|
|
.PHONY=version.go
|
|
|
|
VERSION=$(subst heads/,,$(shell git describe --all))
|
|
TAG=$(shell git rev-parse --short HEAD)
|
|
DATE=$(shell date)
|
|
MACHINE=$(shell uname -a)
|
|
|
|
LIBNAMES := auth cache config database filesystem handlers kv list logging mime misc msq pinyin requests restlet service
|
|
LIBOUT ?= $(GOPATH)/build
|
|
LIBS := $(LIBNAMES:%=$(LIBOUT)/pkg/cygnux.net/kepler/%.a)
|
|
help:
|
|
@echo "Kepler Demo Application"
|
|
|
|
all: $(GOPATHBIN)/kepler-demo1 $(GOPATHBIN)/kepler-demo2
|
|
|
|
clean:
|
|
@echo "Cleaning ..."
|
|
@rm -f $(GOPATHBIN)/kepler-demo1 version.go
|
|
@rm -f $(GOPATHBIN)/kepler-demo2 version.go
|
|
@rm -f $(LIBS)
|
|
@rm -rf $(LIBOUT)/src/cygnux.net/kepler
|
|
|
|
$(GOPATHBIN)/kepler-demo1: $(GOSRCS)
|
|
@echo "Building $@ ..."
|
|
@go build -o $@ -tags release cygnux.net/kepler/demo1
|
|
|
|
run-demo1: $(GOPATHBIN)/kepler-demo1
|
|
@echo "Starting demo1 serve ..."
|
|
@$(GOPATHBIN)/kepler-demo1 serve --debug --config demo1/config.yaml
|
|
|
|
init-demo1: $(GOPATHBIN)/kepler-demo1
|
|
@echo "Starting demo1 init ..."
|
|
@$(GOPATHBIN)/kepler-demo1 init --debug --config demo1/config.yaml
|
|
|
|
test-demo1: $(GOPATHBIN)/kepler-demo1
|
|
@echo "Starting demo1 test ..."
|
|
@$(GOPATHBIN)/kepler-demo1 test --debug --config demo1/config.yaml
|
|
|
|
|
|
$(GOPATHBIN)/kepler-demo2: $(GOSRCS)
|
|
@echo "Building $@ ..."
|
|
@go build -o $@ -tags release cygnux.net/kepler/demo2
|
|
|
|
run-demo2: $(GOPATHBIN)/kepler-demo2
|
|
@echo "Starting demo2 serve ..."
|
|
@$(GOPATHBIN)/kepler-demo2 serve --debug --config demo2/config.yaml
|
|
|
|
init-demo2: $(GOPATHBIN)/kepler-demo2
|
|
@echo "Starting demo2 init ..."
|
|
@$(GOPATHBIN)/kepler-demo2 init --debug --config demo2/config.yaml
|
|
|
|
test-demo2: $(GOPATHBIN)/kepler-demo2
|
|
@echo "Starting demo2 test ..."
|
|
@$(GOPATHBIN)/kepler-demo2 test --debug --config demo2/config.yaml
|
|
|
|
$(LIBOUT)/pkg/cygnux.net/kepler/%.a: %
|
|
@echo "Building $@ ..."
|
|
@go build -o $@ cygnux.net/kepler/$^
|
|
@mkdir -p $(LIBOUT)/src/cygnux.net/kepler/$^
|
|
@echo "//go:binary-only-package" > $(LIBOUT)/src/cygnux.net/kepler/$^/$^.go
|
|
@echo "" >> $(LIBOUT)/src/cygnux.net/kepler/$^/$^.go
|
|
@echo "package $^" >> $(LIBOUT)/src/cygnux.net/kepler/$^/$^.go
|
|
|
|
libs: $(LIBS)
|
|
@echo "Building libs ..."
|