Added generators to create ELF files for mips and mipsel.
[voodoo-lang.git] / lib / voodoo / config.rb.in
blobd2ea15a4eea6e353f612f5c86e17717762ddd733
1 #! /usr/bin/env ruby
3 # Ruby program to generate config.rb
5 default_architecture = ENV['DEFAULT_ARCHITECTURE']
6 default_format = ENV['DEFAULT_FORMAT']
7 gas_command = ENV['GAS'] || 'as'
8 nasm_command = ENV['NASM'] || ENV['YASM'] || 'nasm'
10 print <<EOT
11 module Voodoo
12 # Methods to get and set configuration parameters
13 module Config
14 # Class that holds configuration parameters
15 class Configuration
16 def initialize
17 @default_architecture = #{default_architecture.to_sym.inspect}
18 @default_format = #{default_format.to_sym.inspect}
19 @gas_command = #{gas_command.inspect}
20 @nasm_command = #{nasm_command.inspect}
21 end
23 attr_accessor :default_architecture,
24 :default_format,
25 :gas_command,
26 :nasm_command
27 end
29 DEFAULT_CONFIGURATION = Configuration.new
31 module_function
33 EOT
35 [:default_architecture,
36 :default_format,
37 :gas_command,
38 :nasm_command
39 ].each do |symbol|
40 print <<EOT
41 def #{symbol}
42 DEFAULT_CONFIGURATION.#{symbol}
43 end
45 def #{symbol}= value
46 DEFAULT_CONFIGURATION.#{symbol} = value
47 end
48 EOT
49 end
51 print <<EOT
52 end
53 end
54 EOT