-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (48 loc) · 1.53 KB
/
Makefile
File metadata and controls
54 lines (48 loc) · 1.53 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
# Makefile for socket client/server programs
# Compatible with macOS, NetBSD, and 211BSD
# Clients are now organized by platform under arch/
CC = cc
CFLAGS = -O
# Default target
all: client server
# Detect platform and build appropriate client
client:
@echo "Detecting platform..."
@if [ "`uname -s`" = "Darwin" ]; then \
echo "Building macOS client..."; \
cd arch/macOS && $(MAKE) && cd ../..; \
cp arch/macOS/client client; \
elif [ "`uname -s`" = "NetBSD" ]; then \
if [ "`uname -m`" = "amd64" ]; then \
echo "Building NetBSD x64 client..."; \
cd arch/NetBSDx64 && $(MAKE) && cd ../..; \
cp arch/NetBSDx64/client client; \
else \
echo "Building NetBSD VAX client..."; \
cd arch/NetBSDVAX && $(MAKE) && cd ../..; \
cp arch/NetBSDVAX/client client; \
fi; \
elif [ "`uname -s`" = "Linux" ]; then \
echo "Building Linux x64 client..."; \
cd arch/LinuxX64 && $(MAKE) && cd ../..; \
cp arch/LinuxX64/client client; \
elif [ -f /usr/include/pdp11 ] || [ "`uname -s`" = "2.11BSD" ]; then \
echo "Building 2.11BSD client..."; \
cd arch/211BSD && $(MAKE) && cd ../..; \
cp arch/211BSD/client client; \
else \
echo "Unknown platform, defaulting to macOS client..."; \
cd arch/macOS && $(MAKE) && cd ../..; \
cp arch/macOS/client client; \
fi
server: server.c
$(CC) $(CFLAGS) -o server server.c
clean:
rm -f client server
@for dir in arch/*/; do \
if [ -f "$$dir/Makefile" ]; then \
echo "Cleaning $$dir..."; \
cd "$$dir" && $(MAKE) clean && cd ../..; \
fi; \
done
.PHONY: all clean client server