# 
# ------ MAKEFILE FILE FOR Linux FREALIGN -----------intel
# 
# Using: Intel compiler
##
# Notes:  To create executable: make -f Makefile_linux_amd64_intel_static
#

SHELL  = /bin/sh

FFLAGS = -w -c -m64 -static -fp-model fast=2 -fpp

CFLAGS = -c -w -m64 -static -fp-model fast=2 -fpp

COMP   = ifort

CC     = icc

LF     = -m64 -static

PGM    = frealign_v9

LIB    = $(PGM).a

.PRECIOUS :  $(PGM) $(LIB) 

include Makefile.inc

$(PGM) : $(PGM).o $(LIB)
	@echo linking $(PGM)
	$(COMP) $(LF) $(PGM).o $(LIB) -o ../bin/$(PGM).exe
	$(COMP) $(FFLAGS) -o merge_3d.o  merge_3d.f
	$(COMP) $(LF) merge_3d.o $(LIB) -o ../bin/merge_3d.exe
	@\rm $(PGM).o
	@\rm merge_3d.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
