OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [SConstruct] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#
2
# Copyright (C) 2007 Bahadir Balban
3
#
4
 
5
import os
6
import glob
7
import sys
8
from os.path import join
9
from string import split
10
from configure import *
11
 
12
config = configuration_retrieve()
13
 
14
project_root = "../.."
15
kernel_headers = join(project_root, "include")
16
l4lib_headers = join(project_root, "tasks/libl4/include")
17
config_h = join(project_root, "include/l4/config.h")
18
 
19
env = Environment(CC = config.toolchain_userspace + 'gcc',
20
                  CCFLAGS = ['-g', '-std=gnu99', '-nostdlib', '-ffreestanding'],
21
                  LINKFLAGS = ['-nostdlib'],
22
                  CPPPATH = ['#include'],
23
                  ENV = {'PATH' : os.environ['PATH']},
24
                  LIBS = 'gcc')
25
 
26
 
27
def extract_arch_subarch_plat(config_header):
28
        '''
29
        From the autogenerated kernel config.h, extracts platform, archictecture,
30
        subarchitecture information. This is used to include the relevant headers
31
        from the kernel directories.
32
        '''
33
        arch = None
34
        subarch = None
35
        plat = None
36
 
37
        if not os.path.exists(config_header):
38
                print "\n\nconfig.h does not exist. "\
39
                      "Please run: `scons configure' first\n\n"
40
                sys.exit()
41
        f = open(config_h, "r")
42
        while True:
43
                line = f.readline()
44
                if line == "":
45
                        break
46
                parts = split(line)
47
                if len(parts) > 0:
48
                        if parts[0] == "#define":
49
                                if parts[1] == "__ARCH__":
50
                                        arch = parts[2]
51
                                elif parts[1] == "__PLATFORM__":
52
                                        plat = parts[2]
53
                                elif parts[1] == "__SUBARCH__":
54
                                        subarch = parts[2]
55
        f.close()
56
        if arch == None:
57
                print "Error: No config symbol found for architecture"
58
                sys.exit()
59
        if subarch == None:
60
                print "Error: No config symbol found for subarchitecture"
61
                sys.exit()
62
        if plat == None:
63
                print "Error: No config symbol found for platform"
64
                sys.exit()
65
        return arch, subarch, plat
66
 
67
arch, subarch, plat = extract_arch_subarch_plat(config_h)
68
 
69
headers = ["#include/posix", l4lib_headers, kernel_headers]
70
 
71
env.Append(CPPPATH = headers)
72
 
73
src = glob.glob("src/*.c") + glob.glob("*.c")
74
 
75
libposix = env.StaticLibrary('posix', src)
76
 
77
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.