diff --git a/SConstruct b/SConstruct index 19e9d00..2401e30 100644 --- a/SConstruct +++ b/SConstruct @@ -48,6 +48,8 @@ if 'CPPFLAGS' in os.environ: if 'LDFLAGS' in os.environ: env.Append(LINKFLAGS = SCons.Util.CLVar(os.environ['LDFLAGS'])) +toolenv = env.Clone() + env.Append(CFLAGS = [ "-Wshadow", "-Wno-typedef-redefinition" ]) env.Append(CPPFLAGS = [ "-target", "x86_64-freebsd-freebsd-elf", "-fno-builtin", "-fno-stack-protector", @@ -151,6 +153,7 @@ if not env["CCVERSION"].startswith("15."): conf.Finish() Export('env') +Export('toolenv') # Program start/end diff --git a/sbin/newfs_o2fs/SConscript b/sbin/newfs_o2fs/SConscript index b9d358a..85fc6e8 100644 --- a/sbin/newfs_o2fs/SConscript +++ b/sbin/newfs_o2fs/SConscript @@ -1,14 +1,17 @@ import sys +Import('toolenv') Import('env') newfs_env = env.Clone() +if (env["TOOLCHAINBUILD"] == "TRUE"): + newfs_env = toolenv.Clone() src = [ "newfs_o2fs.c" ] -if newfs_env["TOOLCHAINBUILD"] != "TRUE": +if env["TOOLCHAINBUILD"] != "TRUE": newfs_env.Append(LINKFLAGS = ['-nostdlib']) newfs_env.Append(CPPFLAGS = ['-nostdinc']) newfs_env.Append(LIBPATH = ['#build/lib/libc'], LIBS = ['c'])