# Path: waflib/TaskGen.py
# def feature(*k):
# 	"""
# 	Decorator that registers a task generator method that will be executed when the
# 	object attribute ``feature`` contains the corresponding key(s)::
# 
# 		from waflib.Task import feature
# 		@feature('myfeature')
# 		def myfunction(self):
# 			print('that is my feature!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: feature names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for name in k:
# 			feats[name].update([func.__name__])
# 		return func
# 	return deco
# 
# def after_method(*k):
# 	"""
# 	Decorator that registers a task generator method which will be executed
# 	after the functions of given name(s)::
# 
# 		from waflib.TaskGen import feature, after
# 		@feature('myfeature')
# 		@after_method('fun2')
# 		def fun1(self):
# 			print('feature 1!')
# 		@feature('myfeature')
# 		def fun2(self):
# 			print('feature 2!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: method names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for fun_name in k:
# 			task_gen.prec[fun_name].add(func.__name__)
# 		return func
# 	return deco


from waflib.Utils import def_attrs
from waflib import Task, Options
from waflib.TaskGen import feature, after_method
#!/usr/bin/python
# Grygoriy Fuchedzhy 2010

"""
Support for converting linked targets to ihex, srec or binary files using
objcopy. Use the 'objcopy' feature in conjunction with the 'cc' or 'cxx'
feature. The 'objcopy' feature uses the following attributes:

objcopy_bfdname		Target object format name (eg. ihex, srec, binary).
					   Defaults to ihex.
objcopy_target		 File name used for objcopy output. This defaults to the
					   target name with objcopy_bfdname as extension.
objcopy_install_path   Install path for objcopy_target file. Defaults to ${PREFIX}/fw.
objcopy_flags		  Additional flags passed to objcopy.
"""


class objcopy(Task.Task):
	run_str = '${OBJCOPY} -O ${TARGET_BFDNAME} ${OBJCOPYFLAGS} ${SRC} ${TGT}'
	color   = 'CYAN'


# Path: waflib/TaskGen.py
# def feature(*k):
# 	"""
# 	Decorator that registers a task generator method that will be executed when the
# 	object attribute ``feature`` contains the corresponding key(s)::
# 
# 		from waflib.Task import feature
# 		@feature('myfeature')
# 		def myfunction(self):
# 			print('that is my feature!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: feature names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for name in k:
# 			feats[name].update([func.__name__])
# 		return func
# 	return deco
# 
# def after_method(*k):
# 	"""
# 	Decorator that registers a task generator method which will be executed
# 	after the functions of given name(s)::
# 
# 		from waflib.TaskGen import feature, after
# 		@feature('myfeature')
# 		@after_method('fun2')
# 		def fun1(self):
# 			print('feature 1!')
# 		@feature('myfeature')
# 		def fun2(self):
# 			print('feature 2!')
# 		def build(bld):
# 			bld(features='myfeature')
# 
# 	:param k: method names
# 	:type k: list of string
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for fun_name in k:
# 			task_gen.prec[fun_name].add(func.__name__)
# 		return func
# 	return deco


# Path: waflib/extras/objcopy.py
from waflib.Utils import def_attrs
from waflib import Task, Options
from waflib.TaskGen import feature, after_method

#!/usr/bin/python
# Grygoriy Fuchedzhy 2010

"""
Support for converting linked targets to ihex, srec or binary files using
objcopy. Use the 'objcopy' feature in conjunction with the 'cc' or 'cxx'
feature. The 'objcopy' feature uses the following attributes:

objcopy_bfdname		Target object format name (eg. ihex, srec, binary).
					   Defaults to ihex.
objcopy_target		 File name used for objcopy output. This defaults to the
					   target name with objcopy_bfdname as extension.
objcopy_install_path   Install path for objcopy_target file. Defaults to ${PREFIX}/fw.
objcopy_flags		  Additional flags passed to objcopy.
"""


class objcopy(Task.Task):
	run_str = '${OBJCOPY} -O ${TARGET_BFDNAME} ${OBJCOPYFLAGS} ${SRC} ${TGT}'
	color   = 'CYAN'


@feature('objcopy')