# $Id: Makefile.in,v 1.3 2002/02/22 01:42:24 kameyama 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
ompclibexecdir	=	$(ompcdir)/libexec
ompclibdir	=	$(ompcdir)/lib
ompcclassdir	=	$(ompcdir)/java
ompctempldir	=	$(ompcdir)/template

INSTALLDIR	=	$(bindir)
INSTALL		= 	@INSTALLCOM@
MKDIR		=	@MKDIRCOM@

wrapper_prefix		=	@wrapperPrefix@
wrapper_exec_prefix	=	@wrapperExecPrefix@

wrapper_bindir		=	$(wrapper_exec_prefix)/bin
wrapper_libdir		=	$(wrapper_prefix)/lib

wrapper_ompcdir		=	$(wrapper_libdir)/openmp
wrapper_ompclibexecdir	=	$(wrapper_ompcdir)/libexec
wrapper_ompclibdir	=	$(wrapper_ompcdir)/lib
wrapper_ompcclassdir	=	$(wrapper_ompcdir)/java
wrapper_ompctempldir	=	$(wrapper_ompcdir)/template

WRAPPER_INSTALLDIR	=	$(wrapper_bindir)

WRAPPER		=	wrapper
INSTALL_COMMAND	=	omf77 omcc
LINK_COMMAND	=	tlogview jmpstat
TARGET		=	$(WRAPPER)
WRAPPER_IS_DEFAULT	= @wrapperInstallDefault@

all: $(TARGET)

wrapper:	wrapper.in
	(cd ../..; sh ./config.status)
	chmod 755 $@


install: $(TARGET) 
	@if [ "x$(wrapper_prefix)" != "x" ] ; then \
		if [ ! -d $(WRAPPER_INSTALLDIR) ] ; then \
			(echo "Making directory $(WRAPPER_INSTALLDIR)" ; \
			$(MKDIR) $(WRAPPER_INSTALLDIR) ; \
			chmod 775 $(WRAPPER_INSTALLDIR)); \
		else \
			true ; \
		fi; \
	fi
	if [ "x$(wrapper_prefix)" != "x" ] ; then \
		for i in $(INSTALL_COMMAND); do \
			$(INSTALL) -m 755 $(WRAPPER) $(WRAPPER_INSTALLDIR)/$$i ; \
		done; \
		( \
			cd $(WRAPPER_INSTALLDIR) ; \
			for i in f77 cc; do \
				rm -f ./omp$$i; \
				ln -s ./om$$i ./omp$$i; \
			done; \
			for i in $(LINK_COMMAND); do \
				if [ ! -x $$i -o $(WRAPPER_IS_DEFAULT) = "yes" ] ; then \
					rm -f $$i; \
					ln -s `echo $(INSTALLDIR)|sed "s,$(DESTDIR),,"`/$$i $$i; \
				fi ; \
			done \
		); \
	fi

clean:
	rm -f core *~ *.exe

distclean:	clean
	rm -f config.* Makefile .depend* $(TARGET) core *~

depend:

test:
