-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (32 loc) · 793 Bytes
/
Makefile
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
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -O2
# Directories
SRC_DIR = src
BUILD_DIR = build
BIN_DIR = bin
INCLUDE_DIR = include
# Target executable name
TARGET = $(BIN_DIR)/zebrapass
# Source files
SRC = $(SRC_DIR)/zebrapass.c
# Object files
OBJ = $(BUILD_DIR)/zebrapass.o
# Default target to compile the program
all: $(TARGET)
# Rule to build the executable
$(TARGET): $(OBJ)
$(CC) $(OBJ) -o $(TARGET)
# Rule to compile the source file to object file
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(BUILD_DIR)
$(CC) $(CFLAGS) -I$(INCLUDE_DIR) -c $< -o $@
# Clean the build files
clean:
rm -rf $(BUILD_DIR) $(BIN_DIR)
# Install target (optional)
install:
@echo "Installing ZebraPass..."
@cp $(TARGET) /usr/local/bin/zebrapass
# Phony targets
.PHONY: all clean install