-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (32 loc) · 892 Bytes
/
Makefile
File metadata and controls
42 lines (32 loc) · 892 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
31
32
33
34
35
36
37
38
39
40
41
42
CC = gcc
CFLAGS = -pthread -lrt -Wall -Wextra
# Source files
SRC_PRODUCER = producer.c
SRC_CONSUMER = consumer.c
SRC_SHARED = sharedMemory.h
# Output executables
OUT_PRODUCER = producer
OUT_CONSUMER = consumer
# Test files directory
TEST_DIR = tests
# Default rule
all: $(OUT_PRODUCER) $(OUT_CONSUMER)
# Compile producer
$(OUT_PRODUCER): $(SRC_PRODUCER) $(SRC_SHARED)
$(CC) $(CFLAGS) $(SRC_PRODUCER) -o $(OUT_PRODUCER)
# Compile consumer
$(OUT_CONSUMER): $(SRC_CONSUMER) $(SRC_SHARED)
$(CC) $(CFLAGS) $(SRC_CONSUMER) -o $(OUT_CONSUMER)
# Run tests
.PHONY: test
test: all
@echo "Running tests..."
@bash $(TEST_DIR)/repeatTest.sh 0.01 1
@bash $(TEST_DIR)/stressTest.sh 0.01 2
@bash $(TEST_DIR)/testMultipleThreads.sh 0.01 3
@echo "All tests completed."
# Clean build artifacts
.PHONY: clean
clean:
rm -f $(OUT_PRODUCER) $(OUT_CONSUMER) log.txt
rm -f $(TEST_DIR)/logTable.txt