]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright Noel Belcourt 2007. |
2 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 TL |
3 | # (See accompanying file LICENSE.txt or copy at |
4 | # https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
5 | |
6 | import property ; | |
7 | import generators ; | |
8 | import os ; | |
9 | import toolset : flags ; | |
10 | import feature ; | |
11 | import fortran ; | |
12 | import type ; | |
13 | import common ; | |
14 | ||
15 | feature.extend toolset : mipspro ; | |
16 | toolset.inherit mipspro : unix ; | |
17 | generators.override mipspro.prebuilt : builtin.lib-generator ; | |
18 | generators.override mipspro.searched-lib-generator : searched-lib-generator ; | |
19 | ||
20 | # Documentation and toolchain description located | |
21 | # http://www.sgi.com/products/software/irix/tools/ | |
22 | ||
1e59de90 | 23 | rule init ( version ? : command * : options * ) |
7c673cae | 24 | { |
1e59de90 | 25 | local condition = [ |
7c673cae FG |
26 | common.check-init-parameters mipspro : version $(version) ] ; |
27 | ||
28 | command = [ common.get-invocation-command mipspro : CC : $(command) ] ; | |
29 | ||
30 | common.handle-options mipspro : $(condition) : $(command) : $(options) ; | |
1e59de90 | 31 | |
7c673cae FG |
32 | command_c = $(command_c[1--2]) $(command[-1]:B=cc) ; |
33 | ||
34 | toolset.flags mipspro CONFIG_C_COMMAND $(condition) : $(command_c) ; | |
35 | ||
36 | # fortran support | |
1e59de90 | 37 | local command = [ |
7c673cae FG |
38 | common.get-invocation-command mipspro : f77 : $(command) : $(install_dir) ] ; |
39 | ||
40 | command_f = $(command_f[1--2]) $(command[-1]:B=f77) ; | |
41 | toolset.flags mipspro CONFIG_F_COMMAND $(condition) : $(command_f) ; | |
42 | ||
43 | # set link flags | |
1e59de90 | 44 | flags mipspro.link FINDLIBS-ST : [ |
7c673cae FG |
45 | feature.get-values <find-static-library> : $(options) ] : unchecked ; |
46 | ||
1e59de90 | 47 | flags mipspro.link FINDLIBS-SA : [ |
7c673cae FG |
48 | feature.get-values <find-shared-library> : $(options) ] : unchecked ; |
49 | } | |
50 | ||
51 | # Declare generators | |
52 | generators.register-c-compiler mipspro.compile.c : C : OBJ : <toolset>mipspro ; | |
53 | generators.register-c-compiler mipspro.compile.c++ : CPP : OBJ : <toolset>mipspro ; | |
54 | generators.register-fortran-compiler mipspro.compile.fortran : FORTRAN : OBJ : <toolset>mipspro ; | |
55 | ||
56 | cpu-arch-32 = | |
57 | <architecture>/<address-model> | |
58 | <architecture>/<address-model>32 ; | |
59 | ||
60 | cpu-arch-64 = | |
61 | <architecture>/<address-model>64 ; | |
62 | ||
63 | flags mipspro.compile OPTIONS $(cpu-arch-32) : -n32 ; | |
64 | flags mipspro.compile OPTIONS $(cpu-arch-64) : -64 ; | |
65 | ||
66 | # Declare flags and actions for compilation | |
1e59de90 | 67 | flags mipspro.compile OPTIONS <debug-symbols>on : -g ; |
7c673cae FG |
68 | # flags mipspro.compile OPTIONS <profiling>on : -xprofile=tcov ; |
69 | flags mipspro.compile OPTIONS <warnings>off : -w ; | |
70 | flags mipspro.compile OPTIONS <warnings>on : -ansiW -diag_suppress 1429 ; # suppress long long is nonstandard warning | |
71 | flags mipspro.compile OPTIONS <warnings>all : -fullwarn ; | |
20effc67 TL |
72 | flags mipspro.compile OPTIONS <warnings>extra : -fullwarn ; |
73 | flags mipspro.compile OPTIONS <warnings>pedantic : -fullwarn -ansiW -diag_suppress 1429 ; # suppress long long is nonstandard warning | |
74 | flags mipspro.compile OPTIONS <warnings-as-errors>on : -w2 ; | |
7c673cae FG |
75 | flags mipspro.compile OPTIONS <optimization>speed : -Ofast ; |
76 | flags mipspro.compile OPTIONS <optimization>space : -O2 ; | |
11fdf7f2 TL |
77 | flags mipspro.compile OPTIONS <cflags> : "-LANG:std" ; |
78 | flags mipspro.compile.c++ OPTIONS <inlining>off : "-INLINE:none" ; | |
7c673cae FG |
79 | flags mipspro.compile.c++ OPTIONS <cxxflags> ; |
80 | flags mipspro.compile DEFINES <define> ; | |
81 | flags mipspro.compile INCLUDES <include> ; | |
82 | ||
83 | ||
84 | flags mipspro.compile.fortran OPTIONS <fflags> ; | |
85 | ||
86 | actions compile.c | |
87 | { | |
88 | "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
89 | } | |
90 | ||
91 | actions compile.c++ | |
92 | { | |
93 | "$(CONFIG_COMMAND)" -FE:template_in_elf_section -ptused $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
94 | } | |
95 | ||
96 | actions compile.fortran | |
97 | { | |
98 | "$(CONFIG_F_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
99 | } | |
100 | ||
101 | # Declare flags and actions for linking | |
102 | flags mipspro.link OPTIONS <debug-symbols>on : -g ; | |
103 | # Strip the binary when no debugging is needed | |
104 | # flags mipspro.link OPTIONS <debug-symbols>off : -s ; | |
105 | # flags mipspro.link OPTIONS <profiling>on : -xprofile=tcov ; | |
106 | # flags mipspro.link OPTIONS <threading>multi : -mt ; | |
107 | ||
108 | flags mipspro.link OPTIONS $(cpu-arch-32) : -n32 ; | |
109 | flags mipspro.link OPTIONS $(cpu-arch-64) : -64 ; | |
110 | ||
111 | flags mipspro.link OPTIONS <optimization>speed : -Ofast ; | |
112 | flags mipspro.link OPTIONS <optimization>space : -O2 ; | |
113 | flags mipspro.link OPTIONS <linkflags> ; | |
114 | flags mipspro.link LINKPATH <library-path> ; | |
115 | flags mipspro.link FINDLIBS-ST <find-static-library> ; | |
116 | flags mipspro.link FINDLIBS-SA <find-shared-library> ; | |
117 | flags mipspro.link FINDLIBS-SA <threading>multi : pthread ; | |
118 | flags mipspro.link LIBRARIES <library-file> ; | |
119 | flags mipspro.link LINK-RUNTIME <runtime-link>static : static ; | |
120 | flags mipspro.link LINK-RUNTIME <runtime-link>shared : dynamic ; | |
121 | flags mipspro.link RPATH <dll-path> ; | |
122 | ||
123 | rule link ( targets * : sources * : properties * ) | |
124 | { | |
125 | SPACE on $(targets) = " " ; | |
126 | } | |
127 | ||
128 | actions link bind LIBRARIES | |
129 | { | |
130 | "$(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 | |
131 | } | |
132 | ||
133 | # Slight mods for dlls | |
134 | rule link.dll ( targets * : sources * : properties * ) | |
135 | { | |
136 | SPACE on $(targets) = " " ; | |
137 | } | |
138 | ||
139 | actions link.dll bind LIBRARIES | |
140 | { | |
141 | "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME) | |
142 | } | |
143 | ||
144 | # Declare action for creating static libraries | |
145 | actions piecemeal archive | |
146 | { | |
147 | ar -cr "$(<)" "$(>)" | |
148 | } |