# $Id: Makefile.in,v 1.24 2001/10/26 22:13:01 m-hirano Exp $
# $RWC_Release: Omni-1.6 $
# $RWC_Copyright:
#  Omni Compiler Software Version 1.5-1.6
#  Copyright (C) 2002 PC Cluster Consortium
#  
#  This software is free software; you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License version
#  2.1 published by the Free Software Foundation.
#  
#  Omni Compiler Software Version 1.0-1.4
#  Copyright (C) 1999, 2000, 2001.
#   Tsukuba Research Center, Real World Computing Partnership, Japan.
#  
#  Please check the Copyright and License information in the files named
#  COPYRIGHT and LICENSE under the top  directory of the Omni Compiler
#  Software release kit.
#  
#  
#  $


TOPDIR		=	../..
prefix		=	@prefix@
exec_prefix	=	@exec_prefix@

bindir		=	$(exec_prefix)/bin
libdir		=	$(prefix)/lib

ompcdir		=	$(libdir)/openmp
ompcincdir	=	$(ompcdir)/include
ompclibdir	=	$(ompcdir)/lib

INSTALLDIR	=	$(ompclibdir)
INSTALLHDRDIR	=	$(ompcincdir)
INSTALL		= 	@INSTALLCOM@
MKDIR		=	@MKDIRCOM@

GCCINC		=	-I`case "$(CC)" in *gcc) echo \`$(CC) -v 2>&1 | grep specs | sed 's/specs$$/include/' | awk '{ print $$NF }'\`;; esac`


CC_OPT_SWITCH	=	@CFLAGS@

CPPFLAGS	=	-I. -I$(TOPDIR)/include @gmpIncOpt@ -DUSE_STRLEN -DSkip_f2c_Undefs \
			@DEFS@ @CPPFLAGS@ -D__IN_OMNI_COMPILE__ -DMPFT_CAST \
			-DGOOD_SPRINTF_EXPONENT -DWANT_LEAD_0 @F2C_INT64_FLAGS@ \
			-DUIOLEN_int
CFLAGS		=	$(CC_OPT_SWITCH) $(CPPFLAGS)

STGCC		=	@STGCC@
CC		=	@CC@ 
AR		=	@AR@
RANLIB		=	@RANLIB@

YACC		=	@YACCCOM@

DEPEND_SWITCH	=	$(CPPFLAGS) -DMT_SAFE_IO


INSTALL_HDRS	=	f2c.h
TARGET		=	libf2c.a ompf77main.o ompf77main_omp.o

MISC =	s_rnge.o abort_.o exit_.o getarg_.o iargc_.o\
	getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o\
	derf_.o derfc_.o erf_.o erfc_.o sig_die.o
POW =	pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o
CX =	c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o
DCX =	z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o
REAL =	r_abs.o r_acos.o r_asin.o r_atan.o r_atn2.o r_cnjg.o r_cos.o\
	r_cosh.o r_dim.o r_exp.o r_imag.o r_int.o\
	r_lg10.o r_log.o r_mod.o r_nint.o r_sign.o\
	r_sin.o r_sinh.o r_sqrt.o r_tan.o r_tanh.o
DBL =	d_abs.o d_acos.o d_asin.o d_atan.o d_atn2.o\
	d_cnjg.o d_cos.o d_cosh.o d_dim.o d_exp.o\
	d_imag.o d_int.o d_lg10.o d_log.o d_mod.o\
	d_nint.o d_prod.o d_sign.o d_sin.o d_sinh.o\
	d_sqrt.o d_tan.o d_tanh.o
INT =	i_abs.o i_dim.o i_dnnt.o i_indx.o i_len.o i_mod.o i_nint.o i_sign.o\
	lbitbits.o lbitshft.o
HALF =	h_abs.o h_dim.o h_dnnt.o h_indx.o h_len.o h_mod.o h_nint.o h_sign.o
CMP =	l_ge.o l_gt.o l_le.o l_lt.o hl_ge.o hl_gt.o hl_le.o hl_lt.o
EFL =	ef1asc_.o ef1cmc_.o
CHAR =	f77_aloc.o s_cat.o s_cmp.o s_copy.o
I77 =	backspace.o close.o dfe.o dolio.o due.o endfile.o err.o\
	fmt.o fmtlib.o ftell_.o iio.o ilnw.o inquire.o lread.o lwrite.o\
	open.o rdfmt.o rewind.o rsfe.o rsli.o rsne.o sfe.o sue.o\
	typesize.o uio.o util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o \
	omniIoSub.o omniIntr.o omniQReal.o
QINT =	pow_qq.o qbitbits.o qbitshft.o
TIME =	dtime_.o etime_.o time_.o
IO_SINGLE =	omniIo.o

COM_OBJS	= $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \
	$(HALF) $(CMP) $(EFL) $(CHAR) $(I77) $(TIME)

OBJS = $(COM_OBJS) $(IO_SINGLE)

DEFAULT_MT_LIB_NAME = libf2c_mt.a

all:	$(TARGET) doAllLib

include ./target.tmpl

libf2c.a:	$(OBJS)
	rm -rf $@
	$(AR) $@ $(OBJS)
	$(RANLIB) $@

ompf77main_omp.o:	ompf77main.c
	$(CC) -c $(CFLAGS) -DCALL_OMP_INIT ompf77main.c -o $@

install: $(TARGET) doAllLib $(INSTALL_HDRS)
	@if [ ! -d $(INSTALLDIR) ] ; then \
		(echo "Making directory $(INSTALLDIR)" ; \
		$(MKDIR) $(INSTALLDIR) ; \
		chmod 775 $(INSTALLDIR)); \
	else \
		true ; \
	fi
	@if [ ! -d $(INSTALLHDRDIR) ] ; then \
		(echo "Making directory $(INSTALLHDRDIR)" ; \
		$(MKDIR) $(INSTALLHDRDIR) ; \
		chmod 775 $(INSTALLHDRDIR)); \
	else \
		true ; \
	fi

	for i in $(TARGET) ; do \
		$(INSTALL) -m 644 $$i $(INSTALLDIR) ; \
		case $$i in \
			*.a) \
				$(RANLIB) $(INSTALLDIR)/$$i;; \
		esac \
	done
	for i in $(LIB_TARGET) ; do \
		$(INSTALL) -m 644 $$i $(INSTALLDIR); \
		case $$i in \
			*.a) \
				$(RANLIB) $(INSTALLDIR)/$$i;; \
		esac \
	done
	(cd $(INSTALLDIR); rm -f $(DEFAULT_MT_LIB_NAME); ln -s $(DEFAULT_LIB) $(DEFAULT_MT_LIB_NAME))
	for i in $(INSTALL_HDRS) ; do \
	     $(INSTALL) -m 644 $$i $(INSTALLHDRDIR); \
	done

clean:
	rm -f $(TARGET) *.o *~ core  $(LIB_TARGET) *._*_o

distclean:	clean
	rm -f config.* Makefile .depend* ./target.tmpl ./f2c.h

depend:
	touch .depend.tmp
	makedepend -f ./.depend.tmp -a -- $(GCCINC) $(DEPEND_SWITCH) -- *.c
	sed 's:^$(PLATFORMDIR)/:./:' ./.depend.tmp > ./.depend
	cat Makefile ./.depend > ./Makefile.tmp
	mv Makefile.tmp Makefile
	rm -f ./.depend ./.depend.tmp .depend.tmp.bak

Makefile::
	(cd ../../; sh ./config.status)

checkObj:
	@echo omniIo.c
