Class: MxxRu::Cpp::Toolsets::C89NskFamily

Inherits:
MxxRu::Cpp::Toolset show all
Defined in:
lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb

Overview

Toolset implemetation for c89 NonStopKernel.

Direct Known Subclasses

C89EtkNsk, C89Nsk

Constant Summary collapse

TANDEM_OSS =

Tag name, points to target platform is Open System Services on NonStopKernel.

"tandem_oss"

Constants inherited from MxxRu::Cpp::Toolset

MxxRu::Cpp::Toolset::COMPILER_NAME_TAG, MxxRu::Cpp::Toolset::CPP_COMPILER_NAME_TAG, MxxRu::Cpp::Toolset::C_COMPILER_NAME_TAG, MxxRu::Cpp::Toolset::IMPORT_LIBRARIAN_NAME_TAG, MxxRu::Cpp::Toolset::LIBRARIAN_NAME_TAG, MxxRu::Cpp::Toolset::LINKER_NAME_TAG, MxxRu::Cpp::Toolset::RC_NAME_TAG, MxxRu::Cpp::Toolset::Unknown_tag_ex

Instance Attribute Summary

Attributes inherited from MxxRu::Cpp::Toolset

#cpp_std

Instance Method Summary collapse

Methods inherited from MxxRu::Cpp::Toolset

#clean_dll, #clean_dll_specific_files, #clean_exe, #clean_exe_specific_files, #clean_lib, #clean_lib_specific_files, #clean_mswin_res, #clean_mswin_res_specific_files, #clean_objs, #force_cpp03, #force_cpp0x_std, #force_cpp11, #force_cpp14, #force_cpp17, #full_dll_name, #full_exe_name, #full_lib_name, has_linkable_dependecies?, #make_dll, #make_exe, #make_identification_string, #make_lib, #make_mswin_res, #make_mswin_res_command_lines, #make_objs, #name, #setup_tag, #tag

Constructor Details

#initialize(a_name) ⇒ C89NskFamily

Returns a new instance of C89NskFamily.



42
43
44
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 42

def initialize( a_name )
  super( a_name )
end

Instance Method Details

#c_compiler_nameObject

Returns C compiler name



47
48
49
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 47

def c_compiler_name
  tag( [ C_COMPILER_NAME_TAG, COMPILER_NAME_TAG ], "c89" )
end

#cpp_compiler_nameObject

Returns C++ compiler name.



52
53
54
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 52

def cpp_compiler_name
  tag( [ CPP_COMPILER_NAME_TAG, COMPILER_NAME_TAG ], "c89" )
end

#dll_file_name(source_name, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#dll_file_name.



171
172
173
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 171

def dll_file_name( source_name, target )
  return construct_target_name( source_name, 'lib', '.so', target )
end

#exe_file_name(source_name, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#exe_file_name.



243
244
245
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 243

def exe_file_name( source_name, target )
  return construct_target_name( source_name, NO_PREFIX, NO_SUFFIX, target )
end

See description at MxxRu::Cpp::Toolset#implib_link_name.



176
177
178
179
180
181
182
183
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 176

def implib_link_name(
  dll_real_name,
  target )

  # Target name should be passed to linker on UNIX platform
  return lib_link_name(
    File.basename( target.mxx_target_name ), target )
end

See description at MxxRu::Cpp::Toolset#implib_link_path.



186
187
188
189
190
191
192
193
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 186

def implib_link_path(
  dll_real_name,
  dll_real_path,
  target )

  # DLL name is the import library name on UNIX platform.
  return dll_real_path
end

#lib_file_name(source_name, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#lib_file_name.



148
149
150
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 148

def lib_file_name( source_name, target )
  return construct_target_name( source_name, "lib", ".a", target )
end

See description at MxxRu::Cpp::Toolset#lib_link_name.



153
154
155
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 153

def lib_link_name( source_name, target )
  return source_name
end

#librarian_nameObject

Returns librarian name.



62
63
64
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 62

def librarian_name
  tag( LIBRARIAN_NAME_TAG, "ar" )
end

#linker_nameObject

Returns linker name.



57
58
59
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 57

def linker_name
  tag( LINKER_NAME_TAG, "c89" )
end

#make_c_obj_command_lines(obj_name, source_name, compiler_options, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_c_obj_command_lines.



122
123
124
125
126
127
128
129
130
131
132
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 122

def make_c_obj_command_lines(
  obj_name,
  source_name,
  compiler_options,
  target )

  cmd_line = "-c -o #{obj_name} " +
    "#{compiler_options.join(' ')} #{source_name}"

  return [ "#{c_compiler_name} #{cmd_line}" ]
end

#make_cpp_obj_command_lines(obj_name, source_name, compiler_options, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_c_obj_command_lines.



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 135

def make_cpp_obj_command_lines(
  obj_name,
  source_name,
  compiler_options,
  target )

  cmd_line = "-c -o #{obj_name} " +
    "#{compiler_options.join(' ')} #{source_name}"

  return [ "#{cpp_compiler_name} #{cmd_line}" ]
end

#make_dll_command_lines(a_dll_name, a_dll_info, a_linker_lists, a_target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_dll_command_lines.



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 196

def make_dll_command_lines(
  a_dll_name,
  a_dll_info,
  a_linker_lists,
  a_target )

  result = "-Wshared " +
    "#{a_linker_lists.linker_options.join(' ')} " +
    "-Wld=-export_all " +
    "-o #{a_dll_name} "

  a_linker_lists.lib_paths.each { |p| result << "-L #{p} " }

  result << "#{a_linker_lists.objs.join(' ')} "
  a_linker_lists.libs.each { |l| result << "-l#{l} " }

  return [ "#{linker_name} #{result}" ]
end

#make_dll_requirements(a_dll_name, a_dll_info, a_linker_lists, a_target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_dll_requirements.



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 216

def make_dll_requirements(
  a_dll_name,
  a_dll_info,
  a_linker_lists,
  a_target )

  result = DllRequirements.new

#FIX ME: This should be checked on a real translator.
  # On UNIX all requirements are dependencies.

  # This library, as a first one.
  result.add_libs( [ a_dll_info.link_name ] )
  result.add_lib_paths( [ a_dll_info.link_path ] )

  # And all required libraries.
  a_target.mxx_required_prjs.each { |d|
    if Toolset::has_linkable_dependecies?( d )
      result.add_libs( d.mxx_required_libs )
      result.add_lib_paths( d.mxx_required_lib_paths )
    end
  }

  return result
end

#make_exe_command_lines(a_exe_name, a_exe_info, a_linker_lists, a_target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_exe_command_lines.



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 248

def make_exe_command_lines(
  a_exe_name,
  a_exe_info,
  a_linker_lists,
  a_target )

  result = "-Wcall_shared " +
    "#{a_linker_lists.linker_options.join(' ')} " +
    "-o #{a_exe_name} "

  a_linker_lists.lib_paths.each { |p| result << "-L #{p} " }

  result << "#{a_linker_lists.objs.join(' ')} "
  a_linker_lists.libs.each { |l| result << "-l#{l} " }

  return [ "#{linker_name} #{result}" ]
end

#make_lib_command_lines(lib_name, obj_files, librarian_options, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_lib_command_lines.



158
159
160
161
162
163
164
165
166
167
168
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 158

def make_lib_command_lines(
  lib_name,
  obj_files,
  librarian_options,
  target )

  result = "-r #{librarian_options.join(' ')} " +
    "#{lib_name} #{obj_files.join(' ')}"

  return [ "#{librarian_name} #{result}" ]
end

#obj_file_extObject

See description at MxxRu::Cpp::Toolset#obj_file_ext.



117
118
119
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 117

def obj_file_ext
  return ".o"
end

#setup_mandatory_options(target) ⇒ Object

See description at MxxRu::Cpp::Toolset#setup_mandatory_options.



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
# File 'lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb', line 67

def setup_mandatory_options( target )

  if TANDEM_OSS == tag( "target_os" )
    target.compiler_option( "-Wsystype=oss" )
    target.linker_option( "-Wsystype=oss" )
  end

  target.compiler_option( "-Wcall_shared" )

  if RUNTIME_DEBUG == target.mxx_runtime_mode
    target.compiler_option( "-g" )
    target.linker_option( "-g" )
  elsif RUNTIME_RELEASE == target.mxx_runtime_mode
    target.define( "NDEBUG" )
    target.linker_option( "-s" )
    if OPTIM_SIZE == target.mxx_optimization
      target.compiler_option( "-Woptimize=1" )
    else
      target.compiler_option( "-Woptimize=2" )
    end
  end

  target.compiler_option( "-WIEEE_float" )
  target.compiler_option( "-Wnowarn=1255" )

  target.cpp_compiler_option( "-Wcplusplus" )
  target.linker_option( "-Wcplusplus" )
  target.cpp_compiler_option( "-Wversion3" )
  target.linker_option( "-Wversion3" )

  # No warnings:
  # 1506 - implicit conversion form "unsigned int" to long.
  # 770 - variable set but never used.
  # 734 - function not inlined.
  # 495 - delete of pointer to incomplete class.
  # 270 - pointless comparision of unsigned integer with zero.
  # 262 - variable declared but never referenced.
  # 101 - last line of file ends without a newline.
  target.compiler_option( "-Wnowarn=1506,770,734,495,270,262,101" )

  target.mxx_all_defines.each { |d|
    target.compiler_option( "-D " + d )
  }

  target.mxx_all_include_paths.each { |p|
    target.compiler_option( "-I " + p )
  }
end