#     This file is a part of the fortranposix library. This makes system calls on Linux and Unix like systems available to Fortran programs.
#     Copyright (C) 2004  Madhusudan Singh 
#
#    This library is free software; you can redistribute it and/or
#    modify it under the terms of the GNU Lesser General Public
#    License as published by the Free Software Foundation; either
#    version 2.1 of the License, or (at your option) any later version.
#
#    This library is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#    Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public
#    License along with this library; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#    I would strongly welcome bug reports, feature enhancement requests, compliments, donations and job offers :) My email address : msc@ieee.org

# USES GNU make - gmake

# Name of the library

LIBRARYFILE=libfortranposix.so
DEBUGLIBRARYFILE=libfortranposixdbg.so

RM=rm -f

# Your fortran compiler
F95C=f95 -pipe -Wall -g -O2 -fPIC -DPIC
# Option for generating shared libraries on your Fortran compiler
F95SHAREDOPTION=-shared
F95DEBUGOPTIONS=-g -CB
# Your C compiler
CC=gcc -pipe -Wall -g -O2 -fPIC -DPIC
CCDEBUGOPTIONS=-g3

OBJFILES=posixwrapper.o
DEBUGOBJFILES=posixwrapperdbg.o

all: $(LIBRARYFILE) clean

clean :
	$(RM) *.o

debug : $(DEBUGLIBRARYFILE) clean

$(LIBRARYFILE) :: $(OBJFILES)
	$(F95C) $(F95SHAREDOPTION) fortranposix.f90 -o $(LIBRARYFILE) $(OBJFILES)


$(DEBUGLIBRARYFILE) :: $(DEBUGOBJFILES)
	$(F95C) $(F95DEBUGOPTIONS) $(F95SHAREDOPTION) fortranposix.f90 -o $(DEBUGLIBRARYFILE) $(DEBUGOBJFILES)

posixwrapper.o : posixwrapper.c
	$(CC) -c posixwrapper.c

posixwrapperdbg.o : posixwrapper.c
	$(CC) $(CCDEBUGOPTIONS) -c posixwrapper.c -o posixwrapperdbg.o
