Makefile

# The OMPI_CC environment variable must be defined, otherwise mpicc will
# fail with a complaint about being unable to locate gcc.
#
# Be sure to `export OMPI_CC=/usr/bin/clang`
#
# Dependencies:
# 	OpenMPI must be installed
# 	pthreads must be available
#
# Make variables:
# 	MT: Specify the number of workers to use. Defaults to 1 if unspecified
# 	FAST: If defined, use optimization and vector unrolling optimizations
# 	      If not defined, disable optimizations and include debugging symbols
#
# Examples:
# 	`make MT=4 FAST=1`

CC=/usr/local/bin/mpicc
PREFIX=    /usr/local
BINDIR=    ${PREFIX}/bin

PROGS= order-up

SRCS_order-up = order-up.c math.c wq.c

CFLAGS= -W -Wall -Wextra
.if !defined(FAST)
CFLAGS+=-g -O0
.else
CFLAGS+=-O3 -flax-vector-conversions=all
.endif

LDFLAGS= -lm -pthread

.if defined(MT)
CFLAGS+=-DNUM_WORKERS=$(MT)
.else
CFLAGS+=-DNUM_WORKERS=1
.endif

.PHONY: run archive

# Defines a convenience target for executing a four worker run using mpirun
run:
	        mpirun -np 4 -H localhost:4 ./order-up -d 200 -s 50 \
						--num-time-periods=750 --purchase-cost=0.79 \
						--sale-price=4.50 --theta-max-ceiling=250 --theta-min-ceiling=150 -v

archive:
	git archive --output=seqdec-1.0.tgz --prefix=seqdec-1.0/ HEAD

.include <bsd.prog.mk>