-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (23 loc) · 780 Bytes
/
Makefile
File metadata and controls
33 lines (23 loc) · 780 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
# Compiler
CC = g++
# Compiler flags
CFLAGS = -Wall -g -Werror -Iinclude
# List of source files
SRC = src/main.cpp src/packet.cpp src/socket.cpp src/tcb.cpp src/state_machine.cpp src/mytcp.cpp src/user_socket.cpp src/messages.cpp src/timer.cpp src/common.cpp
# List of object files
OBJ = $(SRC:.cpp=.o)
# Executable name for the main application
EXEC = mytcp
# Include the test Makefile
include tests/Makefile
# Default target
all: $(EXEC) $(SERVER_EXEC) $(CLIENT_EXEC)
# Rule to link the object files into the final executable
$(EXEC): $(OBJ)
$(CC) $(CFLAGS) -o $(EXEC) $(OBJ)
# Rule to compile each .cpp file into .o
%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@
# Clean target to remove generated files
clean:
rm -f $(EXEC) $(OBJ) $(SERVER_EXEC) $(CLIENT_EXEC) tests/*.o