JacobiHPC/Makefile
2017-01-22 01:02:17 +01:00

91 lines
1.7 KiB
Makefile

CC=gcc
CC_OMP=gcc -fopenmp
CC_MPI=mpicc
CC_CUDA=nvcc
CFLAGS=-Wall -lm -std=c99
SRC=src
BUILD=build
BUILD_CUDA=build_cuda
BIN=bin
all: sequential mpi omp sse cuda
sequential: config utils main
${CC} ${CFLAGS} \
${BUILD}/config.o \
${BUILD}/utils.o \
${BUILD}/main.o \
${SRC}/impl/sequential.c \
-o ${BIN}/jacobi_sequential
cuda: config_cuda utils_cuda main_cuda
${CC_CUDA} \
${BUILD_CUDA}/config.o \
${BUILD_CUDA}/utils.o \
${BUILD_CUDA}/main.o \
${SRC}/impl/cuda.cu \
-o ${BIN}/jacobi_cuda
sse: config utils main
${CC} ${CFLAGS} \
${BUILD}/config.o \
${BUILD}/utils.o \
${BUILD}/main.o \
${SRC}/impl/sse.c \
-o ${BIN}/jacobi_sse
omp: config utils main
${CC_OMP} ${CFLAGS} \
${BUILD}/config.o \
${BUILD}/utils.o \
${BUILD}/main.o \
${SRC}/impl/omp.c \
-o ${BIN}/jacobi_omp
mpi: config utils main_mpi
${CC_MPI} ${CFLAGS} \
${BUILD}/config.o \
${BUILD}/utils.o \
${BUILD}/main_mpi.o \
${SRC}/impl/mpi.c \
-o ${BIN}/jacobi_mpi
main: ${SRC}/main/main.c
${CC_MPI} -c ${CFLAGS} \
${SRC}/main/main.c \
-o ${BUILD}/main.o
main_mpi: ${SRC}/main/main_mpi.c
${CC_MPI} -c ${CFLAGS} \
${SRC}/main/main_mpi.c \
-o ${BUILD}/main_mpi.o
main_cuda: ${SRC}/main/main.cu
${CC_CUDA} -c \
${SRC}/main/main.cu \
-o ${BUILD_CUDA}/main.o
config: ${SRC}/config.c
${CC_MPI} -c ${CFLAGS} \
${SRC}/config.c \
-o ${BUILD}/config.o
config_cuda: ${SRC}/config.cu
${CC_CUDA} -c \
${SRC}/config.cu \
-o ${BUILD_CUDA}/config.o
utils: ${SRC}/utils.c
${CC_MPI} -c ${CFLAGS} \
${SRC}/utils.c \
-o ${BUILD}/utils.o
utils_cuda: ${SRC}/utils.cu
${CC_CUDA} -c \
${SRC}/utils.cu \
-o ${BUILD_CUDA}/utils.o
.PHONY: clean
clean:
rm build/[^.]* build_cuda/[^.]* bin/[^.]*