Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20250121-155155.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: Add new target into Makefile - install
time: 2025-01-21T15:51:55.43821+08:00
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
BINARY_NAME=ydbops
BUILD_DIR=bin
INSTALL_DIR ?= ~/ydb/bin

TODAY=$(shell date --iso=minutes)
GIT_COMMIT=$(shell git rev-parse HEAD)

# Detect OS and architecture
ifeq ($(OS),Windows_NT)
SYSTEM_OS = win32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
SYSTEM_ARCH = amd64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
SYSTEM_ARCH = x86
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SYSTEM_OS = linux
endif
ifeq ($(UNAME_S),Darwin)
SYSTEM_OS = darwin
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
SYSTEM_ARCH = amd64
endif
ifneq ($(filter %86,$(UNAME_P)),)
SYSTEM_ARCH = x86
endif
ifneq ($(filter arm%,$(UNAME_P)),)
SYSTEM_ARCH = arm64
endif
endif

# APP_VERSION gets supplied from outside in CI as an env variable.
# By default you can still build `ydbops` manually without specifying it,
# but there won't be a nice tag in `--version`. There will be a commit SHA anyway.
Expand Down Expand Up @@ -45,3 +75,11 @@ build-in-docker: clear docker
docker create --name $(BINARY_NAME) $(BINARY_NAME)
docker cp '$(BINARY_NAME):/app/bin/' $(BUILD_DIR)
docker rm -f $(BINARY_NAME)

install:
ifeq ($(SYSTEM_OS),darwin)
cp ${BUILD_DIR}/${BINARY_NAME}_$(SYSTEM_OS)_$(SYSTEM_ARCH) $(INSTALL_DIR)/ydbops
else
cp ${BUILD_DIR}/${BINARY_NAME} $(INSTALL_DIR)/ydbops
endif
chmod +x $(INSTALL_DIR)/ydbops