~manxi-david/pyeffect/pyeffect

« back to all changes in this revision

Viewing changes to s5/s5.py

  • Committer: dvspeed
  • Date: 2011-12-26 13:18:36 UTC
  • Revision ID: manxi.david@gmail.com-20111226131836-mvoy9y32z0ujxvm1
-Change of folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2011 David Manzanares <manxi.david@gmail.com>
2
 
#This file is part of PyEffect.
3
 
#
4
 
# PyEffect is free software: you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation, either version 3 of the License, or
7
 
# (at your option) any later version.
8
 
#
9
 
# PyEffect is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
 
# GNU General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with PyEffect. If not, see <http://www.gnu.org/licenses/>.
16
 
 
17
 
#This is the PyEffect Stage 4
18
 
 
19
 
#Purpose:
20
 
#Assemble and link the assembly code
21
 
 
22
 
#Third party libraries
23
 
import os
24
 
 
25
 
#Own libraries:
26
 
import args
27
 
import out
28
 
 
29
 
ldargs = ""
30
 
 
31
 
def comp():
32
 
        global ldargs
33
 
        #Assemble the code
34
 
        target = args.target
35
 
        asArgs = ""
36
 
        if args.gstabs == True:
37
 
                asArgs = asArgs + "--gstabs "
38
 
        gas="as " + asArgs + target[0:(len(target) - 1)] + "s -o " + target[0:(len(target) - 1)] + "o"
39
 
        out.prg("Compiling assembler code with GAS ("+repr(gas)+")...")
40
 
        os.system(gas)
41
 
        #Link the object code
42
 
        ld="ld " + target[0:(len(target) - 1)] + "o -dynamic-linker  /lib64/ld-linux-x86-64.so.2 -o " + target[0:(len(target) - 2)] + ldargs
43
 
        out.prg("Linking ("+repr(ld)+")...")
44
 
        os.system(ld)