-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (32 loc) · 1.31 KB
/
Makefile
File metadata and controls
41 lines (32 loc) · 1.31 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
# Simple Makefile for Name Server
CC = gcc
CFLAGS = -Wall -Wextra -g -pthread
LDFLAGS = -pthread -lrt
# Target executable
TARGET = ns_server
# Source files
SRCS = name_server/name_server.c name_server/nm_data_structures.c name_server/nm_logger.c name_server/nm_commands.c name_server/nm_request_queue.c name_server/nm_search.c name_server/nm_folder.c name_server/nm_folder_commands.c name_server/nm_checkpoint.c name_server/nm_access_request.c name_server/nm_replication.c
# Object files
OBJS = name_server/name_server.o name_server/nm_data_structures.o name_server/nm_logger.o name_server/nm_commands.o name_server/nm_request_queue.o name_server/nm_search.o name_server/nm_folder.o name_server/nm_folder_commands.o name_server/nm_checkpoint.o name_server/nm_access_request.o name_server/nm_replication.o
# Build target
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LDFLAGS)
@echo "Build complete: $(TARGET)"
# Compile object files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Run the name server
.PHONY: run
run: $(TARGET)
./$(TARGET)
# Clean build artifacts
.PHONY: clean
clean:
rm -f $(TARGET) $(OBJS)
@echo "Clean complete"
.PHONY: help
help:
@echo "Available targets:"
@echo " make - Build the name server"
@echo " make run - Build and run the name server"
@echo " make clean - Remove build artifacts"