kirill-refactor
This commit is contained in:
50
mine/lab_8/Makefile
Normal file
50
mine/lab_8/Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -std=c11 -g
|
||||
|
||||
all: server_udp client_udp
|
||||
|
||||
server_udp: server.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
client_udp: client.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
test_server: server_udp
|
||||
@echo "=== Запуск UDP-сервера ==="
|
||||
@echo "Выходной файл: out.txt"
|
||||
./server_udp 5000 out.txt
|
||||
|
||||
test_client: client_udp
|
||||
@echo "=== Запуск UDP-клиента ==="
|
||||
@echo "Тестовый input.txt"
|
||||
@printf "abacaba\nhello\nabcaa\naaaaa\n" > input.txt
|
||||
./client_udp 127.0.0.1 5000 input.txt
|
||||
|
||||
test_all: all
|
||||
@echo "=== Автотест UDP ==="
|
||||
@printf "abacaba\nhello\nabcaa\naaaaa\n" > input.txt
|
||||
./server_udp 5000 out.txt & \
|
||||
SRV=$$!; \
|
||||
sleep 1; \
|
||||
./client_udp 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 client_udp
|
||||
rm -f input.txt out.txt
|
||||
|
||||
help:
|
||||
@echo "Targets:"
|
||||
@echo " all - build server_udp and client_udp"
|
||||
@echo " test_server - run server (port 5000, out.txt)"
|
||||
@echo " test_client - run client to send input.txt"
|
||||
@echo " test_all - run 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
|
||||
Reference in New Issue
Block a user