Files
CS-LABS/mine/lab_8/kirill/Makefile
2025-12-10 16:50:28 +07:00

51 lines
1.5 KiB
Makefile

CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -g
all: server_udp_third client_udp_third
server_udp_third: server.c
$(CC) $(CFLAGS) -o $@ $<
client_udp_third: client.c
$(CC) $(CFLAGS) -o $@ $<
test_server: server_udp_third
@echo "=== Запуск UDP-сервера (каждый третий символ -> пробел) ==="
@echo "Выходной файл: out.txt"
./server_udp_third 5000 out.txt
test_client: client_udp_third
@echo "=== Запуск UDP-клиента ==="
@echo "Создаём input.txt"
@printf "abcdefghi\n1234567890\n" > input.txt
./client_udp_third 127.0.0.1 5000 input.txt
test_all: all
@echo "=== Автотест UDP (каждый третий символ -> пробел) ==="
@printf "abcdefghi\n1234567890\n" > input.txt
./server_udp_third 5000 out.txt & \
SRV=$$!; \
sleep 1; \
./client_udp_third 127.0.0.1 5000 input.txt; \
wait $$SRV; \
echo "--- input.txt ---"; \
cat input.txt; \
echo "--- out.txt ---"; \
cat out.txt
clean:
@echo "Очистка..."
rm -f server_udp_third client_udp_third
rm -f input.txt out.txt
help:
@echo "Targets:"
@echo " all - build server_udp_third and client_udp_third"
@echo " test_server - run server (port 5000, out.txt)"
@echo " test_client - run client to send input.txt"
@echo " test_all - end-to-end UDP test"
@echo " clean - remove binaries and test files"
@echo " help - show this help"
.PHONY: all test_server test_client test_all clean help