-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
78 lines (59 loc) · 1.62 KB
/
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
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
69
70
71
72
73
74
75
76
77
78
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -pedantic -O2
# Directories
SRC_DIR = src
OBJ_DIR = obj
BIN_DIR = bin
INC_DIR = include
# Target executable
TARGET = $(BIN_DIR)/BlackMarlinExec
# Source and object files
SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(SRCS:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
DEPS = $(SRCS:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.d)
# Include directories
INCLUDES = -I$(INC_DIR)
# Rules
.PHONY: all clean docker-build docker-run
all: $(TARGET)
$(TARGET): $(OBJS)
@mkdir -p $(BIN_DIR)
$(CC) $(CFLAGS) $(OBJS) -o $(TARGET)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) $(INCLUDES) -MMD -c $< -o $@
-include $(DEPS)
clean:
rm -rf $(OBJ_DIR) $(BIN_DIR)
install: $(TARGET)
install -m 0755 $(TARGET) /usr/local/bin
uninstall:
rm -f /usr/local/bin/BlackMarlinExec
test: $(TARGET)
./$(TARGET) --test
format:
clang-format -i $(SRCS)
lint:
cpplint $(SRCS)
docs:
doxygen Doxyfile
help:
@echo "Usage: make SRC_DIR"
@echo "Targets:"
@echo " all - Build the project"
@echo " clean - Remove build artifacts"
@echo " install - Install the executable"
@echo " uninstall - Remove the installed executable"
@echo " test - Run tests"
@echo " format - Format source code"
@echo " lint - Lint source code"
@echo " docs - Generate documentation"
@echo " help - Display this help message"
@echo " docker-setup - Build the RAW-Docker"
@echo " docker-build - Build the Docker image"
@echo " docker-run - Run the Docker container"
docker-build:
docker build -t blackmarlinexec .
docker-run:
docker run --rm -it blackmarlinexec