Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad2424007f | ||
|
|
c3c6385068 | ||
|
|
13b9499fbf | ||
|
|
4286925f95 | ||
|
|
0db5614555 | ||
|
|
5d0bbf73ab | ||
|
|
75977981c0 |
No files matched your search
@@ -8,9 +8,9 @@ module Rscons
|
||||
'OBJSUFFIX' => '.o',
|
||||
'LIBSUFFIX' => '.a',
|
||||
'LDFLAGS' => [],
|
||||
'LIBPATHS' => [],
|
||||
'LIBPATH' => [],
|
||||
'LIBS' => [],
|
||||
'LDCOM' => ['$LD', '-o', '$TARGET', '$LDFLAGS', '$SOURCES', '-L$[LIBPATHS]', '-l$[LIBS]']
|
||||
'LDCOM' => ['$LD', '-o', '$TARGET', '$LDFLAGS', '$SOURCES', '-L$[LIBPATH]', '-l$[LIBS]']
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ module Rscons
|
||||
@varset = VarSet.new(variables)
|
||||
@targets = {}
|
||||
@builders = {}
|
||||
@build_dirs = {}
|
||||
@build_dirs = []
|
||||
@varset[:exclude_builders] ||= []
|
||||
unless @varset[:exclude_builders] == :all
|
||||
exclude_builders = Set.new(@varset[:exclude_builders] || [])
|
||||
@@ -52,9 +52,6 @@ module Rscons
|
||||
@builders.each do |builder_name, builder|
|
||||
env.add_builder(builder)
|
||||
end
|
||||
@build_dirs.each do |src_dir, obj_dir|
|
||||
env.build_dir(src_dir, obj_dir)
|
||||
end
|
||||
env.append(@varset)
|
||||
env.append(variables)
|
||||
|
||||
@@ -79,7 +76,9 @@ module Rscons
|
||||
# Specify a build directory for this Environment.
|
||||
# Source files from src_dir will produce object files under obj_dir.
|
||||
def build_dir(src_dir, obj_dir)
|
||||
@build_dirs[src_dir.gsub('\\', '/')] = obj_dir.gsub('\\', '/')
|
||||
src_dir = src_dir.gsub('\\', '/') if src_dir.is_a?(String)
|
||||
obj_dir = obj_dir.gsub('\\', '/')
|
||||
@build_dirs << [src_dir, obj_dir]
|
||||
end
|
||||
|
||||
# Return the file name to be built from source_fname with suffix suffix.
|
||||
@@ -89,8 +88,13 @@ module Rscons
|
||||
def get_build_fname(source_fname, suffix)
|
||||
build_fname = source_fname.set_suffix(suffix).gsub('\\', '/')
|
||||
@build_dirs.each do |src_dir, obj_dir|
|
||||
if src_dir.is_a?(Regexp)
|
||||
build_fname.sub!(src_dir, obj_dir)
|
||||
else
|
||||
build_fname.sub!(/^#{src_dir}\//, "#{obj_dir}/")
|
||||
end
|
||||
build_fname.gsub!('\\', '/')
|
||||
end
|
||||
FileUtils.mkdir_p(File.dirname(build_fname))
|
||||
build_fname
|
||||
end
|
||||
@@ -212,10 +216,11 @@ module Rscons
|
||||
if line =~ /^(.*)\\\s*$/
|
||||
buildup += ' ' + $1
|
||||
else
|
||||
if line =~ /^(.*): (.*)$/
|
||||
target, tdeps = $1.strip, $2
|
||||
if target == target
|
||||
deps += tdeps.split(' ').map(&:strip)
|
||||
buildup += ' ' + line
|
||||
if buildup =~ /^(.*): (.*)$/
|
||||
mf_target, mf_deps = $1.strip, $2
|
||||
if mf_target == target
|
||||
deps += mf_deps.split(' ').map(&:strip)
|
||||
end
|
||||
end
|
||||
buildup = ''
|
||||
|
||||
@@ -6,6 +6,7 @@ class String
|
||||
def has_suffix?(suffix)
|
||||
if suffix
|
||||
suffix = [suffix] if suffix.is_a?(String)
|
||||
suffix = suffix.flatten
|
||||
suffix.find {|s| self.end_with?(s)}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module Rscons
|
||||
# gem version
|
||||
VERSION = "0.0.1"
|
||||
VERSION = "0.0.2"
|
||||
end
|
||||
+2
-1
@@ -10,7 +10,8 @@ Gem::Specification.new do |gem|
|
||||
gem.email = ["jholtrop@gmail.com"]
|
||||
gem.description = %q{Software construction library inspired by SCons and implemented in Ruby}
|
||||
gem.summary = %q{Software construction library inspired by SCons and implemented in Ruby}
|
||||
gem.homepage = ""
|
||||
gem.homepage = "https://github.com/holtrop/rscons"
|
||||
gem.license = 'MIT'
|
||||
|
||||
gem.files = `git ls-files`.split($/)
|
||||
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
module Rscons
|
||||
describe Environment do
|
||||
describe '.parse_makefile_deps' do
|
||||
it 'handles dependencies on one line' do
|
||||
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
||||
module.o: source.cc
|
||||
EOS
|
||||
env = Environment.new
|
||||
env.parse_makefile_deps('makefile', 'module.o').should == ['source.cc']
|
||||
end
|
||||
|
||||
it 'handles dependencies split across many lines' do
|
||||
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
||||
module.o: module.c \\
|
||||
module.h \\
|
||||
other.h
|
||||
EOS
|
||||
env = Environment.new
|
||||
env.parse_makefile_deps('makefile', 'module.o').should == [
|
||||
'module.c', 'module.h', 'other.h']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user