# Makefile for ForestFire project on Borg cluster
# Originally created by Joel Adams, Calvin University
# Modified by Steven McKelvey, Calvin University
# To build, enter: make

# name of the binary
PROGRAM   = Fire

# source files
SRCS      = firestarter.c lcrng.c

# object files from source files
OBJS      = $(SRCS:.c=.o)

# compiler, flags and shell to use
CC        = mpicc
CFLAGS    = -Wall
LFLAGS    = -lm
SHELL     = /bin/bash

# Rules
.PHONY: clean

# valid file suffixes 
.SUFFIXES: .c .o .cpp

# Link object files
$(PROGRAM): $(OBJS)
	module load openmpi-5.0.7; \
	$(CC) $^ $(LFLAGS) -o $@ 

# command to build .o files from .c files
%.o: %.c
	module load openmpi-5.0.7; \
	$(CC) $(CFLAGS) -c $< -o $@

# other dependencies (based on #includes)
lcrng.o: lcrng.h

clean:
	/bin/rm -f $(OBJS) $(PROGRAM) *~ *#

