-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (23 loc) · 844 Bytes
/
Copy pathMakefile
File metadata and controls
30 lines (23 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Compiler and Flags
CC = gcc
# [cite_start]-pthread is required for the threading library [cite: 17]
# -Wall turns on all standard warnings (good practice)
CFLAGS = -Wall -pthread
# Target executable name
TARGET = lab2
# Source file name (Make sure your C file is named this, or update this line)
SRC = 3.c
# Default target: compile the program
all: $(TARGET)
$(TARGET): $(SRC)
$(CC) $(CFLAGS) -o $(TARGET) $(SRC)
# Helper target: Create 10 dummy files for testing (file0.txt ... file9.txt)
setup:
@echo "Creating 10 dummy files..."
@for i in {0..9}; do echo "This is content for file $$i" > file$$i.txt; done
# Run target: Compiles, creates files, and runs the program for 10 files
run: $(TARGET) setup
./$(TARGET) 10
# Clean target: Removes the executable and all copied text files
clean:
rm -f $(TARGET) file*_copy.txt file*.txt