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

62 lines
2.2 KiB
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 для лабораторной работы №3
# Многозадачное программирование
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -g
# Цель по умолчанию
all: parent lab1_var12
# Родительская программа
parent: parent.c
$(CC) $(CFLAGS) -o $@ $<
# Программа из лабораторной работы №1
lab1_var12: lab1_var12.c
$(CC) $(CFLAGS) -o $@ $<
# Создание тестовых файлов
test_files:
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
# Тест с несколькими файлами
test: all test_files
@echo "=== Запуск теста с тремя файлами ==="
./parent ./lab1_var12 10 input1.txt output1.txt input2.txt output2.txt input3.txt output3.txt
@echo ""
@echo "=== Результаты обработки ==="
@echo "--- output1.txt ---"
@cat output1.txt
@echo "--- output2.txt ---"
@cat output2.txt
@echo "--- output3.txt ---"
@cat output3.txt
# Тест обработки ошибок - несуществующий файл
test_error: all
@echo "=== Тест обработки ошибки (несуществующий входной файл) ==="
./parent ./lab1_var12 5 nonexistent.txt output_error.txt
# Тест обработки ошибок - неверная программа
test_bad_program: all test_files
@echo "=== Тест обработки ошибки (неверная программа) ==="
./parent ./nonexistent_program 5 input1.txt output1.txt
# Тест обработки ошибок - недостаточно аргументов
test_bad_args: all
@echo "=== Тест обработки ошибки (недостаточно аргументов) ==="
./parent ./lab1_var12 5
# Очистка
clean:
rm -f parent lab1_var12
rm -f input1.txt input2.txt input3.txt
rm -f output1.txt output2.txt output3.txt output_error.txt
.PHONY: all test test_files test_error test_bad_program test_bad_args clean