| 1 | # This file was originally based on gcc-tools.jam by David Abrahams. |
|---|
| 2 | # |
|---|
| 3 | # It has been written for and tested with MIPSpro 7.3 on IRIX 6.5 |
|---|
| 4 | # with a variety of setups. |
|---|
| 5 | # |
|---|
| 6 | # TODO list (in no particular order): |
|---|
| 7 | # |
|---|
| 8 | # - Add support for the dllversion free-feature using MIPSpro's |
|---|
| 9 | # soname support. |
|---|
| 10 | # - Factor out repetitive code. |
|---|
| 11 | # - Decide if `$(<[1])' is better than `$(<)'. |
|---|
| 12 | # - Make further use of the `architecture' free feature by using |
|---|
| 13 | # `-TARG' and others. |
|---|
| 14 | # - A free feature `mipspro-woff' so users can specify woff |
|---|
| 15 | # values at the command-line. |
|---|
| 16 | # - Figure out what to do with the so_locations file. |
|---|
| 17 | # - Figure out what to do with the ii_files directory. |
|---|
| 18 | |
|---|
| 19 | # The following #// line will be used by the regression test table generation |
|---|
| 20 | # program as the column heading for HTML tables. Must not include version number. |
|---|
| 21 | #//<a href="http://www.sgi.com/developers/devtools/languages/mipspro.html">SGI<br>MIPSpro</a> |
|---|
| 22 | |
|---|
| 23 | # compute directories for invoking MIPSpro: first try ROOT and |
|---|
| 24 | # TOOLROOT, which are traditionally used for this purpose. |
|---|
| 25 | MIPSPRO_ROOT_DIRECTORY ?= "$(ROOT)/usr" ; |
|---|
| 26 | MIPSPRO_TOOLROOT_DIRECTORY ?= "$(TOOLROOT)/usr" ; |
|---|
| 27 | |
|---|
| 28 | # Either ROOT or TOOLROOT missing? Fall back to the default. |
|---|
| 29 | MIPSPRO_ROOT_DIRECTORY ?= "/usr" ; |
|---|
| 30 | MIPSPRO_TOOLROOT_DIRECTORY ?= "/usr" ; |
|---|
| 31 | |
|---|
| 32 | # For most users, either ROOT/TOOLROOT or |
|---|
| 33 | # MIPSPRO_ROOT_DIRECTORY/MIPSPRO_TOOLROOT_DIRECTORY should be |
|---|
| 34 | # sufficient. Users needing to further customize the executable |
|---|
| 35 | # directory or include directory can use MIPSPRO_BIN_DIRECTORY, |
|---|
| 36 | # MIPSPRO_INCLUDE_DIRECTORY, and MIPSPRO_C++INCLUDE_DIRECTORY. |
|---|
| 37 | |
|---|
| 38 | MIPSPRO_BIN_DIRECTORY ?= "$(MIPSPRO_TOOLROOT_DIRECTORY)/bin" ; |
|---|
| 39 | |
|---|
| 40 | MIPSPRO_INCLUDE_DIRECTORY ?= "$(MIPSPRO_TOOLROOT_DIRECTORY)/include" |
|---|
| 41 | "$(MIPSPRO_ROOT_DIRECTORY)/include" ; |
|---|
| 42 | |
|---|
| 43 | MIPSPRO_C++INCLUDE_DIRECTORY ?= "$(MIPSPRO_INCLUDE_DIRECTORY)/CC" ; |
|---|
| 44 | |
|---|
| 45 | # Because we have special logic for finding directories based on |
|---|
| 46 | # the ABI and ISA, it is difficult to have a separate user-definable |
|---|
| 47 | # variable to specify the library paths. As mentioned above, |
|---|
| 48 | # MIPSPRO_ROOT_DIRECTORY should be good enough for most users. |
|---|
| 49 | |
|---|
| 50 | local MIPSPRO_STDLIB_ROOTS = "$(MIPSPRO_TOOLROOT_DIRECTORY)" |
|---|
| 51 | "$(MIPSPRO_ROOT_DIRECTORY)" |
|---|
| 52 | ; |
|---|
| 53 | local MIPSPRO_STDLIB_MIPS3_SUBDIRECTORIES = "mips3" "" ; |
|---|
| 54 | local MIPSPRO_STDLIB_MIPS4_SUBDIRECTORIES = "mips4" "" ; |
|---|
| 55 | |
|---|
| 56 | flags mipspro LINKFLAGS : -nostdlib ; |
|---|
| 57 | flags mipspro LINKFLAGS <target-type>$(SHARED_TYPES) : -shared ; |
|---|
| 58 | flags mipspro LINKFLAGS <debug-symbols>off : -s ; |
|---|
| 59 | |
|---|
| 60 | # We better link the maths library unconditionally. |
|---|
| 61 | flags mipspro FINDLIBS : m ; |
|---|
| 62 | |
|---|
| 63 | flags mipspro DEFINES <threading>multi : _SGI_MP_SOURCE ; |
|---|
| 64 | flags mipspro FINDLIBS <threading>multi : pthread ; |
|---|
| 65 | |
|---|
| 66 | flags mipspro CFLAGS : -nostdinc |
|---|
| 67 | -LANG:std -OPT:Olimit=0 -OPT:IEEE_NaN_inf=ON -no_auto_include |
|---|
| 68 | ; |
|---|
| 69 | |
|---|
| 70 | flags mipspro CFLAGS <address-model>default : -n32 ; |
|---|
| 71 | flags mipspro CFLAGS <address-model>32 : -n32 ; |
|---|
| 72 | flags mipspro CFLAGS <address-model>64 : -64 ; |
|---|
| 73 | flags mipspro CFLAGS <architecture>native : -mips3 ; |
|---|
| 74 | flags mipspro CFLAGS <architecture>mips3 : -mips3 ; |
|---|
| 75 | flags mipspro CFLAGS <architecture>mips4 : -mips4 ; |
|---|
| 76 | |
|---|
| 77 | flags mipspro CFLAGS <optimization>off : -O0 ; |
|---|
| 78 | flags mipspro CFLAGS <optimization>speed : -O3 ; |
|---|
| 79 | flags mipspro CFLAGS <optimization>space : -O2 ; |
|---|
| 80 | |
|---|
| 81 | flags mipspro CFLAGS <debug-symbols>off : -g0 ; |
|---|
| 82 | flags mipspro CFLAGS <debug-symbols>on/<optimization>off : -g ; |
|---|
| 83 | flags mipspro CFLAGS <debug-symbols>on/<optimization>speed : -g3 ; |
|---|
| 84 | flags mipspro CFLAGS <debug-symbols>on/<optimization>space : -g3 ; |
|---|
| 85 | |
|---|
| 86 | # Uncomment the following to enable various SGI extensions. |
|---|
| 87 | |
|---|
| 88 | #flags mipspro DEFINES : _SGI_SOURCE ; |
|---|
| 89 | |
|---|
| 90 | # If you want more warnings, uncomment the following lines. These are |
|---|
| 91 | # a few warning numbers that you'll probably want to disable. |
|---|
| 92 | # 1375: The destructor for base class is not virtual. |
|---|
| 93 | # 1424: Template parameter not used in declaring the argument types of function template. |
|---|
| 94 | # 1234: Access control is not specified. |
|---|
| 95 | |
|---|
| 96 | #flags mipspro CFLAGS : -fullwarn -woff 1375,1424,1234 ; |
|---|
| 97 | |
|---|
| 98 | # For some C++ apps, adding -IPA can make a big difference. However, because |
|---|
| 99 | # it does global optimizations such as inlining code between compilation |
|---|
| 100 | # units, it introduces a lot of dependancies that this build system is |
|---|
| 101 | # unable to track. When using -IPA here, be sure to run the `clean' target |
|---|
| 102 | # before each build to ensure that everything is rebuilt properly. |
|---|
| 103 | |
|---|
| 104 | #flags mipspro CFLAGS <optimization>speed : -IPA ; |
|---|
| 105 | #flags mipspro LINKFLAGS <optimization>speed : -IPA ; |
|---|
| 106 | |
|---|
| 107 | # An option for <inlining>full is -INLINE:all, however that may cause |
|---|
| 108 | # too much to be inlined. I don't think that level of inlining is what |
|---|
| 109 | # is meant by <inlining>full. |
|---|
| 110 | |
|---|
| 111 | flags mipspro CFLAGS <inlining>off : -INLINE:none ; |
|---|
| 112 | flags mipspro CFLAGS <inlining>on : -INLINE ; |
|---|
| 113 | flags mipspro CFLAGS <inlining>full : -INLINE ; |
|---|
| 114 | |
|---|
| 115 | flags mipspro C++FLAGS <exception-handling>off : -LANG:exceptions=OFF ; |
|---|
| 116 | |
|---|
| 117 | flags mipspro STDHDRS : "$(MIPSPRO_INCLUDE_DIRECTORY)" ; |
|---|
| 118 | flags mipspro STDC++HDRS : "$(MIPSPRO_C++INCLUDE_DIRECTORY)" |
|---|
| 119 | "$(BOOST_ROOT)/boost/compatibility/cpp_c_headers" |
|---|
| 120 | ; |
|---|
| 121 | |
|---|
| 122 | flags mipspro STDLIBPATH <address-model>default/<architecture>mips3 <architecture>native : |
|---|
| 123 | "$(MIPSPRO_STDLIB_ROOTS)/lib32/$(MIPSPRO_STDLIB_MIPS3_SUBDIRECTORIES)" |
|---|
| 124 | ; |
|---|
| 125 | flags mipspro STDLIBPATH <address-model>default/<architecture>mips4 : |
|---|
| 126 | "$(MIPSPRO_STDLIB_ROOTS)/lib32/$(MIPSPRO_STDLIB_MIPS4_SUBDIRECTORIES)" |
|---|
| 127 | ; |
|---|
| 128 | flags mipspro STDLIBPATH <address-model>32/<architecture>mips3 <architecture>native : |
|---|
| 129 | "$(MIPSPRO_STDLIB_ROOTS)/lib32/$(MIPSPRO_STDLIB_MIPS3_SUBDIRECTORIES)" |
|---|
| 130 | ; |
|---|
| 131 | flags mipspro STDLIBPATH <address-model>32/<architecture>mips4 : |
|---|
| 132 | "$(MIPSPRO_STDLIB_ROOTS)/lib32/$(MIPSPRO_STDLIB_MIPS4_SUBDIRECTORIES)" |
|---|
| 133 | ; |
|---|
| 134 | flags mipspro STDLIBPATH <address-model>64/<architecture>mips3 <architecture>native : |
|---|
| 135 | "$(MIPSPRO_STDLIB_ROOTS)/lib64/$(MIPSPRO_STDLIB_MIPS3_SUBDIRECTORIES)" |
|---|
| 136 | ; |
|---|
| 137 | flags mipspro STDLIBPATH <address-model>64/<architecture>mips4 : |
|---|
| 138 | "$(MIPSPRO_STDLIB_ROOTS)/lib64/$(MIPSPRO_STDLIB_MIPS4_SUBDIRECTORIES)" |
|---|
| 139 | ; |
|---|
| 140 | |
|---|
| 141 | flags mipspro HDRS <include> ; |
|---|
| 142 | flags mipspro UNDEFS <undef> ; |
|---|
| 143 | flags mipspro DEFINES <define> ; |
|---|
| 144 | flags mipspro CFLAGS <cflags> ; |
|---|
| 145 | flags mipspro C++FLAGS <cxxflags> ; |
|---|
| 146 | flags mipspro LIBPATH <library-path> ; |
|---|
| 147 | flags mipspro NEEDLIBS <library-file> ; |
|---|
| 148 | flags mipspro FINDLIBS <find-library> ; |
|---|
| 149 | flags mipspro SYSHDRS <sysinclude> ; |
|---|
| 150 | flags mipspro LINKFLAGS <linkflags> ; |
|---|
| 151 | flags mipspro ARFLAGS <arflags> ; |
|---|
| 152 | |
|---|
| 153 | #### Link (for C++) #### |
|---|
| 154 | |
|---|
| 155 | rule Link-action |
|---|
| 156 | { |
|---|
| 157 | mipspro-Link-action "$(<)" : "$(>)" ; |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | # for mipspro, we repeat all libraries so that dependencies are always resolved |
|---|
| 161 | actions mipspro-Link-action bind NEEDLIBS |
|---|
| 162 | { |
|---|
| 163 | "$(MIPSPRO_BIN_DIRECTORY)/CC" \ |
|---|
| 164 | -o "$(<)" \ |
|---|
| 165 | "$(>)" \ |
|---|
| 166 | "-U$(UNDEFS)" \ |
|---|
| 167 | "-D$(DEFINES)" \ |
|---|
| 168 | "$(CFLAGS)" \ |
|---|
| 169 | "$(C++FLAGS)" \ |
|---|
| 170 | "-I$(HDRS)" \ |
|---|
| 171 | "-I$(STDC++HDRS)" \ |
|---|
| 172 | "-I$(STDHDRS)" \ |
|---|
| 173 | "-I$(SYSHDRS)" \ |
|---|
| 174 | "$(LINKFLAGS)" \ |
|---|
| 175 | "$(NEEDLIBS)" \ |
|---|
| 176 | "$(NEEDLIBS)" \ |
|---|
| 177 | "-L$(LIBPATH)" \ |
|---|
| 178 | "-L$(STDLIBPATH)" \ |
|---|
| 179 | "-l$(FINDLIBS)" |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | #### Cc ##### |
|---|
| 183 | |
|---|
| 184 | rule Cc-action |
|---|
| 185 | { |
|---|
| 186 | mipspro-Cc-action "$(<)" : "$(>)" ; |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | actions mipspro-Cc-action |
|---|
| 190 | { |
|---|
| 191 | "$(MIPSPRO_BIN_DIRECTORY)/cc" -c \ |
|---|
| 192 | "-U$(UNDEFS)" \ |
|---|
| 193 | "-D$(DEFINES)" \ |
|---|
| 194 | "$(CFLAGS)" \ |
|---|
| 195 | "-I$(HDRS)" \ |
|---|
| 196 | "-I$(STDHDRS)" \ |
|---|
| 197 | "-I$(SYSHDRS)" \ |
|---|
| 198 | -o "$(<)" \ |
|---|
| 199 | "$(>)" |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | #### C++ #### |
|---|
| 203 | |
|---|
| 204 | rule C++-action |
|---|
| 205 | { |
|---|
| 206 | mipspro-C++-action "$(<)" : "$(>)" ; |
|---|
| 207 | } |
|---|
| 208 | |
|---|
| 209 | actions mipspro-C++-action |
|---|
| 210 | { |
|---|
| 211 | "$(MIPSPRO_BIN_DIRECTORY)/CC" -c \ |
|---|
| 212 | "-U$(UNDEFS)" \ |
|---|
| 213 | "-D$(DEFINES)" \ |
|---|
| 214 | "$(CFLAGS)" \ |
|---|
| 215 | "$(C++FLAGS)" \ |
|---|
| 216 | "-I$(HDRS)" \ |
|---|
| 217 | "-I$(STDC++HDRS)" \ |
|---|
| 218 | "-I$(STDHDRS)" \ |
|---|
| 219 | "-I$(SYSHDRS)" \ |
|---|
| 220 | -o "$(<)" \ |
|---|
| 221 | "$(>)" |
|---|
| 222 | } |
|---|
| 223 | |
|---|
| 224 | #### Archive #### |
|---|
| 225 | |
|---|
| 226 | rule Archive-action |
|---|
| 227 | { |
|---|
| 228 | mipspro-Archive-action "$(<)" : "$(>)" ; |
|---|
| 229 | } |
|---|
| 230 | |
|---|
| 231 | # For MIPSpro, we don't use update piecemeal together because we're |
|---|
| 232 | # not using the command `ar' directly. We use `CC -ar' so that the |
|---|
| 233 | # prelinker gets run, however when we do this, we loose the ability |
|---|
| 234 | # to update individual compilation units in an archive. |
|---|
| 235 | |
|---|
| 236 | actions mipspro-Archive-action |
|---|
| 237 | { |
|---|
| 238 | "$(MIPSPRO_BIN_DIRECTORY)/CC" -ar \ |
|---|
| 239 | "-U$(UNDEFS)" \ |
|---|
| 240 | "-D$(DEFINES)" \ |
|---|
| 241 | "$(CFLAGS)" \ |
|---|
| 242 | "$(C++FLAGS)" \ |
|---|
| 243 | "-I$(HDRS)" \ |
|---|
| 244 | "-I$(STDC++HDRS)" \ |
|---|
| 245 | "-I$(STDHDRS)" \ |
|---|
| 246 | "-I$(SYSHDRS)" \ |
|---|
| 247 | "-WR,$(ARFLAGS)" \ |
|---|
| 248 | -o "$(<)" \ |
|---|
| 249 | "$(>)" |
|---|
| 250 | } |
|---|