Module: OSTN02C

Defined in:
ext/ostn02c.rb

Class Method Summary collapse

Class Method Details

.compileObject



11
12
13
14
15
16
17
# File 'ext/ostn02c.rb', line 11

def compile
  puts "Compiling libostn02"
  FileUtils.mkdir_p object_path
  Dir.chdir object_path do
    system RbConfig.expand("$(CC) -I#{include_path} $(CPPFLAGS) $(CFLAGS) -c #{sources.join(" ")}")
  end
end

.include_pathObject



37
38
39
# File 'ext/ostn02c.rb', line 37

def include_path
  File.expand_path("ostn02c/OSTN02", __dir__)
end

.lib_pathObject



41
42
43
# File 'ext/ostn02c.rb', line 41

def lib_path
  File.join(output_path, "lib")
end

.libraryObject



33
34
35
# File 'ext/ostn02c.rb', line 33

def library
  File.join(lib_path, "libostn02.a")
end

.makeObject



7
8
9
# File 'ext/ostn02c.rb', line 7

def make
  compile and package
end

.object_pathObject



45
46
47
# File 'ext/ostn02c.rb', line 45

def object_path
  File.join(output_path, "obj")
end

.objectsObject



29
30
31
# File 'ext/ostn02c.rb', line 29

def objects
  File.join(object_path, "*.o")
end

.output_pathObject



49
50
51
# File 'ext/ostn02c.rb', line 49

def output_path
  File.expand_path("../tmp/ostn02c", __dir__)
end

.packageObject



19
20
21
22
23
# File 'ext/ostn02c.rb', line 19

def package
  puts "Packaging libostn02"
  FileUtils.mkdir_p lib_path
  system RbConfig.expand("$(AR) -crsv #{library} #{objects}")
end

.sourcesObject



25
26
27
# File 'ext/ostn02c.rb', line 25

def sources
  Dir.glob(File.join(include_path, "*.c"))
end