summaryrefslogtreecommitdiff
path: root/modules/foo/SConscript
blob: a79de34fce0f91797b1a6e0f9b3fd844b728c24c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Import('env')

env = env.Clone(
	CC = 'i386-elf-gcc',
	CCFLAGS = '-Wall -W -nostdinc -fno-builtin -fno-hosted -ggdb -std=gnu99',
	LINK = 'i386-elf-ld',
	LINKFLAGS = '-nostdinc -nostdlib',
)

def kernel_bld_generator(source, target, env, for_signature):
	link_script = None
	for s in source:
		if s.suffix == '.ld':
			link_script = s
			break
	if not link_script:
		Exit(1)
	return '$LINK $LINKFLAGS -o %s -T %s %s ' % (target[0], link_script, ' '.join(str(s) for s in source if s != link_script))
	
kernel_bld = Builder(
	generator = kernel_bld_generator,
	suffix = '',
	src_suffix = '.o',
	src_builder = 'Object',
	target_scanner = ProgramScanner
)

env.Append(BUILDERS = {'Kernel' : kernel_bld})

kernel = env.Kernel('foo', ['foo.ld', 'foo.c'])