-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (29 loc) · 867 Bytes
/
Makefile
File metadata and controls
38 lines (29 loc) · 867 Bytes
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
# Directory variables
SRC_DIR = src
INSTALL_DIR = /usr/local/sbin
# Binary to compile
SRC_FILE = $(SRC_DIR)/keymeter.c
BINARY = keymeter
# GCC compiler flags
CFLAGS = -I/usr/include/libevdev-1.0
LDFLAGS = -levdev -lm
# Default target: Build the binary
all: $(BINARY)
# Compile the source file into the binary
$(BINARY): $(SRC_FILE)
@echo "Compiling $(BINARY)..."
gcc $(CFLAGS) $(SRC_FILE) $(LDFLAGS) -o $(BINARY)
# Install target: Install the binary
install: $(BINARY)
@echo "Installing $(BINARY) to $(INSTALL_DIR)..."
install -m 755 $(BINARY) $(INSTALL_DIR)/$(BINARY)
# Uninstall target: Remove the installed binary
uninstall:
@echo "Removing $(BINARY) from $(INSTALL_DIR)..."
rm -f $(INSTALL_DIR)/$(BINARY)
# Clean target: Remove the compiled binary
clean:
@echo "Cleaning up..."
rm -f $(BINARY)
# Phony targets
.PHONY: all install uninstall clean