# 
# ------ MAKEFILE FILE FOR Linux FREALIGN -----------pgi
# 
# Using: Portland compiler
#
# Thanks to: Shixin Yang & Dr Edward Egelman at University of Virginia
#    for providing this file
#
# Notes:  To create executable: make -f Makefile_linux_amd64_pgi
#

SHELL  = /bin/sh

FFLAGS = -dusty -w -O4 -openmp -fpp -D_OPENMP -D_NAG -c

CFLAGS = -w -c

COMP   = nagfor

CC     = gcc

LF     = -Bstatic -openmp

PGM    = frealign_v9

LIB    = $(PGM)_mp.a

.PRECIOUS :  $(PGM) $(LIB) 

include Makefile.inc

$(PGM) : $(PGM).o $(LIB)
	@echo linking $(PGM)
	$(COMP) $(LF) $(PGM).o $(LIB) -o ../bin/$(PGM)_mp.exe
	@\rm $(PGM).o

$(PGM).o  : $(PGM).f
	$(COMP) $(FFLAGS) -o $(PGM).o  $(PGM).f
	$(COMP) -Bstatic -o ../bin/set_polarity.exe set_polarity.f
	$(COMP) -Bstatic -o ../bin/calc_occ.exe calc_occ.f
	$(COMP) -Bstatic -o ../bin/rsample.exe rsample.f

ioc.o : ioc.c
	$(CC) $(CFLAGS) -o ioc.o ioc.c
	$(AR) r $(LIB) ioc.o
	@\rm ioc.o

$(LIB) : ioc.o $(ELEMENTS)
	@echo all object files placed in library

.f.a:
	$(COMP) $(FFLAGS) $<
	$(AR) r $(LIB) $*.o
	@\rm $*.o
