summaryrefslogtreecommitdiff
path: root/SConstruct
blob: e04055639a22c7f5059e6fbecdf78adde7e73c8b (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os

toolchain_prefix = 'i386-elf-'

env = Environment(
	ENV = os.environ,
	
	CC = toolchain_prefix + 'gcc',
	CCFLAGS = '-Wall -W -nostdinc -fno-builtin -fno-hosted -ggdb -std=gnu99 -m32',
	
	LINK = toolchain_prefix + 'ld',
	LINKFLAGS = '-nostdinc -nostdlib',
)

def standalone_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))
	
standalone_bld = Builder(
	generator = standalone_bld_generator,
	suffix = '',
	src_suffix = '.o',
	src_builder = 'Object',
	target_scanner = ProgramScanner
)

env.Append(BUILDERS = {'Standalone' : standalone_bld})

Export('env')

env.SConscript('kernel/SConscript')

env.SConscript('modules/SConscript')

env.SConscript('floppy/SConscript')

env.Command('qemu', ['kernel', 'modules'], 'qemu -s -m 32 -boot n -tftp . -bootp /pxelinux.0')

Default('kernel')