62 lines
1.3 KiB
Makefile
62 lines
1.3 KiB
Makefile
CC = clang
|
|
FC = flang
|
|
AR = ar
|
|
|
|
# Architecture settings for RISC-V (adjust as needed)
|
|
ARCH_FLAGS =
|
|
|
|
DEBUG_FLAGS = -g
|
|
|
|
# Library settings
|
|
LIB_NAME = librvprof
|
|
STATIC_LIB = $(LIB_NAME).a
|
|
|
|
# Source directories
|
|
SRC_DIR = src
|
|
INCLUDE_DIR = include
|
|
|
|
# Source files
|
|
C_SOURCES = \
|
|
$(SRC_DIR)/rvprof_core.c \
|
|
$(SRC_DIR)/rvprof_timing.c \
|
|
$(SRC_DIR)/rvprof_symbols.c \
|
|
$(SRC_DIR)/rvprof_memory.c \
|
|
$(SRC_DIR)/rvprof_hooks.c \
|
|
$(SRC_DIR)/rvprof_output.c \
|
|
$(SRC_DIR)/rvprof_utils.c \
|
|
$(SRC_DIR)/rvprof_stats.c \
|
|
$(SRC_DIR)/rvprof_context.c \
|
|
$(SRC_DIR)/rvprof_fortran.c
|
|
|
|
F_SOURCES = rvprof_module.f90
|
|
HEADERS = rvprof.h $(SRC_DIR)/rvprof_internal.h
|
|
|
|
# Object files
|
|
C_OBJECTS = $(C_SOURCES:.c=.o)
|
|
F_OBJECTS = $(F_SOURCES:.f90=.o)
|
|
ALL_OBJECTS = $(C_OBJECTS) $(F_OBJECTS)
|
|
|
|
# Module files (generated by Fortran compiler)
|
|
MOD_FILES = rvprof.mod
|
|
|
|
# Default target
|
|
all: $(STATIC_LIB)
|
|
|
|
# Static library
|
|
$(STATIC_LIB): $(ALL_OBJECTS)
|
|
@echo "Creating static library $@"
|
|
$(AR) rcs $@ $^
|
|
|
|
# C object files
|
|
$(SRC_DIR)/%.o: $(SRC_DIR)/%.c $(HEADERS)
|
|
@echo "Compiling C source $<"
|
|
$(CC) $(CFLAGS) $(DEBUG_FLAGS) -I. -c $< -o $@
|
|
|
|
# Fortran object files (depends on C objects for linking)
|
|
%.o: %.f90 $(C_OBJECTS)
|
|
@echo "Compiling Fortran module $<"
|
|
$(FC) $(FFLAGS) -c $< -o $@
|
|
|
|
clean:
|
|
rm -f $(ALL_OBJECTS) $(MOD_FILES)
|
|
rm -f $(STATIC_LIB)
|