linux.py
Go to the documentation of this file.
1 #
2 # linux.py
3 #
4 # Copyright (c) 2014 Jeremy Garff <jer @ jers.net>
5 #
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without modification, are permitted
9 # provided that the following conditions are met:
10 #
11 # 1. Redistributions of source code must retain the above copyright notice, this list of
12 # conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright notice, this list
14 # of conditions and the following disclaimer in the documentation and/or other materials
15 # provided with the distribution.
16 # 3. Neither the name of the owner nor the names of its contributors may be used to endorse
17 # or promote products derived from this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
20 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
22 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #
28 
29 
30 import SCons
31 import string
32 import array
33 import os
34 
35 
36 tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas']
37 
38 
39 def linux_tools(env):
40  for tool in tools:
41  env.Tool(tool)
42 
43  if not env['V']:
44  env['ARCOMSTR'] = 'AR ${TARGET}'
45  env['ASCOMSTR'] = 'AS ${TARGET}'
46  env['CCCOMSTR'] = 'CC ${TARGET}'
47  env['CXXCOMSTR'] = 'C++ ${TARGET}'
48  env['LINKCOMSTR'] = 'LINK ${TARGET}'
49  env['RANLIBCOMSTR'] = 'RANLIB ${TARGET}'
50 
51 def linux_flags(env):
52  env.MergeFlags({
53  'CPPFLAGS' : '''
54  -fPIC
55  -g
56  -O2
57  -Wall
58  -Wextra
59  -Werror
60  '''.split(),
61  }),
62  env.MergeFlags({
63  'LINKFLAGS' : '''
64  '''.split()
65  })
66 
67 
68 def linux_builders(env):
69  env.Append(BUILDERS = {
70  'Program' : SCons.Builder.Builder(
71  action = SCons.Action.Action('${LINK} -o ${TARGET} ${SOURCES} ${LINKFLAGS}',
72  '${LINKCOMSTR}'),
73  ),
74  })
75  return 1
76 
77 
78 # The following are required functions by SCons when incorporating through tools
79 def exists(env):
80  return 1
81 
82 def generate(env, **kwargs):
83  [f(env) for f in (linux_tools, linux_flags, linux_builders)]
84 
def generate(env, kwargs)
Definition: linux.py:82
def linux_builders(env)
Definition: linux.py:68
def linux_flags(env)
Definition: linux.py:51
def linux_tools(env)
Definition: linux.py:39
def exists(env)
Definition: linux.py:79


ws281x
Author(s): Alexey Rogachevskiy , Oleg Kalachev
autogenerated on Wed Jun 15 2022 02:46:00