kirill-refactor

This commit is contained in:
2025-12-10 16:50:28 +07:00
parent cb9d0ac607
commit f3a5c1f658
114 changed files with 2066 additions and 0 deletions

61
mine/lab_7/Makefile Normal file
View File

@@ -0,0 +1,61 @@
CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -g -pthread
# Параметры по умолчанию
MAX_REPL ?= 100
INPUT1 ?= in1.txt
OUTPUT1 ?= out1.txt
INPUT2 ?= in2.txt
OUTPUT2 ?= out2.txt
all: threads_var12
threads_var12: threads_var12.c
$(CC) $(CFLAGS) -o $@ $<
# ===== Тесты =====
# Простой тест с одним файлом
test_one: threads_var12
@echo "=== Тест с одним файлом ==="
@echo "abacaba" > $(INPUT1)
./threads_var12 $(MAX_REPL) $(INPUT1) $(OUTPUT1)
@echo "--- input ---"
@cat $(INPUT1)
@echo "--- output ---"
@cat $(OUTPUT1)
# Тест с двумя файлами
test_two: threads_var12
@echo "=== Тест с двумя файлами ==="
@echo "abacaba" > $(INPUT1)
@echo "xxxhello" > $(INPUT2)
./threads_var12 $(MAX_REPL) $(INPUT1) $(OUTPUT1) $(INPUT2) $(OUTPUT2)
@echo "--- $(INPUT1) -> $(OUTPUT1) ---"
@cat $(INPUT1)
@echo "-----"
@cat $(OUTPUT1)
@echo
@echo "--- $(INPUT2) -> $(OUTPUT2) ---"
@cat $(INPUT2)
@echo "-----"
@cat $(OUTPUT2)
# Автотест: можно переопределять имена файлов извне
test_all: test_one test_two
clean:
@echo "Очистка..."
rm -f threads_var12
rm -f in1.txt out1.txt in2.txt out2.txt
help:
@echo "Available targets:"
@echo " all - build threads_var12"
@echo " test_one - run single-file test"
@echo " test_two - run two-file multithread test"
@echo " test_all - run all tests"
@echo " clean - remove binaries and test files"
@echo " help - show this help"
.PHONY: all test_one test_two test_all clean help