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

62 lines
1.6 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.
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