# $Id: Makefile.in,v 1.4 2002/03/29 20:16:00 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.
#  
#  
#  $

SHELL	= /bin/sh
EXEC	= 

prefix		=	$${OMNI_HOME:=@orgPrefix@}
exec_prefix     =       @orgExec_prefix@

CC	= ${prefix}/bin/omcc
CFLAGS	= -O

SUBDIRS	= directive/parallel \
	  directive/wkshr/for directive/wkshr/sngl directive/wkshr/sctn \
	  directive/sync/master directive/sync/ordrd directive/sync/barrier \
	  directive/sync/atomic directive/sync/flush directive/sync/crtcl \
	  directive/data/prvt directive/data/fstprvt directive/data/lstprvt \
	  directive/data/shrd directive/data/dflt directive/data/rdctn \
	  directive/data/cpyin directive/data/attr directive/data/thdprvt \
	  directive/combine/for directive/combine/sctn \
	  directive/cndcmp \
	  directive/nest \
	  rtlib/get_nstd rtlib/get_thrdn rtlib/get_mthrd rtlib/get_nthrd \
	  rtlib/set_nthrd rtlib/get_nproc rtlib/in_prll rtlib/set_dynmc \
	  rtlib/get_dynmc rtlib/set_nstd rtlib/init_lck rtlib/init_nlck \
	  rtlib/dstry_lck rtlib/dstry_nlck rtlib/set_nlck rtlib/set_lck \
	  rtlib/uset_lck rtlib/uset_nlck rtlib/tst_nlck rtlib/tst_lck \
	  env \
	  omni/afntyschd \
	  other

all:	./.inc.done
	for i in ${SUBDIRS} ;  do \
	  (cd $$i;  $(MAKE) -i CC="${CC}" CFLAGS="${CFLAGS}"); \
	done

clean:
	for i in ${SUBDIRS} ;  do \
	  (cd $$i;  $(MAKE) clean); \
	done
	find . \( -name omniConfig.h -o -name omni.h \) -a -type l -print | xargs rm -f
	rm -f .inc.done

test:	./.inc.done
	for i in ${SUBDIRS} ;  do \
	  (cd $$i;  $(MAKE) -i CC="${CC}" CFLAGS="${CFLAGS}" EXEC="${EXEC}" test); \
	done

./.inc.done:
	( \
		if test -f ../../include/omniConfig.h -a -f ../../include/exc_platform.h.in; then \
			echo "use configured header in source tree."; \
			cp ../../include/omniConfig.h . ; \
		else \
			echo "use installed configured header."; \
			cp ${prefix}/include/omniConfig.h . ; \
		fi; \
	)
	dirs=`find . -name Makefile -print | sed 's:/Makefile::'` ; \
	tDir=`pwd`; \
	for i in $${dirs}; \
	do \
		case $$i in \
			.)	true;; \
			*)	(cd $$i; rm -f ./omniConfig.h; ln -s $${tDir}/omniConfig.h .); \
				(cd $$i; rm -f ./omni.h; ln -s $${tDir}/omni.h .);; \
		esac; \
	done
	> ./.inc.done

distclean:	clean
	true
