Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YDBOPS-11054: install route for Makefile #57

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
PREFIX ?= ~/ydb/bin
elabpro marked this conversation as resolved.
Show resolved Hide resolved

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 ($(UNAME_S),Darwin)
elabpro marked this conversation as resolved.
Show resolved Hide resolved
cp ${BUILD_DIR}/${BINARY_NAME}_$(SYSTEM_OS)_$(SYSTEM_ARCH) $(PREFIX)/ydbops
else
cp ${BUILD_DIR}/${BINARY_NAME} $(PREFIX)/ydbops
endif
chmod +x $(PREFIX)/ydbops
Loading