seems like working lab2

This commit is contained in:
2025-10-15 16:58:23 +07:00
parent 6036a989cf
commit e0d0c21c53
3 changed files with 216 additions and 0 deletions

27
lab_2/Makefile Normal file
View File

@@ -0,0 +1,27 @@
# Makefile
CC = gcc
CFLAGS = -Wall -Wextra -std=c99
LDFLAGS = -ldl
# Цель по умолчанию
all: task12 libtextlib.so
# Основная программа
task12: task12.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
# Динамическая библиотека
libtextlib.so: textlib.c
$(CC) $(CFLAGS) -fPIC -shared -o $@ $<
# Очистка
clean:
rm -f task12 libtextlib.so input.txt output.txt
# Тест
test: all
echo -e "Hello world\ntest line\nanother" > input.txt
./task12 input.txt output.txt 5 ./libtextlib.so
cat output.txt
.PHONY: all clean test