44 lines
1.0 KiB
Makefile
44 lines
1.0 KiB
Makefile
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_third
|
||
|
||
threads_third: main.c
|
||
$(CC) $(CFLAGS) -o $@ $<
|
||
|
||
test_two: threads_third
|
||
@echo "=== Тест с двумя файлами ==="
|
||
@printf "abcdefghijk\n" > $(INPUT1)
|
||
@printf "xxxxxxxxxx\n" > $(INPUT2)
|
||
./threads_third $(MAX_REPL) $(INPUT1) $(OUTPUT1) $(INPUT2) $(OUTPUT2)
|
||
@echo "--- $(INPUT1) -> $(OUTPUT1) ---"
|
||
@cat $(INPUT1)
|
||
@echo "-----"
|
||
@cat $(OUTPUT1)
|
||
@echo
|
||
@echo "--- $(INPUT2) -> $(OUTPUT2) ---"
|
||
@cat $(INPUT2)
|
||
@echo "-----"
|
||
@cat $(OUTPUT2)
|
||
|
||
|
||
clean:
|
||
@echo "Очистка..."
|
||
rm -f threads_third
|
||
rm -f in1.txt out1.txt in2.txt out2.txt
|
||
|
||
help:
|
||
@echo "Available targets:"
|
||
@echo " all - build threads_third"
|
||
@echo " test_two - run two-file multithread test"
|
||
@echo " clean - remove binaries and test files"
|
||
@echo " help - show this help"
|
||
|
||
.PHONY: all test_one test_two test_all clean help
|