summaryrefslogtreecommitdiff
path: root/kernel/SConscript
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2009-12-23 22:26:43 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2009-12-23 22:31:02 +0100
commit864fb03a3305b65fedbe434ebb87510ac13fe865 (patch)
tree6b0b2b0dccf6fd1835a4e86ba808fbad2cba89cb /kernel/SConscript
Initial commit.
Diffstat (limited to 'kernel/SConscript')
-rw-r--r--kernel/SConscript30
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/SConscript b/kernel/SConscript
new file mode 100644
index 0000000..87fcb1f
--- /dev/null
+++ b/kernel/SConscript
@@ -0,0 +1,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('kernel', ['kernel.ld', 'entry.c', 'main.c'])