CC = gcc CFLAGS = -Wall -Wextra -std=c11 -g all: server_tcp_pairs client_tcp_pairs server_tcp_pairs: server.c $(CC) $(CFLAGS) -o $@ $< client_tcp_pairs: client.c $(CC) $(CFLAGS) -o $@ $< test_server: server_tcp_pairs @echo "=== Запуск TCP-сервера (пары одинаковых символов) ===" @echo "Выходной файл: out.txt" ./server_tcp_pairs 5000 out.txt test_client: client_tcp_pairs @echo "=== Запуск TCP-клиента ===" @echo "Создаём input.txt" @printf "aabbccddeeff\nabba\nxxxxx\n" > input.txt ./client_tcp_pairs 127.0.0.1 5000 input.txt test_all: all @echo "=== Автотест TCP (пары одинаковых символов) ===" @printf "aabbccddeeff\nabba\nxxxxx\n" > input.txt ./server_tcp_pairs 5000 out.txt & \ SRV=$$!; \ sleep 1; \ ./client_tcp_pairs 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_tcp_pairs client_tcp_pairs rm -f input.txt out.txt help: @echo "Targets:" @echo " all - build server_tcp_pairs and client_tcp_pairs" @echo " test_server - run server (port 5000, out.txt)" @echo " test_client - run client to send input.txt" @echo " test_all - end-to-end TCP test" @echo " clean - remove binaries and test files" @echo " help - show this help" .PHONY: all test_server test_client test_all clean help