# 
# ------ MAKEFILE FILE FOR Linux BIN2MRC -----------
# 
# Using: gnu 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_gnu
#

SHELL  = /bin/sh

FFLAGS = -s -w -c

CFLAGS = -w -c

COMP   = gfortran

CC     = gcc

LF     = -static

PGM    = bin2mrc

LIB    = $(PGM).a

.PRECIOUS :  $(PGM) $(LIB) 

include Makefile.inc

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

$(PGM).o  : $(PGM).f
	$(COMP) $(FFLAGS) -o $(PGM).o  $(PGM).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
