-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (38 loc) · 977 Bytes
/
Makefile
File metadata and controls
48 lines (38 loc) · 977 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
43
44
45
46
47
48
# Makefile for SSD Simulator with FTL & GC
CC = gcc
CFLAGS = -Wall -Wextra -O2 -g
TARGET = ssd_simulator
# Source files
SOURCES = testshell.c ssd.c ftl.c nand_flash.c
OBJECTS = $(SOURCES:.c=.o)
HEADERS = ssd.h ftl.h nand_flash.h
# Build target
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJECTS)
@echo "Build complete: ./$(TARGET)"
# Compile individual object files
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
# Clean build artifacts
clean:
rm -f $(OBJECTS) $(TARGET)
rm -f nand_flash.bin result.txt nand.txt
@echo "Clean complete"
# Run the simulator
run: $(TARGET)
./$(TARGET)
# Run with automatic test
test: $(TARGET)
@echo "Running TestApp1..."
@echo "testapp1" | ./$(TARGET)
@echo ""
@echo "Running TestApp2..."
@echo "testapp2" | ./$(TARGET)
@echo ""
@echo "Running TestApp3 (GC test)..."
@echo "testapp3" | ./$(TARGET)
# Show statistics
stats: $(TARGET)
@echo "stats" | ./$(TARGET)
.PHONY: all clean run test stats