nixos-riscv/pkgs/spec-cpu/Makefile.in

81 lines
2.7 KiB
Makefile

#Compile all benchmarks with individual settings defined in their Makefiles
_default-target: default
# RVB_ROOT defined as argument
# TODO: RVB_COMMON_DIR should substitute COMMON_DIR
COMMON_DIR=$(RVB_ROOT)/common
RVB_COMMON_DIR=$(RVB_ROOT)/common
CC=clang
CXX=clang++
# Needs EPI clang
#MEPI=-mepi
MEPI=
VREPORT_FLAGS=-Rpass=loop-vectorize -Rpass-missed=loop-vectorize -Rpass-analysis=loop-vectorize
#Available CFLAGS conditional compilation:
# -DUSE_MALLOC_HP, redefines the use of malloc and free
#Makefile: General compiler flags: CFLAGS, CFLAGS_<VERSION_1>, CFLAGS_<VERSION_2>, ...
#CFLAGS=-B ${LLVM_BIN} -Wall -Wextra -march=rv64g -O2 -I${RVB_COMMON_DIR}
CFLAGS=-B ${LLVM_BIN} -Wall -Wextra -O2 -I${RVB_COMMON_DIR}
LDFLAGS=
#Only scalar instructions
CFLAGS_SCALAR=${CFLAGS} -DRVB_USE_SCALAR
LDFLAGS_SCALAR=
#Vector instructions using intrinsics
CFLAGS_VECTORIAL=${CFLAGS} -fno-vectorize $(MEPI)
LDFLAGS_VECTORIAL=
# TODO: RVV should substitute VECTORIAL (?)
#Vector instructions using intrinsics
CFLAGS_RVV=${CFLAGS} -DRVB_USE_RVV -fno-vectorize $(MEPI)
LDFLAGS_RVV=${LDFLAGS}
#Vector instructions only when code is annotate
CFLAGS_EXPLICIT_AUTOVECTORIZATION=${CFLAGS} -fopenmp-simd -fno-vectorize $(MEPI) ${VREPORT_FLAGS}
LDFLAGS_EXPLICIT_AUTOVECTORIZATION=
# TODO: OMP substitutes EXPLICIT_AUTOVECTORIZATION
#Vector instructions only when code is annotate
CFLAGS_OMP=${CFLAGS} -DRVB_USE_OMP -fopenmp-simd -fno-vectorize $(MEPI) ${VREPORT_FLAGS}
LDFLAGS_OMP=${LDFLAGS}
#Vector instructions when compiler decides
CFLAGS_AUTOVECTORIZATION=${CFLAGS} -fopenmp-simd $(MEPI) ${VREPORT_FLAGS}
LDFLAGS_AUTOVECTORIZATION=
# TODO: AUTOVECT shoud substitue AUTOVECTORIZATION (?)
#Vector instructions when compiler decides
CFLAGS_AUTOVECT=${CFLAGS} -DRVB_USE_AUTOVECT -fopenmp-simd $(MEPI) ${VREPORT_FLAGS}
LDFLAGS_AUTOVECT=${LDFLAGS}
# CBLAS library compile and link flags
CFLAGS_CBLAS=${CFLAGS} -DRVB_USE_CBLAS -I${CBLAS_INC} -I${LLVM_INC}
LDFLAGS_CBLAS=${LDFLAGS} -L${CBLAS_LIB} -lblis -Wl,-rpath,${CBLAS_LIB} -fopenmp
# BARE-METAL compile and link flags
# You may consider to disable OpenPiton Stream: -DDISABLE_OPSTREAM
CFLAGS_BMETAL=${CFLAGS} -DRVB_USE_BMETAL -B ${RVB_BMETAL_DIR} \
--target=riscv64-unknown-elf \
-I../ \
-I/apps/riscv/llvm/EPI-0.7/cross/development/riscv64-unknown-linux-gnu/sysroot/usr/include \
-I/usr/include/riscv64-linux-gnu \
-I/usr/include \
-I${RVB_BMETAL_DIR}/env \
-I${RVB_BMETAL_DIR} \
-DPREALLOCATE=1 -mcmodel=medany \
-static -std=gnu99 \
-ffast-math \
-fno-common \
-fno-builtin-printf \
${RVB_BMETAL_DIR}/syscalls.c \
${RVB_BMETAL_DIR}/crt.S \
-static -nostdlib -T \
${RVB_BMETAL_DIR}/test.ld