Files
csapp2025/perflab/poly/Makefile
2025-04-12 11:37:07 +08:00

35 lines
598 B
Makefile

CC = gcc
NVCC = nvcc
CFLAGS = -Wall -O2 -g
CUDA_FLAGS = -O2 -g
LDFLAGS = -lm -lcudart
# Source files
SRCS = poly_test.c clock.c cpe.c fcyc.c lsquare.c
CUDA_SRCS = poly.cu
OBJS = $(SRCS:.c=.o) poly.o
# Target executable
TARGET = poly_test
# Default target
all: $(TARGET)
# Rule to build the executable
$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $(TARGET) $(LDFLAGS)
# Rule to build object files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Rule to build CUDA object files
poly.o: poly.cu
$(NVCC) $(CUDA_FLAGS) -c $< -o $@
# Clean rule
clean:
rm -f $(OBJS) $(TARGET)
# Phony targets
.PHONY: all clean