summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct30
-rw-r--r--kernel/SConscript29
-rw-r--r--modules/foo/SConscript32
3 files changed, 33 insertions, 58 deletions
diff --git a/SConstruct b/SConstruct
index aa24516..e040556 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,9 +1,37 @@
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')
@@ -12,8 +40,6 @@ env.SConscript('modules/SConscript')
env.SConscript('floppy/SConscript')
-#env.Command('qemu', 'floppy/floppy.img', 'qemu -s -m 32 -fda $SOURCE')
-
env.Command('qemu', ['kernel', 'modules'], 'qemu -s -m 32 -boot n -tftp . -bootp /pxelinux.0')
Default('kernel')
diff --git a/kernel/SConscript b/kernel/SConscript
index 3688850..4d91b9a 100644
--- a/kernel/SConscript
+++ b/kernel/SConscript
@@ -1,33 +1,6 @@
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 = env.Standalone('kernel', [
'kernel.ld',
'entry.c',
'gdt.c',
diff --git a/modules/foo/SConscript b/modules/foo/SConscript
index a79de34..22f150b 100644
--- a/modules/foo/SConscript
+++ b/modules/foo/SConscript
@@ -1,30 +1,6 @@
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'])
+kernel = env.Standalone('foo', [
+ 'foo.ld',
+ 'foo.c',
+])