-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (59 loc) · 2.29 KB
/
Makefile
File metadata and controls
68 lines (59 loc) · 2.29 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ============================================================================
# Metetch Makefile
# Copyright (c) 2025 techoraye
# Licensed under the MIT License
# See LICENSE file for details
# ============================================================================
.PHONY: all build install uninstall clean help
# Color output
GREEN := \033[0;32m
YELLOW := \033[0;33m
RED := \033[0;31m
NC := \033[0m # No Color
INSTALL_PATH := /usr/local/bin
BUILD_DIR := build
BINARY_NAME := metetch
VERSION := 0.5.4
all: build
build:
@echo "$(YELLOW)Building metetch v$(VERSION)...$(NC)"
@TMP_BUILD=/tmp/metetch_build_$$$$; \
mkdir -p $$TMP_BUILD/build; \
cp -r src include CMakeLists.txt $$TMP_BUILD/ 2>/dev/null || true; \
cd $$TMP_BUILD/build && \
cmake .. > /dev/null 2>&1 && \
make -j$(shell nproc) > /dev/null 2>&1 && \
mkdir -p $(PWD)/$(BUILD_DIR) && \
cp $$TMP_BUILD/build/$(BINARY_NAME) $(PWD)/$(BUILD_DIR)/ && \
rm -rf $$TMP_BUILD && \
echo "$(GREEN)✓ Build successful!$(NC)" && \
echo "$(GREEN)Binary location: $(PWD)/$(BUILD_DIR)/$(BINARY_NAME)$(NC)" || \
(echo "$(RED)✗ Build failed!$(NC)" && exit 1)
install: build
@echo "$(YELLOW)Installing metetch to $(INSTALL_PATH)...$(NC)"
@sudo cp $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_PATH)/
@sudo chmod +x $(INSTALL_PATH)/$(BINARY_NAME)
@echo "$(GREEN)✓ Installation successful!$(NC)"
@echo "$(GREEN)Run 'metetch' from anywhere to start the system monitor.$(NC)"
uninstall:
@echo "$(YELLOW)Removing metetch from $(INSTALL_PATH)...$(NC)"
@sudo rm -f $(INSTALL_PATH)/$(BINARY_NAME)
@echo "$(GREEN)✓ Uninstallation successful!$(NC)"
clean:
@echo "$(YELLOW)Cleaning build directory...$(NC)"
@rm -rf $(BUILD_DIR)
@echo "$(GREEN)✓ Clean successful!$(NC)"
help:
@echo "$(GREEN)metetch - System Information Fetcher$(NC)"
@echo ""
@echo "$(YELLOW)Available targets:$(NC)"
@echo " make build - Build the project (default)"
@echo " make install - Build and install to $(INSTALL_PATH)"
@echo " make uninstall - Remove from system"
@echo " make clean - Remove build directory"
@echo " make help - Show this help message"
@echo ""
@echo "$(YELLOW)Examples:$(NC)"
@echo " make # Build the project"
@echo " make install # Build and install system-wide"
@echo " make uninstall # Remove from system"