15d04b06101cd63656845717d7cbc703b3a6f553
[demo.git] / vnfs / DAaaS / microservices / remote-config-operator / Makefile
1 PDX-license-identifier: Apache-2.0
2 ##############################################################################
3 # Copyright (c) 2019 Intel Corporation
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 # Common
11 VERSION := $(shell git describe --tags)
12 BUILD := $(shell git rev-parse --short HEAD)
13 PROJECTNAME := $(shell basename "$(pwd)")
14
15 ROOTPATH := $(shell realpath "$(PWD)/../../../../../../")
16 PromOP := ${PWD}/build/_output/bin/remote-config-operator
17 PromOP_LOCAL := ${PromOP}-local
18 IMAGE_NAME := dcr.cluster.local:32644/remote-config-operator:latest
19
20 export GO111MODULE=on
21
22 .PHONY: clean publish
23
24 ## build: Generate the k8s and openapi artifacts using operator-sdk
25 build: clean
26                 GOOS=linux GOARCH=amd64
27                 operator-sdk generate k8s --verbose
28                 operator-sdk generate openapi --verbose
29                 @operator-sdk build ${IMAGE_NAME} --verbose
30                 @go build -o ${PromOP_LOCAL} remote-config-operator/cmd/manager
31
32 ## clean: clean build artifacts, image, binary
33 clean:
34                 @echo "Deleting the remote-config-operator binary"
35                 @rm -rf ${PromOP}
36                 @rm -rf ${PromOP_LOCAL}
37                 @if docker images $(IMAGE_NAME) | awk '{ print $$2 }' | grep -q -F latest; then echo "Deleting the remote-config-operator docker image";  docker rmi ${IMAGE_NAME}; fi
38
39 ## publish: Push docker image to registry
40 publish:
41         @docker push ${IMAGE_NAME}
42
43 ## format: format source code
44 format:
45                 @go fmt ./...
46
47 .PHONY: help
48 ## help: Print help message
49 help: Makefile
50         @echo
51         @echo " Requires Operator SDK v0.11.0+, go1.13.1+"
52         @echo
53         @echo " Choose a command run in "$(PROJECTNAME)":"
54         @echo
55         @sed -n 's/^## //p' $< | column -t -s ':' |  sed -e 's/^/ /'
56         @echo