CC = gcc CFLAGS = -Wall -Wextra -std=c99 -g # Default target - build FIFO programs all: fifo # ===== FIFO targets ===== fifo: fifo_server fifo_client fifo_server: fifo_server.c $(CC) $(CFLAGS) -o $@ $< fifo_client: fifo_client.c $(CC) $(CFLAGS) -o $@ $< # ===== Test files ===== files: @echo "Создание тестовых файлов..." echo "abbaabbaabbaabbaabbaabbaabbaabba" > input1.txt echo "xyzxyzxyzxyzxyzxyzxyzxyz" >> input1.txt echo "hello world hello" >> input1.txt echo "testtest" > input2.txt echo "aaaaaaa" >> input2.txt echo "programming" > input3.txt echo "ppppython" >> input3.txt # ===== FIFO tests ===== test_server: fifo files @echo "=== Запуск FIFO сервера ===" @echo "В другом терминале выполните: make test_fifo_client" @echo "\n\n" ./fifo_server 10 test_client: fifo files @echo "=== Запуск FIFO клиента ===\n\n" & \ ./fifo_client input1.txt output1_fifo.txt; \ ./fifo_client input2.txt output2_fifo.txt; \ ./fifo_client input3.txt output3_fifo.txt; @echo "\n=== Результаты FIFO ===\n" @echo "--- output1_fifo.txt ---" @cat output1_fifo.txt || true @echo "\n--- output2_fifo.txt ---" @cat output2_fifo.txt || true @echo "\n--- output3_fifo.txt ---" @cat output3_fifo.txt || true # Cleanup clean: @echo "Очистка..." rm -f fifo_server fifo_client rm -f input1.txt input2.txt input3.txt rm -f output*.txt rm -f /tmp/fifo_request /tmp/fifo_response # Help help: @echo "Available targets:" @echo " fifo - Compile fifo_server and fifo_client" @echo " files - Create test input files" @echo " test_server - Run FIFO server (use client in another terminal)" @echo " test_client - Run FIFO client and show results" @echo " clean - Remove built files and test files" @echo " help - Show this help" .PHONY: all fifo files test_server test_client clean help