-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (51 loc) · 1.38 KB
/
Makefile
File metadata and controls
67 lines (51 loc) · 1.38 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Makefile for Object Measurement System
# Basys3 FPGA Project
# Compiler settings
CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -O2 -g
LDFLAGS = -lm
# For embedded/simulation build
SIMULATION_CFLAGS = -DSIMULATION
# Source files
SOURCES = main.c \
motor_control.c \
sensor.c \
measurement.c \
display.c
# Object files
OBJECTS = $(SOURCES:.c=.o)
# Target executable
TARGET = object_measurement
# Default target
all: $(TARGET)
# Build target
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
@echo "Build complete: $(TARGET)"
# Compile source files to object files
%.o: %.c
$(CC) $(CFLAGS) $(SIMULATION_CFLAGS) -c $< -o $@
# Clean build artifacts
clean:
rm -f $(OBJECTS) $(TARGET)
@echo "Clean complete"
# Run the program (for simulation)
run: $(TARGET)
./$(TARGET)
# Debug build
debug: CFLAGS += -DDEBUG -g3
debug: $(TARGET)
# Embedded build (no simulation code)
embedded: CFLAGS += -DEMBEDDED
embedded: SIMULATION_CFLAGS =
embedded: $(TARGET)
# Help target
help:
@echo "Available targets:"
@echo " all - Build the project (default)"
@echo " clean - Remove build artifacts"
@echo " run - Build and run the program"
@echo " debug - Build with debug symbols"
@echo " embedded - Build for embedded system (no simulation code)"
@echo " help - Show this help message"
.PHONY: all clean run debug embedded help