#! /usr/bin/env python
# encoding: utf-8

import sys

def configure(conf):
	conf.load('nasm')
	try:
		size = sys.maxint
	except AttributeError:
		size = sys.maxsize # python 3.2
	if size < 4**21:
		conf.fatal('this example is for 64-bit systems only')

	conf.find_program('ld', var='ASLINK')
	conf.env.ASLINKFLAGS = ['-s']
	conf.env.CPPPATH_ST = '-I%s'
	conf.env.ASFLAGS = ['-f', 'elf64']

def build(bld):

	bld(
		features = 'asm asmprogram',
		source   = 'test.s',
		target   = 'asmtest',
		asflags  = ['-f', 'elf64'],
		includes = '.')

	def disp(ctx):
		node = ctx.bldnode.ant_glob('asmtest*', remove=False)[0]
		ctx.exec_command('%s' % node.abspath(), shell=False)
	bld.add_post_fun(disp)

