2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 19:30:04 +01:00
waf/playground/ldscript/wscript
2024-04-21 07:00:10 +02:00

38 lines
800 B
Python

#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2009 (ita)
VERSION='0.0.1'
APPNAME='cc_test'
top = '.'
out = 'build'
def configure(conf):
conf.load('gcc')
def build(bld):
bld.program(
source = 'main.c',
target = 'test',
ldscript = 'myscript.ld',
linkflags = ['-nostdlib'],
)
from waflib import Errors
from waflib.TaskGen import after_method, feature
@after_method('propagate_uselib_vars')
@feature('cprogram', 'cshlib')
def process_ldscript(self):
if not getattr(self, 'ldscript', None) or self.env.CC_NAME != 'gcc':
return
node = self.path.find_resource(self.ldscript)
if not node:
raise Errors.WafError('could not find %r' % self.ldscript)
self.link_task.env.append_value('LINKFLAGS', '-Wl,-T,%s' % node.abspath())
self.link_task.dep_nodes.append(node)