-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (37 loc) · 1.17 KB
/
Copy pathMakefile
File metadata and controls
46 lines (37 loc) · 1.17 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
# DisplaySettingsTUI Makefile
BINARY_NAME=display-settings-tui
BUILD_DIR=build
INSTALL_DIR=/usr/local/bin
# Try to find go in common locations
GO := $(shell which go 2>/dev/null || echo "/usr/local/go/bin/go")
.PHONY: build install install-user uninstall clean run
build:
@mkdir -p $(BUILD_DIR)
$(GO) build -buildvcs=true -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd
@echo "Built: $(BUILD_DIR)/$(BINARY_NAME)"
install:
@if [ -f $(BUILD_DIR)/$(BINARY_NAME) ]; then \
install -Dm755 $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_DIR)/$(BINARY_NAME); \
echo "Installed: $(INSTALL_DIR)/$(BINARY_NAME)"; \
else \
echo "Run 'make build' first, then 'sudo make install'"; \
exit 1; \
fi
install-user:
@if [ -f $(BUILD_DIR)/$(BINARY_NAME) ]; then \
mkdir -p ~/.local/bin; \
install -Dm755 $(BUILD_DIR)/$(BINARY_NAME) ~/.local/bin/$(BINARY_NAME); \
echo "Installed: ~/.local/bin/$(BINARY_NAME)"; \
echo "Make sure ~/.local/bin is in your PATH"; \
else \
echo "Run 'make build' first, then 'make install-user'"; \
exit 1; \
fi
uninstall:
rm -f $(INSTALL_DIR)/$(BINARY_NAME)
@echo "Uninstalled"
clean:
rm -rf $(BUILD_DIR)
@echo "Cleaned"
run: build
./$(BUILD_DIR)/$(BINARY_NAME)