2022-03-01 19:45:09 +00:00
|
|
|
PKG := git.blender.org/flamenco
|
2022-01-03 14:05:10 +00:00
|
|
|
VERSION := $(shell git describe --tags --dirty --always)
|
|
|
|
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
|
|
|
|
|
2022-01-06 16:46:43 +00:00
|
|
|
LDFLAGS := -X ${PKG}/internal/appinfo.ApplicationVersion=${VERSION}
|
2022-01-03 14:05:10 +00:00
|
|
|
BUILD_FLAGS = -ldflags="${LDFLAGS}"
|
|
|
|
|
2022-02-28 12:01:13 +00:00
|
|
|
# Prevent any dependency that requires a C compiler, i.e. only work with pure-Go libraries.
|
2022-02-24 10:37:02 +00:00
|
|
|
export CGO_ENABLED=0
|
|
|
|
|
2022-01-03 14:05:10 +00:00
|
|
|
all: application
|
|
|
|
|
2022-01-24 13:27:25 +00:00
|
|
|
# Install generators and build the software.
|
|
|
|
with-deps:
|
2022-02-18 16:54:43 +00:00
|
|
|
go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.9.0
|
|
|
|
go get github.com/golang/mock/mockgen@v1.6.0
|
2022-02-25 15:08:08 +00:00
|
|
|
$(MAKE) application
|
2022-01-24 13:27:25 +00:00
|
|
|
|
2022-03-03 10:50:03 +00:00
|
|
|
application: generate flamenco-manager flamenco-worker socketio-poc
|
2022-02-17 10:11:42 +00:00
|
|
|
|
2022-02-28 12:01:13 +00:00
|
|
|
flamenco-manager:
|
|
|
|
go build -v ${BUILD_FLAGS} ${PKG}/cmd/flamenco-manager
|
2022-02-17 10:11:42 +00:00
|
|
|
|
2022-02-28 12:01:13 +00:00
|
|
|
flamenco-worker:
|
|
|
|
go build -v ${BUILD_FLAGS} ${PKG}/cmd/flamenco-worker
|
2022-02-17 10:11:42 +00:00
|
|
|
|
|
|
|
socketio-poc:
|
2022-02-11 13:47:26 +00:00
|
|
|
go build -v ${BUILD_FLAGS} ${PKG}/cmd/socketio-poc
|
2022-01-03 14:05:10 +00:00
|
|
|
|
2022-01-28 14:31:39 +00:00
|
|
|
generate:
|
2022-02-25 15:08:08 +00:00
|
|
|
go generate ./pkg/api/...
|
2022-02-24 10:35:54 +00:00
|
|
|
go generate ./internal/...
|
2022-03-03 10:49:26 +00:00
|
|
|
# The generators always produce UNIX line-ends. This creates false file
|
|
|
|
# modifications with Git. Convert them to DOS line-ends to avoid this.
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
git status --porcelain | grep '^ M .*.gen.go' | cut -d' ' -f3 | xargs unix2dos --keepdate
|
|
|
|
endif
|
2022-01-28 14:31:39 +00:00
|
|
|
|
2022-01-03 14:05:10 +00:00
|
|
|
version:
|
|
|
|
@echo "OS : ${OS}"
|
|
|
|
@echo "Package: ${PKG}"
|
|
|
|
@echo "Version: ${VERSION}"
|
2022-02-24 10:35:54 +00:00
|
|
|
@echo
|
|
|
|
@env | grep GO
|
2022-01-03 14:05:10 +00:00
|
|
|
|
2022-01-06 16:46:43 +00:00
|
|
|
list-embedded:
|
|
|
|
@go list -f '{{printf "%10s" .Name}}: {{.EmbedFiles}}' ${PKG}/...
|
|
|
|
|
|
|
|
swagger-ui:
|
|
|
|
git clone --depth 1 https://github.com/swagger-api/swagger-ui.git tmp-swagger-ui
|
|
|
|
rm -rf pkg/api/static/swagger-ui
|
|
|
|
mv tmp-swagger-ui/dist pkg/api/static/swagger-ui
|
|
|
|
rm -rf tmp-swagger-ui
|
|
|
|
@echo
|
|
|
|
@echo 'Now update pkg/api/static/swagger-ui/index.html to have url: "/api/openapi3.json",'
|
2022-01-03 15:54:38 +00:00
|
|
|
|
2022-02-19 13:39:43 +00:00
|
|
|
test:
|
2022-02-01 16:16:16 +00:00
|
|
|
go test -p 1 -short ${PKG_LIST}
|
2022-01-03 14:05:10 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@go clean -i -x
|
2022-02-28 12:01:13 +00:00
|
|
|
rm -f flamenco*-v* flamenco-manager flamenco-worker socketio-poc *.exe
|
2022-02-25 15:08:08 +00:00
|
|
|
rm -f pkg/api/*.gen.go internal/*/mocks/*.gen.go internal/*/*/mocks/*.gen.go
|
2022-02-24 10:35:54 +00:00
|
|
|
@$(MAKE) generate
|
2022-01-03 14:05:10 +00:00
|
|
|
|
2022-03-03 10:50:03 +00:00
|
|
|
.PHONY: application version flamenco-manager flamenco-worker socketio-poc generate with-deps swagger-ui list-embedded test clean
|