-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·49 lines (37 loc) · 1.67 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Git variables
GIT_REPOSITORY_NAME := $(shell basename `git rev-parse --show-toplevel`)
GIT_VERSION := $(shell git describe --always --tags --long --dirty | sed -e 's/\-0//' -e 's/\-g.......//')
# Docker variables
DOCKER_IMAGE_TAG ?= $(GIT_REPOSITORY_NAME):$(GIT_VERSION)
DOCKER_IMAGE_NAME := senzing/ibm-db2
# -----------------------------------------------------------------------------
# The first "make" target runs as default.
# -----------------------------------------------------------------------------
.PHONY: default
default: help
# -----------------------------------------------------------------------------
# Docker-based builds
# -----------------------------------------------------------------------------
.PHONY: docker-build
docker-build: docker-rmi-for-build
docker build \
--tag $(DOCKER_IMAGE_NAME) \
--tag $(DOCKER_IMAGE_NAME):$(GIT_VERSION) \
.
# -----------------------------------------------------------------------------
# Clean up targets
# -----------------------------------------------------------------------------
.PHONY: docker-rmi-for-build
docker-rmi-for-build:
-docker rmi --force \
$(DOCKER_IMAGE_NAME):$(GIT_VERSION) \
$(DOCKER_IMAGE_NAME)
.PHONY: clean
clean: docker-rmi-for-build docker-rmi-for-build-development-cache
# -----------------------------------------------------------------------------
# Help
# -----------------------------------------------------------------------------
.PHONY: help
help:
@echo "List of make targets:"
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs