-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
45 lines (36 loc) · 1.08 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
# Copyright 2022 VMware, Inc.
# SPDX-License-Identifier: BSD-2
HASH := $(shell git rev-parse --short HEAD)
COMMIT_DATE := $(shell git show -s --format=%ci ${HASH})
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
VERSION := ${HASH} (${COMMIT_DATE})
BUILDDIR ?= .
SRCDIR ?= .
.PHONY: help
help:
@echo "make [TARGETS...]"
@echo
@echo " help: Print this usage information."
@echo " build: Builds project"
@echo " install: Installs binary, configuration and unit files"
@echo " clean: Cleans the build"
$(BUILDDIR)/:
mkdir -p "$@"
$(BUILDDIR)/%/:
mkdir -p "$@"
.PHONY: build
build:
- mkdir -p bin
go build -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" -o bin/cntrctl ./cmd/cntrctl
.PHONY: install
install:
install bin/cntrctl /usr/bin/
# backward compatibility
ln -sf /usr/bin/cntrctl /usr/bin/containerctl
install -vdm 755 /etc/photon-os-container
install -m 755 distribution/photon-os-container.toml /etc/photon-os-container
systemctl daemon-reload
PHONY: clean
clean:
go clean
rm -rf bin