mirror of
https://github.com/drasko/codezero.git
synced 2026-01-14 03:43:15 +01:00
Initial commit
This commit is contained in:
42
libs/elf/SConstruct
Normal file
42
libs/elf/SConstruct
Normal file
@@ -0,0 +1,42 @@
|
||||
Import("*")
|
||||
import os
|
||||
import glob
|
||||
|
||||
libs = ["gcc"]
|
||||
|
||||
arch = 'arm'
|
||||
|
||||
# C library information
|
||||
clibvariant = "baremetal"
|
||||
clibroot = os.getcwd() + '/../c'
|
||||
clibpath = os.getcwd() + clibroot + '/build/' + clibvariant
|
||||
cincpath = [clibroot + '/include', clibroot + '/include/arch/%s' % arch]
|
||||
|
||||
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
|
||||
CCFLAGS = ['-g', '-nostdinc', '-nostdlib', '-ffreestanding'],
|
||||
LINKFLAGS = ['-nostdlib'],
|
||||
ENV = {'PATH' : os.environ['PATH']},
|
||||
LIBS = ['gcc','c-' + clibvariant],
|
||||
LIBPATH = clibpath,
|
||||
CPPPATH = ['#include'] + cincpath)
|
||||
|
||||
|
||||
def src_glob(search):
|
||||
"""Src glob is used to find source files easily e.g: src_glob("src/*.c"),
|
||||
the reason we can't just use glob is due to the way SCons handles out
|
||||
of directory builds."""
|
||||
dir = os.path.dirname(search)
|
||||
if dir != "":
|
||||
dir = dir + os.sep
|
||||
src_path = Dir('.').srcnode().abspath
|
||||
files = glob.glob(src_path + os.sep + search)
|
||||
files = map(os.path.basename, files)
|
||||
ret_files = []
|
||||
for file in files:
|
||||
ret_files.append(dir + file)
|
||||
return ret_files
|
||||
|
||||
src = src_glob("src/*.c")
|
||||
|
||||
libelf = env.StaticLibrary('elf', src)
|
||||
|
||||
Reference in New Issue
Block a user