Files
csapp2025/weblab/Makefile
2025-06-08 21:34:30 +08:00

44 lines
926 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Makefile for Web Server
CC = gcc
CFLAGS = -Wall -Wextra -std=c99
TARGET = webserver
SOURCE = webserver.c
# 默认目标
all: $(TARGET)
# 编译web服务器
$(TARGET): $(SOURCE)
$(CC) $(CFLAGS) -o $(TARGET) $(SOURCE)
# 创建webroot目录和示例文件
setup:
mkdir -p webroot
@echo "Creating webroot directory and copying index.html..."
# 运行服务器
run: $(TARGET)
./$(TARGET)
# 清理编译文件
clean:
rm -f $(TARGET)
rm -f webserver.log
# 完全清理包括webroot目录
distclean: clean
rm -rf webroot
# 帮助信息
help:
@echo "Available targets:"
@echo " all - Compile the web server"
@echo " setup - Create webroot directory"
@echo " run - Compile and run the server"
@echo " clean - Remove compiled files and logs"
@echo " distclean- Remove everything including webroot"
@echo " help - Show this help message"
.PHONY: all setup run clean distclean help