# Path: waflib/Tools/ccroot.py
# SYSTEM_LIB_PATHS = ['/usr/lib64', '/usr/lib', '/usr/local/lib64', '/usr/local/lib']
# USELIB_VARS = Utils.defaultdict(set)
# def create_compiled_task(self, name, node):
# def to_incnodes(self, inlst):
# def apply_incpaths(self):
# 	def add_target(self, target):
# 	def exec_command(self, *k, **kw):
# 	def exec_mf(self):
# def rm_tgt(cls):
# 	def wrap(self):
# def apply_skip_stlib_link_deps(self):
# def apply_link(self):
# def use_rec(self, name, **kw):
# def process_use(self):
# def accept_node_to_link(self, node):
# def add_objects_from_tgen(self, tg):
# def get_uselib_vars(self):
# def propagate_uselib_vars(self):
# def apply_implib(self):
# def apply_vnum(self):
# 	def keyword(self):
# 	def run(self):
# 	def runnable_status(self):
# 	def runnable_status(self):
# def read_shlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def read_stlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def process_lib(self):
# 	def runnable_status(self):
# def add_those_o_files(self, node):
# def process_objs(self):
# def read_object(self, obj):
# def set_full_paths_hpux(self):
# class link_task(Task.Task):
# class stlink_task(link_task):
# class vnum(Task.Task):
# class fake_shlib(link_task):
# class fake_stlib(stlink_task):
# class fake_o(Task.Task):
# 
# Path: waflib/TaskGen.py
# def extension(*k):
# 	"""
# 	Decorator that registers a task generator method which will be invoked during
# 	the processing of source files for the extension given::
# 
# 		from waflib import Task
# 		class mytask(Task):
# 			run_str = 'cp ${SRC} ${TGT}'
# 		@extension('.moo')
# 		def create_maa_file(self, node):
# 			self.create_task('mytask', node, node.change_ext('.maa'))
# 		def build(bld):
# 			bld(source='foo.moo')
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for x in k:
# 			task_gen.mappings[x] = func
# 		return func
# 	return deco
# 
# Path: waflib/Configure.py
# def conf(f):
# 	"""
# 	Decorator: attach new configuration functions to :py:class:`waflib.Build.BuildContext` and
# 	:py:class:`waflib.Configure.ConfigurationContext`. The methods bound will accept a parameter
# 	named 'mandatory' to disable the configuration errors::
# 
# 		def configure(conf):
# 			conf.find_program('abc', mandatory=False)
# 
# 	:param f: method to bind
# 	:type f: function
# 	"""
# 	def fun(*k, **kw):
# 		mandatory = kw.pop('mandatory', True)
# 		try:
# 			return f(*k, **kw)
# 		except Errors.ConfigurationError:
# 			if mandatory:
# 				raise
# 
# 	fun.__name__ = f.__name__
# 	setattr(ConfigurationContext, f.__name__, fun)
# 	setattr(Build.BuildContext, f.__name__, fun)
# 	return f


from waflib import Utils, Task, Errors
from waflib.Tools import ccroot, fc_config, fc_scan
from waflib.TaskGen import extension
from waflib.Configure import conf
"""
Fortran support
"""


ccroot.USELIB_VARS['fc'] = set(['FCFLAGS', 'DEFINES', 'INCLUDES', 'FCPPFLAGS'])
ccroot.USELIB_VARS['fcprogram_test'] = ccroot.USELIB_VARS['fcprogram'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS'])
ccroot.USELIB_VARS['fcshlib'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS'])
ccroot.USELIB_VARS['fcstlib'] = set(['ARFLAGS', 'LINKDEPS'])

@extension('.f','.F','.f90','.F90','.for','.FOR','.f95','.F95','.f03','.F03','.f08','.F08')
def fc_hook(self, node):
	"Binds the Fortran file extensions create :py:class:`waflib.Tools.fc.fc` instances"
	return self.create_compiled_task('fc', node)

@conf
def modfile(conf, name):
	"""
	Turns a module name into the right module file name.
	Defaults to all lower case.
	"""
	if name.find(':') >= 0:
		# Depending on a submodule!
		separator = conf.env.FC_SUBMOD_SEPARATOR or '@'
		# Ancestors of the submodule will be prefixed to the
		# submodule name, separated by a colon.
		modpath = name.split(':')
		# Only the ancestor (actual) module and the submodule name
		# will be used for the filename.
		modname = modpath[0] + separator + modpath[-1]

# Path: waflib/Tools/ccroot.py
# SYSTEM_LIB_PATHS = ['/usr/lib64', '/usr/lib', '/usr/local/lib64', '/usr/local/lib']
# USELIB_VARS = Utils.defaultdict(set)
# def create_compiled_task(self, name, node):
# def to_incnodes(self, inlst):
# def apply_incpaths(self):
# 	def add_target(self, target):
# 	def exec_command(self, *k, **kw):
# 	def exec_mf(self):
# def rm_tgt(cls):
# 	def wrap(self):
# def apply_skip_stlib_link_deps(self):
# def apply_link(self):
# def use_rec(self, name, **kw):
# def process_use(self):
# def accept_node_to_link(self, node):
# def add_objects_from_tgen(self, tg):
# def get_uselib_vars(self):
# def propagate_uselib_vars(self):
# def apply_implib(self):
# def apply_vnum(self):
# 	def keyword(self):
# 	def run(self):
# 	def runnable_status(self):
# 	def runnable_status(self):
# def read_shlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def read_stlib(self, name, paths=[], export_includes=[], export_defines=[]):
# def process_lib(self):
# 	def runnable_status(self):
# def add_those_o_files(self, node):
# def process_objs(self):
# def read_object(self, obj):
# def set_full_paths_hpux(self):
# class link_task(Task.Task):
# class stlink_task(link_task):
# class vnum(Task.Task):
# class fake_shlib(link_task):
# class fake_stlib(stlink_task):
# class fake_o(Task.Task):
# 
# Path: waflib/TaskGen.py
# def extension(*k):
# 	"""
# 	Decorator that registers a task generator method which will be invoked during
# 	the processing of source files for the extension given::
# 
# 		from waflib import Task
# 		class mytask(Task):
# 			run_str = 'cp ${SRC} ${TGT}'
# 		@extension('.moo')
# 		def create_maa_file(self, node):
# 			self.create_task('mytask', node, node.change_ext('.maa'))
# 		def build(bld):
# 			bld(source='foo.moo')
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for x in k:
# 			task_gen.mappings[x] = func
# 		return func
# 	return deco
# 
# Path: waflib/Configure.py
# def conf(f):
# 	"""
# 	Decorator: attach new configuration functions to :py:class:`waflib.Build.BuildContext` and
# 	:py:class:`waflib.Configure.ConfigurationContext`. The methods bound will accept a parameter
# 	named 'mandatory' to disable the configuration errors::
# 
# 		def configure(conf):
# 			conf.find_program('abc', mandatory=False)
# 
# 	:param f: method to bind
# 	:type f: function
# 	"""
# 	def fun(*k, **kw):
# 		mandatory = kw.pop('mandatory', True)
# 		try:
# 			return f(*k, **kw)
# 		except Errors.ConfigurationError:
# 			if mandatory:
# 				raise
# 
# 	fun.__name__ = f.__name__
# 	setattr(ConfigurationContext, f.__name__, fun)
# 	setattr(Build.BuildContext, f.__name__, fun)
# 	return f


# Path: waflib/Tools/fc.py
from waflib import Utils, Task, Errors
from waflib.Tools import ccroot, fc_config, fc_scan
from waflib.TaskGen import extension
from waflib.Configure import conf

"""
Fortran support
"""


ccroot.USELIB_VARS['fc'] = set(['FCFLAGS', 'DEFINES', 'INCLUDES', 'FCPPFLAGS'])
ccroot.USELIB_VARS['fcprogram_test'] = ccroot.USELIB_VARS['fcprogram'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS'])
ccroot.USELIB_VARS['fcshlib'] = set(['LIB', 'STLIB', 'LIBPATH', 'STLIBPATH', 'LINKFLAGS', 'RPATH', 'LINKDEPS'])
ccroot.USELIB_VARS['fcstlib'] = set(['ARFLAGS', 'LINKDEPS'])

@extension('.f','.F','.f90','.F90','.for','.FOR','.f95','.F95','.f03','.F03','.f08','.F08')
def fc_hook(self, node):
	"Binds the Fortran file extensions create :py:class:`waflib.Tools.fc.fc` instances"
	return self.create_compiled_task('fc', node)

@conf
def modfile(conf, name):
	"""
	Turns a module name into the right module file name.
	Defaults to all lower case.
	"""
	if name.find(':') >= 0:
		# Depending on a submodule!
		separator = conf.env.FC_SUBMOD_SEPARATOR or '@'
		# Ancestors of the submodule will be prefixed to the
		# submodule name, separated by a colon.
		modpath = name.split(':')
		# Only the ancestor (actual) module and the submodule name
		# will be used for the filename.
		modname = modpath[0] + separator + modpath[-1]

		suffix = conf.env.FC_SUBMOD_SUFFIX or '.smod'