-
Brandon Rodriguez authoredcd808e85
makefile 1.10 KiB
# Tell makefile to use commands defined here, if file with same name exists.
.PHONY: all run valgrind
# Set default if none is specified.
default: all
# Variables.
CC = mpicc
EXE = mpiexec
CFLAGS = -Wall -Wpedantic -std=c99 -g
TARGET = main.out
LIBRARIES = -pthread
DEPENDENCIES = src/main.c src/load_balance_general.c src/load_balance_schemes.c src/structs.c src/terminal_commands.c
CORES := $(shell nproc)
# ARGS = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
ARGS = $(filter-out $@,$(MAKECMDGOALS))
# Compile target if any depenencies update.
$(TARGET): $(DEPENDENCIES)
@$(CC) $(CFLAGS) $(DEPENDENCIES) -o $(TARGET) $(LIBRARIES)
# Compile target if dependencies update.
all: $(TARGET)
# Compile target if dependencies update. Then run.
run: $(TARGET)
# @$(EXE) -n $(CORES) --oversubscribe ./$(TARGET) $(ARGS)
@$(EXE) -n 4 --oversubscribe ./$(TARGET) $(ARGS)
# Compile target if dependencies update. Then run.
valgrind: $(TARGET)
@rm ./logs/*
@$(EXE) -n $(CORES) --oversubscribe valgrind --leak-check=full --suppressions=valgrind_supression.txt --log-file=./logs/vg.%p ./$(TARGET) $(ARGS)