github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/cmd/srv-applet-mgr/Makefile (about)

     1  .DEFAULT_GOAL := target
     2  
     3  VERSION=$(shell git describe --tags --always)
     4  FEATURE=$(shell git branch | grep '*' | awk '{ print $$2; }')
     5  BUILD_TIME=$(shell date +%Y%m%d%H%M%S)
     6  VERSION_PATH=github.com/machinefi/w3bstream/cmd/srv-applet-mgr/types
     7  BUILD_ROOT=../../build/srv-applet-mgr
     8  REPO_ROOT=../..
     9  
    10  .PHONY: debug
    11  debug:
    12  	@echo ${FEATURE}
    13  	@echo ${VERSION}
    14  	@echo ${BUILD_TIME}
    15  	@echo ${BUILD_ROOT}
    16  
    17  .PHONY: toolkit
    18  toolkit:
    19  	@go install github.com/machinefi/w3bstream/pkg/depends/gen/cmd/...@toolkit-patch-0.0.3
    20  	@echo installed `which toolkit`
    21  
    22  .PHONY: openapi
    23  openapi: toolkit
    24  	@go generate .
    25  
    26  .PHONY: build
    27  build: clean
    28  	@go build -ldflags "-X ${VERSION_PATH}.Name=srv-applet-mgr\
    29   -X ${VERSION_PATH}.Feature=${FEATURE}\
    30   -X ${VERSION_PATH}.Version=${VERSION}\
    31   -X ${VERSION_PATH}.Timestamp=${BUILD_TIME}"
    32  	@mkdir -p ${BUILD_ROOT}
    33  	@mv srv-applet-mgr  ${BUILD_ROOT}/srv-applet-mgr
    34  	@cp -r openapi.json ${BUILD_ROOT}/openapi.json
    35  
    36  .PHONY: target
    37  target: build
    38  
    39  .PHONY: run
    40  run: build
    41  	@cd ${BUILD_ROOT} && ./srv-applet-mgr
    42  
    43  .PHONY: clean
    44  clean:
    45  	@rm -rf ${BUILD_ROOT}/srv-applet-mgr
    46  	@rm -rf ${BUILD_ROOT}/openapi.json
    47  
    48  .PHONY: image
    49  image:
    50  	@cd ${REPO_ROOT} && docker build -f cmd/srv-applet-mgr/Dockerfile . -t $(USER)/w3bstream:${VERSION}