summaryrefslogtreecommitdiff
path: root/tools/build/v2/tools/mipspro.jam
blob: 417eaefcf78d8153bcd65db5e55ce64138fe604a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#  Copyright Noel Belcourt 2007.
#  Distributed under the Boost Software License, Version 1.0.
#    (See accompanying file LICENSE_1_0.txt or copy at
#          http://www.boost.org/LICENSE_1_0.txt)

import property ;
import generators ;
import os ;
import toolset : flags ;
import feature ;
import fortran ;
import type ;
import common ;

feature.extend toolset : mipspro ;
toolset.inherit mipspro : unix ;
generators.override mipspro.prebuilt : builtin.lib-generator ;
generators.override mipspro.searched-lib-generator : searched-lib-generator ;

#  Documentation and toolchain description located
#  http://www.sgi.com/products/software/irix/tools/

rule init ( version ? : command * : options * ) 
{
  local condition = [ 
    common.check-init-parameters mipspro : version $(version) ] ;

  command = [ common.get-invocation-command mipspro : CC : $(command) ] ;

  common.handle-options mipspro : $(condition) : $(command) : $(options) ;
    
  command_c = $(command_c[1--2]) $(command[-1]:B=cc) ;

  toolset.flags mipspro CONFIG_C_COMMAND $(condition) : $(command_c) ;

  # fortran support
  local command = [ 
    common.get-invocation-command mipspro : f77 : $(command) : $(install_dir) ] ;

  command_f = $(command_f[1--2]) $(command[-1]:B=f77) ;
  toolset.flags mipspro CONFIG_F_COMMAND $(condition) : $(command_f) ;

  # set link flags
  flags mipspro.link FINDLIBS-ST : [ 
    feature.get-values <find-static-library> : $(options) ] : unchecked ;

  flags mipspro.link FINDLIBS-SA : [ 
    feature.get-values <find-shared-library> : $(options) ] : unchecked ;
}

# Declare generators
generators.register-c-compiler mipspro.compile.c : C : OBJ : <toolset>mipspro ;
generators.register-c-compiler mipspro.compile.c++ : CPP : OBJ : <toolset>mipspro ;
generators.register-fortran-compiler mipspro.compile.fortran : FORTRAN : OBJ : <toolset>mipspro ;

cpu-arch-32 =
  <architecture>/<address-model>
  <architecture>/<address-model>32 ;

cpu-arch-64 =
  <architecture>/<address-model>64 ;

flags mipspro.compile OPTIONS $(cpu-arch-32) : -n32 ;
flags mipspro.compile OPTIONS $(cpu-arch-64) : -64 ;

# Declare flags and actions for compilation
flags mipspro.compile OPTIONS <debug-symbols>on : -g ; 
# flags mipspro.compile OPTIONS <profiling>on : -xprofile=tcov ;
flags mipspro.compile OPTIONS <warnings>off : -w ;
flags mipspro.compile OPTIONS <warnings>on : -ansiW -diag_suppress 1429 ; # suppress long long is nonstandard warning
flags mipspro.compile OPTIONS <warnings>all : -fullwarn ;
flags mipspro.compile OPTIONS <optimization>speed : -Ofast ;
flags mipspro.compile OPTIONS <optimization>space : -O2 ;
flags mipspro.compile OPTIONS <cflags> : -LANG:std ;
flags mipspro.compile.c++ OPTIONS <inlining>off : -INLINE:none ;
flags mipspro.compile.c++ OPTIONS <cxxflags> ;
flags mipspro.compile DEFINES <define> ;
flags mipspro.compile INCLUDES <include> ;


flags mipspro.compile.fortran OPTIONS <fflags> ;

actions compile.c
{
    "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

actions compile.c++
{
    "$(CONFIG_COMMAND)" -FE:template_in_elf_section -ptused $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

actions compile.fortran
{
    "$(CONFIG_F_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

# Declare flags and actions for linking
flags mipspro.link OPTIONS <debug-symbols>on : -g ;
# Strip the binary when no debugging is needed
# flags mipspro.link OPTIONS <debug-symbols>off : -s ;
# flags mipspro.link OPTIONS <profiling>on : -xprofile=tcov ;
# flags mipspro.link OPTIONS <threading>multi : -mt ;

flags mipspro.link OPTIONS $(cpu-arch-32) : -n32 ;
flags mipspro.link OPTIONS $(cpu-arch-64) : -64 ;

flags mipspro.link OPTIONS <optimization>speed : -Ofast ;
flags mipspro.link OPTIONS <optimization>space : -O2 ;
flags mipspro.link OPTIONS <linkflags> ;
flags mipspro.link LINKPATH <library-path> ;
flags mipspro.link FINDLIBS-ST <find-static-library> ;
flags mipspro.link FINDLIBS-SA <find-shared-library> ;
flags mipspro.link FINDLIBS-SA <threading>multi : pthread ;
flags mipspro.link LIBRARIES <library-file> ;
flags mipspro.link LINK-RUNTIME <runtime-link>static : static ;
flags mipspro.link LINK-RUNTIME <runtime-link>shared : dynamic ;
flags mipspro.link RPATH <dll-path> ;

rule link ( targets * : sources * : properties * )
{
    SPACE on $(targets) = " " ;
}

actions link bind LIBRARIES
{
    "$(CONFIG_COMMAND)" -FE:template_in_elf_section -ptused $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME) -lm
}

# Slight mods for dlls
rule link.dll ( targets * : sources * : properties * )
{
    SPACE on $(targets) = " " ;
}

actions link.dll bind LIBRARIES
{
    "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
}

# Declare action for creating static libraries
actions piecemeal archive
{
    ar -cr "$(<)" "$(>)"
}