-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (52 loc) · 1.6 KB
/
Copy pathMakefile
File metadata and controls
64 lines (52 loc) · 1.6 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Makefile for UNO Game
# Simplified build: all code is in server.cpp and client.cpp
# Compiler and flags
CXX := g++
CXXFLAGS := -std=c++11 -Wall -Wextra -pthread
LDFLAGS := -pthread -lrt
# Source files
SERVER_SRC := server.cpp
CLIENT_SRC := client.cpp
# Executables (no subdirectory for Windows compatibility)
SERVER_EXEC := server.exe
CLIENT_EXEC := client.exe
# Default target
.PHONY: all
all: $(SERVER_EXEC) $(CLIENT_EXEC)
# Server executable
$(SERVER_EXEC): $(SERVER_SRC)
$(CXX) $(CXXFLAGS) -o $@ $(SERVER_SRC) $(LDFLAGS)
@echo "Server built: $@"
# Client executable
$(CLIENT_EXEC): $(CLIENT_SRC)
$(CXX) $(CXXFLAGS) -o $@ $(CLIENT_SRC)
@echo "Client built: $@"
# Clean build artifacts
.PHONY: clean
clean:
-del /Q $(SERVER_EXEC) $(CLIENT_EXEC) 2>nul || rm -f $(SERVER_EXEC) $(CLIENT_EXEC)
@echo "Clean complete"
# Clean everything including generated logs
.PHONY: distclean
distclean: clean
-del /Q *.log scores.txt 2>nul || rm -f *.log scores.txt
@echo "Distribution clean complete"
# Run server (default 3 players)
.PHONY: run
run: $(SERVER_EXEC)
./$(SERVER_EXEC)
# Run server with specified number of players
.PHONY: run-players
run-players: $(SERVER_EXEC)
./$(SERVER_EXEC) $(NUM)
# Help target
.PHONY: help
help:
@echo "UNO Game Makefile"
@echo "================="
@echo "Targets:"
@echo " all - Build server and client"
@echo " run - Run server with 3 players"
@echo " run-players - Run server with custom player count (make run-players NUM=4)"
@echo " clean - Remove build artifacts"
@echo " distclean - Remove build artifacts, logs and scores"