anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | # |
| 2 | # Copyright 2019-present Open Networking Foundation |
| 3 | # Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. |
| 4 | # Copyright (c) 2017 Intel Corporation |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | |
| 19 | PROJECT_NAME := openmme |
| 20 | VERSION ?= $(shell cat ./VERSION) |
| 21 | |
| 22 | TOPTARGETS := all clean install |
| 23 | |
| 24 | SUBDIRS := src/cmn \ |
| 25 | src/common \ |
| 26 | src/gtpV2Codec \ |
| 27 | src/stateMachineFwk \ |
| 28 | src/mmeGrpcProtos \ |
| 29 | src/mmeGrpcClient \ |
| 30 | src/mme-app \ |
| 31 | src/s1ap \ |
| 32 | src/s11 \ |
| 33 | src/s6a |
| 34 | |
| 35 | #$(wildcard src/mme-app/.) |
| 36 | |
| 37 | $(TOPTARGETS): $(SUBDIRS) |
| 38 | $(SUBDIRS): |
| 39 | $(MAKE) -C $@ $(MAKECMDGOALS) |
| 40 | |
| 41 | ## Docker related |
| 42 | DOCKER_REGISTRY ?= |
| 43 | DOCKER_REPOSITORY ?= |
| 44 | DOCKER_BUILD_ARGS ?= |
| 45 | DOCKER_TAG ?= ${VERSION} |
| 46 | DOCKER_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}${PROJECT_NAME}:${DOCKER_TAG} |
| 47 | |
| 48 | ## Docker labels. Only set ref and commit date if committed |
| 49 | DOCKER_LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote)) |
| 50 | DOCKER_LABEL_VCS_REF ?= $(shell git diff-index --quiet HEAD -- && git rev-parse HEAD || echo "unknown") |
| 51 | DOCKER_LABEL_COMMIT_DATE ?= $(shell git diff-index --quiet HEAD -- && git show -s --format=%cd --date=iso-strict HEAD || echo "unknown" ) |
| 52 | DOCKER_LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ") |
| 53 | |
| 54 | # https://docs.docker.com/engine/reference/commandline/build/#specifying-target-build-stage---target |
| 55 | docker-build: |
| 56 | docker build $(DOCKER_BUILD_ARGS) \ |
| 57 | -t ${DOCKER_IMAGENAME} \ |
| 58 | --build-arg org_label_schema_version="${VERSION}" \ |
| 59 | --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \ |
| 60 | --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \ |
| 61 | --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \ |
| 62 | --build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \ |
| 63 | . |
| 64 | |
| 65 | docker-push: |
| 66 | docker push ${DOCKER_IMAGENAME} |
| 67 | |
| 68 | .PHONY: $(TOPTARGETS) $(SUBDIRS) docker-build docker-push |